Page 1 of 1

[Solved] Game background scaling smaller background images(without cutting them off)

Posted: Mon Jun 03, 2019 5:34 pm
by waterflaem
So maybe I'm just blind but I can't find anything on scaling the background images set through "scene bg ...". As I expected I didn't find any screens or styles linking to it. After not finding anything in scripts I tried the following

Code: Select all

    image bg test = Image("bg/bg bg10.png", xfill=True)
    scene bg test

    image bg test = Image("bg/bg bg10.png", xsize=1066)
    scene bg test

    #cuts off parts
    scene bg bg10:
          zoom 2.0 (1.2-2.0 tested)

    #causes error
    scene bg bg10:
          xfill True

    #causes error
    scene bg bgimg3:
          xsize 1066
Is there some way to stretch the width? Preferably without having to write it out every command. Any help would be appreciated :)

My background images are 800 by 600 while the renpy window is 1066 by 600(smallest recommended size). For reasons I'd rather not get into, I don't don't want to post-process them. One platform that doesn't support renpy, I wrote a simple interpreter engine thing and I just scale the image up to I think it was 1.2 on the fly. (one of the reasons I don't want to change image sizes, is because it'll be on different platforms at different sizes).

Re: Game background scaling smaller background images(without cutting them off)

Posted: Tue Jun 04, 2019 12:05 am
by Per K Grok
waterflaem wrote:
Mon Jun 03, 2019 5:34 pm
So maybe I'm just blind but I can't find anything on scaling the background images set through "scene bg ...". As I expected I didn't find any screens or styles linking to it. After not finding anything in scripts I tried the following

Code: Select all

    image bg test = Image("bg/bg bg10.png", xfill=True)
    scene bg test

    image bg test = Image("bg/bg bg10.png", xsize=1066)
    scene bg test

    #cuts off parts
    scene bg bg10:
          zoom 2.0 (1.2-2.0 tested)

    #causes error
    scene bg bg10:
          xfill True

    #causes error
    scene bg bgimg3:
          xsize 1066
Is there some way to stretch the width? Preferably without having to write it out every command. Any help would be appreciated :)

My background images are 800 by 600 while the renpy window is 1066 by 600(smallest recommended size). For reasons I'd rather not get into, I don't don't want to post-process them. One platform that doesn't support renpy, I wrote a simple interpreter engine thing and I just scale the image up to I think it was 1.2 on the fly. (one of the reasons I don't want to change image sizes, is because it'll be on different platforms at different sizes).

You can have different amounts of resizing in the x and y direction using xzoom and yzoom.

Re: Game background scaling smaller background images(without cutting them off)

Posted: Tue Jun 04, 2019 7:54 am
by waterflaem
That did it! Thank you Peter! :)

Re: Game background scaling smaller background images(without cutting them off)

Posted: Tue Jun 04, 2019 8:44 am
by Remix
I think you'd want 1.3325 scale factor to get from 800 to 1066

A consideration would be a displayable prefix, for example:

Code: Select all

init -10 python:

    def scale_background(s):
        return Transform(s, xzoom=1.3325)

    config.displayable_prefix["scale"] = scale_background

    # you could change scale to anything, like just 's' to use shorter 's:img' syntax

image bg one = "images/hex2.png"

# we *could* add the scale here during definition
image bg two = "scale:images/hex2.png"


label start:

    scene bg two # already scaled during definition

    scene expression "scale:bg one"
    # using 'expression' and the scale: syntax inline
!! Realistically though, the best advice is just to set your game resolution to 800x600 !! (ignore anyone who says 1066x600 should be minimum)