Hi,
I want to make my main menu look like [see attachment].
i figured i can change the font and text size in gui.rpy (e.g. define gui.interface_text_size) but i dont want ALL gui text to be huge, only the main menu. further more i would like to change the text alignment only in the main menu to centered.
Any idea how to do that?
change text size/alignment in menu but not otherwise in UI
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.
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.
Re: change text size/alignment in menu but not otherwise in
ok, figured out i can change the main menu in screens.rpy, like:
but i still can't seem to change the text alignment to centered - it does not accept the text_align keyword...
Code: Select all
screen navigation():
vbox:
style_prefix "navigation"
xalign 0.5
yalign 0.5
spacing 100
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3794
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: change text size/alignment in menu but not otherwise in
I'd suggest using imagebuttons to be perfectly honest.
However, you can still do this with textbuttons, it just requires a touch more code.
Personally, I don't use textbuttons, so I may have this slightly incorrect.
Then in gui.rpy, press CTRL+F to find
Edit these lines to
Or whatever size you want it to be.
You'll need to set a font as well and also remember to include that font in the base directory... Or was it the game directory? The documentation should be able to tell you.
However, you can still do this with textbuttons, it just requires a touch more code.
Personally, I don't use textbuttons, so I may have this slightly incorrect.
Code: Select all
screen main_menu():
tag menu
style_prefix "main_menu"
vbox:
xalign 0.5
yalign 0.5
spacing 100
textbutton _("NEW GAME")
textbutton _("LOAD")
style main_menu_textbutton is gui.main_menu_text
Code: Select all
## The position of the main menu text.
define gui.main_menu_text_xalign = 0
Code: Select all
## The size of the main menu text.
define gui.main_menu_textbutton_size = 100
You'll need to set a font as well and also remember to include that font in the base directory... Or was it the game directory? The documentation should be able to tell you.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3794
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: change text size/alignment in menu but not otherwise in
I'd like to clarify an error I made in my previous post.
Should be
I made this in about ten minutes. It should work well with all HD resolutions. (It'll probably work with any resolution to be honest, but you should consider editing the xmaximum.)
First, edit options.rpy to this:
Then replace everything you see in the main menu screen, with this code.
The result is as follows (with an image I added)
Code: Select all
## The size of the main menu text.
define gui.main_menu_textbutton_size = 100
Code: Select all
## The size of the main menu text.
define gui.main_menu_button_text:
size 100
First, edit options.rpy to this:
Code: Select all
## Basics ######################################################################
## A human-readable name of the game. This is used to set the default window
## title, and shows up in the interface and error reports.
##
## The _() surrounding the string marks it as eligible for translation.
define config.name = _("your game name here")
## The version of the game.
define config.version = "1.0"
Code: Select all
screen main_menu():
## This ensures that any other menu screen is replaced.
tag menu
style_prefix "main_menu"
#The following can be changed on line 88 of gui.rpy or by editing/overwriting the image at gui/main_menu.jpg
add gui.main_menu_background
## The use statement includes another screen inside this one. The actual
## contents of the main menu are in the navigation screen.
vbox:
#make a grid 1 wide, 2 high
grid 1 2:
#make sure the buttons don't overlap
spacing 30
textbutton _("New Game") action Start()
textbutton _("Load") action ShowMenu("load")
style main_menu_vbox is vbox
style main_menu_button_text:
size 90
style main_menu_vbox:
#align the buttons in the center of the screen
xalign 0.5
#restrict the buttons to a space 960 pixels wide
xmaximum 960
#align the buttons 80% toward the bottom of the screen
yalign 0.8
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Who is online
Users browsing this forum: Bing [Bot]