In the old GUI, I was finding it easy as, but the new GUI is very confusing to me, and I'm finding it takes far more time trying to figure out how to use GUI functions, than actually spending time working on more important stuff.
I have created a music room and I'd like to customise it to use the navigation on the left, as it does: And I'd like to add a different background to the right side. Maybe a radio or something, haven't got that far.
Code: Select all
init python:
mr = MusicRoom(channel='music', fadeout=1.0, fadein=0.0, loop=True, single_track=True, shuffle=False, stop_action=None)
mr.add("music/ui/Anguish.mp3", always_unlocked=True)
mr.add("music/Dark Times.mp3", always_unlocked=True)
screen music_room:
tag menu
use game_menu(_("Music Room"), scroll="viewport"):
textbutton "Anguish" action mr.Play("music/ui/Anguish.mp3")
textbutton "Dark Times" action mr.Play("music/Dark Times.mp3")
null height 20
textbutton "Next" action mr.Next()
textbutton "Previous" action mr.Previous()
textbutton "Pause" action PauseAudio("music", value="toggle") ## Causes major lag if inside a frame
Code: Select all
screen music_menu(title, scroll=None):
# Add the backgrounds.
if main_menu:
add gui.main_menu_background
else:
add gui.music_menu_background
style_prefix "music_menu"
frame:
style "music_menu_outer_frame"
hbox:
# Reserve space for the navigation section.
frame:
style "music_menu_navigation_frame"
frame:
style "music_menu_content_frame"
if scroll == "viewport":
viewport:
scrollbars "vertical"
mousewheel True
draggable True
side_yfill True
vbox:
transclude
elif scroll == "vpgrid":
vpgrid:
cols 1
yinitial 1.0
scrollbars "vertical"
mousewheel True
draggable True
side_yfill True
transclude
else:
transclude
use navigation
textbutton _("Return"):
style "return_button"
action Return()
style music_menu_outer_frame is empty
style music_menu_navigation_frame is empty
style music_menu_content_frame is empty
style music_menu_viewport is gui_viewport
style music_menu_side is gui_side
style music_menu_scrollbar is gui_vscrollbar
style music_menu_label is gui_label
style music_menu_label_text is gui_label_text
style return_button is navigation_button
style return_button_text is navigation_button_text
style music_menu_outer_frame:
bottom_padding 30
top_padding 120
background "gui/overlay/game_menu.png"
style music_menu_navigation_frame:
xsize 280
yfill True
style music_menu_content_frame:
left_margin 40
right_margin 20
top_margin 10
style music_menu_viewport:
xsize 920
style music_menu_vscrollbar:
unscrollable gui.unscrollable
style music_menu_side:
spacing 10
style music_menu_label:
xpos 50
ysize 120
style music_menu_label_text:
size gui.title_text_size
color gui.accent_color
yalign 0.5
style return_button:
xpos gui.navigation_xpos
yalign 1.0
yoffset -30
init python:
mr = MusicRoom(channel='music', fadeout=1.0, fadein=0.0, loop=True, single_track=True, shuffle=False, stop_action=None)
mr.add("music/ui/Anguish.mp3", always_unlocked=True)
mr.add("music/Dark Times.mp3", always_unlocked=True)
screen music_room:
tag menu
use music_menu(_("Music Room"), scroll="viewport"):
textbutton "Anguish" action mr.Play("music/ui/Anguish.mp3")
textbutton "Dark Times" action mr.Play("music/Dark Times.mp3")
null height 20
textbutton "Next" action mr.Next()
textbutton "Previous" action mr.Previous()
textbutton "Pause" action PauseAudio("music", value="toggle") ## Causes major lag if inside a frame
Well that explains a lot that I didn't already figure out.Game and Main Menu Background Images
The images used by the GUI can be found in the game/gui directory, which can be opened by choosing "Open Directory: gui" from the launcher. The relevant files are:
gui/main_menu.png
A file that contains an image that is used in the background of all screens of the main menu.
gui/game_menu.png
A file that contains an image that is used in the background of all screens of the game menu.
Overlay Images
There are also a pair of overlay images. These are used to darken or lighten the background image to make buttons and other user interface components more readable. These images are in the overlay directory:
gui/overlay/main_menu.png
The overlay used by the main menu screen.
gui/overlay/game_menu.png
The overlay used by game-menu-like screens, including load, save, preferences, about, help, etc. This overlay is selected by the screen in question, and is used even when at the main menu.
gui/overlay/confirm.png
The overlay used in the confirm screen to darken the background.
Okay... And how exactly does one learn how to do this?Total GUI Replacement
Advanced creators can replace some or all of screens.rpy in its entirely. When doing so, some or all of the code in gui.rpy may become redundant. It's probably a good idea to call gui.init() to reset styles - but after that, a creator can do whatever they want. It usually makes sense to include some or all of the special screens, to make sure players can have access to all the functionality Ren'Py provides.
file:///C:/Program%20Files%20(x86)/renpy/renpy-6.99.11-sdk/doc/screen_special.html#screen-special
Oh, nice, no wait, this is for the old GUI. I already know how to do this. It doesn't work with the new GUI.
Any help? I'm pulling my hair out over something that seems like it should be very basic.
All I want is to learn how to make a game menu screen (in the new GUI), that doesn't use the main menu image, but instead - it's own. I can't wrap my head around it.
I figured it out in the old GUI and was having a blast animating things, defining functions, etc. But the new GUI is just a headache.
E: I found a cheap and dirty solution.
Code: Select all
use navigation
add "gui/mr.png"
It's not what I wanted, but at least it works.