127
« on: July 13, 2015, 07:46:27 pm »
Hi,
I'm trying to write some code to position on-screen controls in a mobile game. I need to know the actual resolution of the screen, so I can figure out which portion of my game is actually displayed (because I don't want to put game controls off-screen.)
My game's scale mode is set to Scale to Fit (letterbox) and I made the game's resolution wide enough so that instead of getting black bars on the sides of my display, the edges are actually clipped. This works very well for me, since I make sure that the action is limited to the areas of the screen that are likely to be displayed on any device.
The problem is that I want the game controls (a D-pad and a couple of buttons) to be near the edges of the physical screen.
getScreenWidth() returns the game's resolution as set in the Game Settings->Settings->Display. This is of no use to me, obviously. I took a quick look at Engine.hx, but nothing jumped at me. How do I get any useful information about the device's screen dimensions?
Thanks!
Ori