Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
Why aren't my suffixes working? - Page 2 - Gideros Forum

Why aren't my suffixes working?

2»

Comments

  • rpallenrpallen Member
    edited November 2017
    I thought I had the suffix thing figured out, but I was wrong.
    It appears that for some reason the program is choosing the correct file for the suffixes (that is, for a given ratio, it uses the image with the suffix for that ratio) but it then scales the image up to a larger size. I thought it would just use the image without scaling it. I thought that was the whole purpose of using suffixes.

    So here's the story. I made a new project as below:
    logical dimensions: 320x480
    orientation: landscape left
    scales: @big=3.17, @medium=2, @small=1
    images (note: the images are al made from the same base file with the sizes changed. To tell the difference between them, each size was overlaid with a semi-transparent layer of a different color as indicated after the size.):
    background@big.jpg = 2048x1677 white
    background@big.jpg = 1621x1268 red
    background@medium.jpg = 1022x800 green
    background@small.jpg = 511x400 blue

    code in main.lua:
    local texture = Texture.new("images/background.jpg")
    local image = Bitmap.new(texture)
    image:setPosition(0, 0)
    stage:addChild(image)

    When I run this code using Gideros Player in different size configurations, it chooses the correct image, but it scales the image up-significantly.

    In the code I changed the line local texture = Texture.new("images/background.jpg") to hard code the image to the small version. i.e
    local texture = Texture.new("images/background@small.jpg").
    I then ran it with the Player configured at 320x480 This resulted in showing the image withOUT scaling. Please see the attached screenshots. The screenshot background is the one from the code with background.jpg. The screenshot background@small is the one from the code with background@small.jpg.

    The screenshot background@small is the result I want. How do I get that?
    background@small.PNG
    664 x 471 - 182K
    background.PNG
    664 x 471 - 26K
  • olegoleg Member
    edited November 2017
    @rpallen Play with scaling modes

    Likes: antix

    11.JPG
    496 x 245 - 30K
    11.JPG 30.5K
    my games:
    https://play.google.com/store/apps/developer?id=razorback456
    мій блог по гідерос https://simartinfo.blogspot.com
    Слава Україні!
    +1 -1 (+1 / -0 ) Share on Facebook
  • rpallenrpallen Member
    edited November 2017
    I forgot to include that in my post. I was using scale mode: letterbox.
  • OK, I think I FINALLY got this right.
    I had added a suffix, @small-ratio:1, to be the suffix used if the screen size was the same as the logical dimensions. Apparently, this messes things up. When I removed this suffix and set the Gideros Player to 320x480 (same as the logical dimensions), it displayed the base image WITHOUT scaling. YIPEE!

    And when I changed the Player size to other sizes, I appropriately got the @medium and @big images. DOUBLE YIPEE!

    What I learned: Gideros apparently assumes the base image is for ratio = 1, as well as if it can't find an image (for example, there is a suffix @xlarge, but there is no file image@xlarge.png).

    Likes: antix, totebo

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