How do I get the size of different screen ?

  • hi,

    i need to ajust an image to the width and height of the visible screen ... so how do i get this ?

    thank you

  • up bump

  • 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.

  • 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

  • You can get the current screen size with WindowHeight and WindowWidth. I don't know if this works on mobil.

  • i just try it and it not work ... any suggestion ?

  • This should work to stretch the sprite to fullscreen:

    set width = viewportright(0)-viewportleft(0)

    set height = viewportbottom(0)-viewporttop(0)

  • ok now how to centrate that image ? centrate it inthe scre

  • 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..

  • 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

  • Unfortunately your capx uses a third party plugin i-frame which I don't have, so I can't open it..

  • Unfortunately your capx uses a third party plugin i-frame which I don't have, so I can't open it..

    https://www.dropbox.com/s/u8sht4xg07t7b ... e.zip?dl=0

  • > Unfortunately your capx uses a third party plugin i-frame which I don't have, so I can't open it..

    >

    https://www.dropbox.com/s/u8sht4xg07t7b ... e.zip?dl=0

    Thanks, but I'm not going to download and install something I will never use just to answer your question..

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi,

    i have exactly ... the same problem on ios

    related post

    i was thinking about set the size of the iframe to the avalaible screen and set x to centrate ... but fail

    Why do you ask a question about setting the height and width of an image when you mean using iFrame and specifically iFrame on iOS?

    You must understand that asking the wrong question will not give you the right answer..

    (When you ask how to make chocolate milk, nobody in their right mind will think of telling you how to make strawberry-icecream)

  • > Hi,

    > i have exactly ... the same problem on ios

    > related post

    > i was thinking about set the size of the iframe to the avalaible screen and set x to centrate ... but fail

    >

    Why do you ask a question about setting the height and width of an image when you mean using iFrame and specifically iFrame on iOS?

    You must understand that asking the wrong question will not give you the right answer..

    (When you ask how to make chocolate milk, nobody in their right mind will think of telling you how to make strawberry-icecream)

    you get reason

    but i was thinking that setting size of an image is same like other set size action of different object ... that's why

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)