WindowWidth (and Height) not Correct on Mobile?

Discussion and feedback on Construct 2

Post » Fri Aug 15, 2014 7:09 pm

Is there any known issue to getting the windowwidth or height on mobile?

I'm trying to set a tiled background to windowwidth * 0.9 / windowheight * 0.9 and it always is larger than the screen.

If I tell it to be a specific size it seems to be fine. :/

Any ideas?
Follow me on Twitter @evgLabs
B
34
S
14
G
4
Posts: 251
Reputation: 4,074

Post » Fri Aug 15, 2014 8:56 pm

I'm guessing phone you're testing it on doesn't have the same resolution as the native resolution of the game you made.
Anyway, use ViewportRight(layer) as your "width" and ViewportBottom(layer) as your "height".
B
33
S
12
G
7
Posts: 227
Reputation: 7,582

Post » Fri Aug 15, 2014 9:07 pm

width = ViewportRight(layer) - ViewportLeft(layer)
height = ViewportBottom(layer) - ViewportTop(layer)

You can't rely on top and left being 0, in all configurations.
ImageImageImage
B
71
S
21
G
231
Posts: 3,688
Reputation: 129,352

Post » Fri Aug 15, 2014 11:40 pm

I forgot to mention that I've already tried those. Thanks though.

More Info:

My project scale mode is crop.

On desktop the tiledBG sizes fine, on my nexus and bionic (mobile chrome, firefox, opera) it does not.
Follow me on Twitter @evgLabs
B
34
S
14
G
4
Posts: 251
Reputation: 4,074


Return to Construct 2 General

Who is online

Users browsing this forum: Centra, Yahoo [Bot] and 4 guests

cron