#How to fit background image to the screen
1 messages · Page 1 of 1 (latest)
I followed the instructions in the godot doc about resizing. it says it should be 1280x720 canvas_items with expand mode
"fit" means a lot of different things! Choose one:
- Show full image height
- stretching width
- with black bars
- Show full width
- stretching height
- with black bars
- Maintain aspect
- Surrounded by black bars
idk, which one do you think is good for mobile?
you're going to have to make choices, but basically that's the thing that's breaking for you 🙂
Try them all out, see what you like!
the config issue is on the texturerect, where you have to play with its scaling behaviors
you might try cover aspect/cover width (I forget which it is called)
which assumes your image is bigger than the space it's trying to fill
oh, I'm sorry, I mean center_width
anyway, point is, show the image at native resolution centered, to whatever height it can permit
yeah, it's ai generated so idk how to resize or modify it i am not a designer... i think my main focus is here is to fit width cause it's a landscape game
but the image/shop there must be also fitted/visible thoroughly
makes sense. So smth like
expand_mode = ExpandMode.EXPAND_FIT_WIDTH_PROPORTIONAL
stretch_mode = StretchMode.STRETCH_KEEP_ASPECT_CENTERED
on the texture rect
is for texturerect?
ok, tried a few, that's the version I'd try. But honestly just play with it, see what looks good to you
keep aspect covered looks more pretty though
but the problem is will ui fit/resize itself to window size?
does it do that automatically?
test it -- play game in the editor and use your OS to resize the game window