Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Screen and background — Gideros Forum

Screen and background

tytadastytadas Member
edited August 2016 in General questions
Hello everyone!

I have just started Gideros and have few different questions. Before Lua language I was using Android studio and Eclipse, while Lua gave me some different feelings about writting the codes.. It's hard a bit with Lua, but I will make it on!

My first non sense question will be, what's the purpose of supporting different screen sizes? Need some special code for that or it will change eventually?

Another not smart question that I am having in my head is, What is the background secret to make look good on every phone? And maybe anyone knows which program is the best to create backgrounds and etc.? Now, I am using Piskel, which is pretty good.

Thank you!

Comments

  • simwhisimwhi Member
    edited August 2016 Accepted Answer
    Hi @tytadas. Welcome to the wonderful world of Gideros. You have truly made a great decision.

    Lua is a simple but very powerful language to learn. Keep going and you'll get there!!

    Smartphones and tablet screen sizes very dramatically. Your app will need to this into account.

    Gideros can handle graphical assets at various resolutions using @1.5 and @2 filename extensions.

    You can also use texture atlases to pack images into one larger image file.

    My suggestion would be to start a small project, or take a close look at the example projects that come with Gideros.
  • Thank you! I am a bit confused about graphical assets, but I will make it out!
  • simwhisimwhi Member
    Accepted Answer
    @tytadas As an example. If you create an image at 64x64 pixels then you can also create the same image at 96x96 and 128x128 pixels, too.

    Gideros can automatically use the correct image for a specific screen resolution.

  • n1cken1cke Maintainer
    edited August 2016 Accepted Answer
    > My first non sense question will be, what's the purpose of supporting different screen sizes? Need some special code for that or it will change eventually?
    You need to handle special resize event so you can change positions and sizes of your objects based on width and height of device screen.
    stage:addEventListener(Event.APPLICATION_RESIZE, function()
        local w,h = application:getDeviceWidth(), application:getDeviceHeight()
        -- your code to reposition/rescale sprites here
    end)
    You can find more about events at documentation: Main API -> EventDispatcher.
    Gideros also supports various scale modes but only for the stage:
    application:setScaleMode(mode)
    Look at documentation for modes: Main API -> Application:setScaleMode
    I am also currently working on Layout library which has ability (among many others) to relatively position elements and set scale mode for each element.
  • SinisterSoftSinisterSoft Maintainer
    Accepted Answer
    If you don't want to care and aspect ratio isn't a problem then set the mode to stretch and all will be ok.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • tytadastytadas Member
    edited August 2016
    @simwhi but what about the image files? You mean i should create 3 different pictures, and add as exsiting file to my project? Or its just a code for scaling the picture?
  • You add a @2 or @3, or @0.5 to the other images names (not the 'base' image) then add the way it works (the multiplier, eg, x2, x3, x0.5) in the project properties.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • simwhisimwhi Member
    edited August 2016 Accepted Answer
    @simwhi but what about the image files? You mean i should create 3 different pictures, and add as exsiting file to my project? Or its just a code for scaling the picture?
    @tytadas. Yes, that's right. Create the largest image first (@3 for example) and then scale each image accordingly for @2, @1.5. The smallest (base image) does not need the @ extension.
  • totebototebo Member
    edited August 2016 Accepted Answer
    If you're on Mac I can recommend Sketch, which supports @2, @3 etc when exporting images. So you can have a high res image, and on export it would automatically export all other resolutions automatically with one click.

    https://www.sketchapp.com/

    Then use scaleMode "pixelPerfect" and these properties to align objects on the stage:
    local left_x = application:getLogicalTranslateX()
    local top_y = application:getLogicalTranslateY()
    This will give crisp and clean bitmaps on all devices and resolutions.

    Also: @tytadas welcome! Gideros is a great tool, as I'm sure you've already gathered.

    Likes: simwhi

    My Gideros games: www.totebo.com
    +1 -1 (+1 / -0 )Share on Facebook
  • simwhisimwhi Member
    Accepted Answer
    @tytadas You can also pack your images into a single image file using texture packer. The Pro version can also resize you images for you. If you prefer open source then I would suggest GIMP. There's a plugin available that can also resize you images and save them using the correct filename extensions.
  • tytadastytadas Member
    edited August 2016
    Thank you guys! I love this helpful community!

    Likes: antix

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.