Positioning the Quick Menu to be relative to top of textbox?

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.
Post Reply
Message
Author
User avatar
Laniessa
Veteran
Posts: 251
Joined: Wed Feb 09, 2011 11:10 am
Completed: CDC, Cerulean, WBW, Helena's Flowers
Projects: Chomp Chomp, WaV
Tumblr: adirosa
Deviantart: adirosa
Contact:

Positioning the Quick Menu to be relative to top of textbox?

#1 Post by Laniessa »

Hello! I'm trying to make it so that the quick menu would move with the textbox, since the textbox changes size depending on how much text is on the screen.

Image

This is how it normally looks, and everything works fine.

Image

When the textbox is larger than usual though, the Quick Menu is still fixed to the original position, but I want it to be a certain amount of pixels below the top of the textbox. How would I go about achieving this?

The quick menu in screens.rpy:

Code: Select all

# Quick Menu
#
# A screen that's included by the default say screen, and adds quick access to
# several useful functions.
screen quick_menu():

    # Add an in-game quick menu.
    hbox:
        style_group "quick"

        xpos 588
        ypos 555

        textbutton _("save") action ShowMenu('save')
        textbutton _("load") action ShowMenu('load')
        textbutton _("auto") action Preference("auto-forward", "toggle")
        textbutton _("skip") action Skip()
        textbutton _("settings") action ShowMenu('preferences')
        textbutton _("menu") action MainMenu ()
        textbutton _("exit") action Quit ()

init -2:
    style quick_button:
        is default
        background None
        xpadding 5

    style quick_button_text:
        is default
        font "fonts/AlegreyaSans-Regular.otf"
        size 22
        idle_color "#0d775c"
        hover_color "#518678"
        selected_idle_color "#11b78d"
        selected_hover_color "#ffffff"
        insensitive_color "#2e5249"
The part in options.rpy that has info on the textbox:

Code: Select all

# Quick Menu
#
# A screen that's included by the default say screen, and adds quick access to
# several useful functions.
screen quick_menu():

    # Add an in-game quick menu.
    hbox:
        style_group "quick"

        xpos 588
        ypos 555

        textbutton _("save") action ShowMenu('save')
        textbutton _("load") action ShowMenu('load')
        textbutton _("auto") action Preference("auto-forward", "toggle")
        textbutton _("skip") action Skip()
        textbutton _("settings") action ShowMenu('preferences')
        textbutton _("menu") action MainMenu ()
        textbutton _("exit") action Quit ()

init -2:
    style quick_button:
        is default
        background None
        xpadding 5

    style quick_button_text:
        is default
        font "fonts/AlegreyaSans-Regular.otf"
        size 22
        idle_color "#0d775c"
        hover_color "#518678"
        selected_idle_color "#11b78d"
        selected_hover_color "#ffffff"
        insensitive_color "#2e5249"
Thanks!

User avatar
Evildumdum
Regular
Posts: 191
Joined: Sun Jan 18, 2015 8:49 am
Projects: ApoclypseZ
Contact:

Re: Positioning the Quick Menu to be relative to top of text

#2 Post by Evildumdum »

I would suggest making the xpos and ypos a variable and using the same variable to position the quickmenu and the textbox.
"If at first you don't succeed, try hitting it with a shoe."

philat
Eileen-Class Veteran
Posts: 1912
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Positioning the Quick Menu to be relative to top of text

#3 Post by philat »

Move use quick_menu in the say screen into the vbox (whichever variant you're using).

Use position properties to position the quick_menu relative to its "normal" position (which will be right above the textbox).

Set the vbox's order_reverse to True (http://www.renpy.org/doc/html/style_pro ... properties ) so the quick_menu will be on top of the textbox, unless there's a burning reason that can't be done.

Post Reply

Who is online

Users browsing this forum: No registered users