Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
screen size — Gideros Forum

screen size

hunstalixhunstalix Member
edited November 2011 in General questions
I'm started developing games for android devices, but I have an problem. I want to move my sprite around the screen, but without leaving the screen. There are many devices with various resolution, so how can I get the size of any screen? I can't work with only one fixed resolution.

(Sorry for my bad English, I just learning it :D)

Comments

  • atilimatilim Maintainer
    Hi,

    Here you have 2 options:

    1. Gideros have the concept of "automatic screen scaling" to solve this problem. When you right click the project name and select "Properties..." you see options "Scale Mode" and "Logical Dimensions". For example if you determine your logical resolution as "320x480", develop all your code according to this resolution and let Gideros scale your scene according to different hardware resolutions. http://www.giderosmobile.com/documentation/automatic_screen_scaling.html

    Also you can learn your logical and real device resolutions by using these functions:
    application:getLogicalWidth()
    application:getLogicalHeight()
    application:getHardwareWidth()
    application:getHardwareHeight()
    2. You select the scale mode as "No scale - Top Left" to disable automatic scaling and position/scale all your sprites manually. This option is harder to use but sometimes it can be the only option if provided scale modes are not enough.

    Also, if you use scaling, preferably create your Textures and Fonts with filtering to improve rendering quality:
    Texture.new("image.png", true)
    Font.new("font.txt", "font.png", true)
  • Great, thanks for the help!
  • alexzhengalexzheng Guru
    edited November 2011
    hi,
    atilim
    automatic screen scaling is a great future for muti-resolution screens.
    It would be much better if Scale mode can be selected for specific resolution.
    for example, I would like to add more items on the pad than on the phone, without scaling , but perform a scaling between phones
  • atilimatilim Maintainer
    I see. We can support this by an indirect way. (e.g. get the hardware resolution by application:getHardwareWidth(), application:getHardwareHeight() and set scale mode with a function)

    Likes: Yan

    +1 -1 (+1 / -0 )Share on Facebook
  • Hi, i have a little question.....

    how to autoresize ??

    I've configured the logical dimensions in 800x480 (GalaxyS in landspace), and triying the different scale modes the program makes some changes in images.....

    If i "don't touch" nothing ( No scale-Top Left mode ), and i try to get the hardware size.....the game will be run without scaling problems on any device???

    Regards.



    ***Go Gideros!!! Best open source SDK+IDE for mobile devices.
    **my physics based game base code in three days!
    *without LUA knowledges

    Likes: gorkem, atilim

    Regards from Spain.
    Sorry for my English level.
    +1 -1 (+2 / -0 )Share on Facebook
  • application:getHardwareWidth()
    wasn't it
    application:getDeviceWidth() ?

    Just checking
  • atilimatilim Maintainer
    edited February 2012
    ops.. :) yes, the correct one is getDeviceWidth(). Most probably I renamed getHardwareWidth to getDeviceWidth just before releasing that version.
  • atilimatilim Maintainer
    hi @elcanu,

    You can choose No scale-Top Left mode and scale your scene according to getDeviceWidth() and getDeviceHeight(). But it won't be so easy. So I recommend to use one of the predefined scaling modes.
  • atilimatilim Maintainer
    btw, configure your logical dimensions as 480x800 even if you're programming your game in landscape mode.
  • ops.. :) yes, the correct one is getDeviceWidth(). Most probably I renamed getHardwareWidth to getDeviceWidth just before releasing that version.
    And I almost started to think, that I was looking to incorrect docs (again) :))
    btw, configure your logical dimensions as 480x800 even if you're programming your game in landscape mode.
    That explains a lot!!!
  • hi @elcanu,

    You can choose No scale-Top Left mode and scale your scene according to getDeviceWidth() and getDeviceHeight(). But it won't be so easy. So I recommend to use one of the predefined scaling modes.


    2: btw, configure your logical dimensions as 480x800 even if you're programming your game in landscape mode.
    Yes i'm developing for landscape mode.
    And...if i get the device width/height and set the no scale mode.....the app can be outside the screen in small screens??

    And...if i set the scale mode to other predefinied scale mode (Like letterbox) the game will be show correctly?? (I must to develop with bigger images??for example the current background res is 480x800, but in some scale mode shows the image smaller than the "real size")
    Regards from Spain.
    Sorry for my English level.
  • @atlim, can you use both letterbox scaling and application:getContentWidth/Height at the same time? Or will this not work?
  • @Zizanyman it will work but top left coordinate probably will be negative, something like -20,0 for example
  • @ar2sawseen Never mind fixed my problem by getting rid of relative coordinates (application:getContentWidth/Height) and using letterbox scaling from the resolution I was working in instead. Cause my problem was with the resolution in the android player. But its fixed now.
Sign In or Register to comment.