ui buttons and screen resolutions

Hello. Beginner here… I have an app set up using display.newImageRect for all my images so I can do content scaling or whatever. I’m new so I was looking around for the best way to make buttons. I cam across the require “ui” and ui.newButton stuff. It seems that I can’t do content scaling with this because it loads and places the image again. Am I missing a step? Or do I have to forget content scaling? Thanks.

Nathan [import]uid: 39302 topic_id: 22967 reply_id: 322967[/import]

I believe the Ghosts VS Monsters sample uses ui buttons with scaling - take a look at that :slight_smile:

Peach [import]uid: 52491 topic_id: 22967 reply_id: 91882[/import]

I’m sorry, but I’m not that good at following and understanding a bunch of code like that. [import]uid: 39302 topic_id: 22967 reply_id: 91969[/import]

Ok, try here; http://developer.anscamobile.com/content/configuring-projects Take a look at @2x section :slight_smile: That is simpler. [import]uid: 52491 topic_id: 22967 reply_id: 92122[/import]

Okay. I checked this out. I have a config.lua file that is working. I’ve been using display.newImageRect for content scaling and it works, but when I use ui.newButton the content scaling isn’t working. It seems like when I make a ui button it loads the image AGAIN so that I then have two of the same image when I only want one.

Nathan [import]uid: 39302 topic_id: 22967 reply_id: 93575[/import]

Nathan, have you looked at the widget.newButton api? The UI button is very old and rarely used anymore, it’s replaced by the widget button which is very similar in code. And I believe it takes care of the scaling issues nicely without you having to configure anything

http://developer.anscamobile.com/reference/index/widgetnewbutton [import]uid: 14018 topic_id: 22967 reply_id: 93593[/import]