How do I get the size of different screen ?

Get help using Construct 2

Post » Fri Jan 29, 2016 9:56 pm

hi,
i need to ajust an image to the width and height of the visible screen ... so how do i get this ?
thank you
B
38
S
11
G
4
Posts: 712
Reputation: 5,471

Post » Sat Jan 30, 2016 3:48 pm

up bump
B
38
S
11
G
4
Posts: 712
Reputation: 5,471

Post » Sat Jan 30, 2016 4:11 pm

Probably I don't understand this question correct, but isn't the screen size the 'Window size' in the project settings?
That don't change, whatever resolution the screen that displays it has. So you have to adjust your image only once, only the aspect ration could change.
B
23
S
3
G
1
Posts: 411
Reputation: 2,060

Post » Sat Jan 30, 2016 4:59 pm

i just want to ajust my image (height , width) to the height, width of the visible screen
for example for the iphone 5 the visible screen is 640X1136 ... for iphone 4 is 640x960
i need a way to get these value from the device when the app is lunched
B
38
S
11
G
4
Posts: 712
Reputation: 5,471

Post » Sat Jan 30, 2016 5:23 pm

You can get the current screen size with WindowHeight and WindowWidth. I don't know if this works on mobil.
B
23
S
3
G
1
Posts: 411
Reputation: 2,060

Post » Sun Feb 14, 2016 11:00 pm

i just try it and it not work ... any suggestion ?
B
38
S
11
G
4
Posts: 712
Reputation: 5,471

Post » Sun Feb 14, 2016 11:06 pm

This should work to stretch the sprite to fullscreen:

set width = viewportright(0)-viewportleft(0)
set height = viewportbottom(0)-viewporttop(0)
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Feb 14, 2016 11:19 pm

ok now how to centrate that image ? centrate it inthe scre
B
38
S
11
G
4
Posts: 712
Reputation: 5,471

Post » Mon Feb 15, 2016 1:11 am

using the same values..

set it's x position to viewportleft(0)+0.5*(viewportright(0)-viewportleft(0))

You should be able to figure out the y-position yourself now..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Feb 15, 2016 7:46 pm

LittleStain wrote:using the same values..

set it's x position to viewportleft(0)+0.5*(viewportright(0)-viewportleft(0))

You should be able to figure out the y-position yourself now..


Hi, thanks for your help .... but it seem not working properly
check the example https://www.dropbox.com/s/79hrbdduhqjg2 ... .capx?dl=0
B
38
S
11
G
4
Posts: 712
Reputation: 5,471

Next

Return to How do I....?

Who is online

Users browsing this forum: Asmodean, jobel, oddreal, oosyrag, Romalex360 and 11 guests