Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
-
Hoomst
- Newbie
- Posts: 10
- Joined: Wed Jun 08, 2022 9:46 am
-
Contact:
#1
Post
by Hoomst » Sun Sep 25, 2022 5:40 pm
I have a small image on which I'd like to display a centered text.
I figured using a frame with the image as the background would be an easy way to do that
While I can use xpos and ypos to adjust the position of the text, xalign and yalign don't seem to do anything.
What's the best way to have an image with a centered text on top?
Code: Select all
screen hud:
frame:
xpadding 0 ypadding 0
if days == 1:
background "GameUI/HUD/day_counter_1.png"
else:
background "GameUI/HUD/day_counter_2.png"
text "Day [days]":
xalign 0.5 yalign 0.5
style "qsb26"
Last edited by
Hoomst on Wed Sep 28, 2022 6:28 am, edited 1 time in total.
-
Ocelot
- Eileen-Class Veteran
- Posts: 1882
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
-
Contact:
#2
Post
by Ocelot » Sun Sep 25, 2022 6:03 pm
Set frame size explicitely. By default frame will be just as large as largest child, in your case it would be as large, as contained text. Text is not moved, because there is no place for it to move.
< < insert Rick Cook quote here > >
-
laure44
- Regular
- Posts: 60
- Joined: Mon Mar 08, 2021 10:55 pm
- Projects: Arkan'sTower, Gemshine Lorelei!
- Location: France
-
Contact:
#3
Post
by laure44 » Sun Sep 25, 2022 6:10 pm
You can also use fixed.
Code: Select all
fixed fit_first True:
add "an image"
text "a text"
Users browsing this forum: Bing [Bot], Google [Bot], Majestic-12 [Bot]