Screen button hitboxes in inaccurate locations

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
valeatory
Regular
Posts: 36
Joined: Mon Apr 23, 2007 3:01 pm
Projects: Nightglove Institute, Monstrata Fracture
Organization: Astralore Games
Tumblr: valeatory
itch: astralore
Location: America
Contact:

Screen button hitboxes in inaccurate locations

#1 Post by valeatory »

Ever since I updated to 6.99.11, I've been having trouble with my custom screens. I initially thought they were disabled, but they are actually just showing up with the hitbox completely to the left of the text - since the buttons are aligned with the left edge, that means they are only accessible by clicking the window frame, or expanding the window to an aspect ratio that adds black bars to the sides. I asked around in IRC, but it seems the answer is still unknown - I'd really appreciate any insight anyone can provide.

Here is the code for the screen - I've also attached a zip that shows the problem in action immediately. (At least on my machine!)

Code: Select all

screen electives_sc:
    vbox:
        ypos .2
        for pretty_name, keyword in elective_options:
            button:
                action Return(keyword)
                xsize .5

                hbox:
                    text _(pretty_name) style "button_text"
        if (weekday, time_block) in special_electives:
            $ pretty_name, keyword = special_electives[(weekday, time_block)]
            button:
                action Return(keyword)
                xsize .5

                hbox:
                    text _(weekday+": "+pretty_name) style "button_text"

        #a gap between the buttons
        null height 20

        if free:
            textbutton _("Don't study"):
                xsize .5
                action Return("free")
        else:
            textbutton _("Cut class"):
                xsize .5
                action Return("cut")
Attachments
Screen Test.zip
(1.37 MiB) Downloaded 36 times
Nightglove Institute - Kidnapped students, forced to train to be secret agents and assassins!
Monstrata Fracture - Date cute monsters! But will you risk destabilizing the human plane of existence?

User avatar
papiersam
Veteran
Posts: 231
Joined: Fri Aug 12, 2016 2:24 pm
Completed: Gem Hunt Beta, 1/Probably, Animunch
Projects: The Panda Who Dreamed
Contact:

Re: Screen button hitboxes in inaccurate locations

#2 Post by papiersam »

From what I can tell, it's the xsize .5 that's causing the problem: it reduces the button area immensely. Removing it should fix things.

Edit: to visualise the problem, temporarily add

Code: Select all

background "#fff"
to each button. It will show you a white background box the size of the button's interactive area.

User avatar
valeatory
Regular
Posts: 36
Joined: Mon Apr 23, 2007 3:01 pm
Projects: Nightglove Institute, Monstrata Fracture
Organization: Astralore Games
Tumblr: valeatory
itch: astralore
Location: America
Contact:

Re: Screen button hitboxes in inaccurate locations

#3 Post by valeatory »

It works! Before, I think `xsize .5` reduced the background to half of a default menu option, but now it seems like they are dynamically sized by default, and xsize might only be in pixels? `xsize 500` makes the backgrounds the same width.

Thank you for your help!
Nightglove Institute - Kidnapped students, forced to train to be secret agents and assassins!
Monstrata Fracture - Date cute monsters! But will you risk destabilizing the human plane of existence?

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]