Request & Question

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
User avatar
akakyouryuu
Regular
Posts: 162
Joined: Fri Nov 30, 2012 10:29 am
Contact:

Request & Question

#1 Post by akakyouryuu »

Now, buttons have five states(insensitive, idle, hover, selected_idle, selected_hover), but don't have the state for during being clicked.
I request the new state for during being clicked. This state is used when press the button and not used when release it.

I read the renpy codes for this purpose and found that buttons already have activity_ state.
For example, ImageButton has "activate_image" argument.

Code: Select all

    def __init__(self,
                 idle_image,
                 hover_image = None,
                 insensitive_image = None,
                 activate_image = None,
                 selected_idle_image = None,
                 selected_hover_image = None,
                 selected_insensitive_image = None,
                 selected_activate_image = None,
                 style='image_button',
                 clicked=None,
                 hovered=None,
                 **properties):
But, it is seemed this argument doesn't work. Why the activate state is unavailable?

User avatar
PyTom
Ren'Py Creator
Posts: 16093
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Request & Question

#2 Post by PyTom »

Activate was removed a while back, since it was kind of silly - it was used after the press, when the button was fading out. I'll look at adding a pressed state, but it's a little complex at this point.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: Request & Question

#3 Post by nyaatrap »

Code: Select all

    if pygame.mouse.get_pressed()[0]==1 and 1050<renpy.get_mouse_pos()[0]<1120 and 530 <renpy.get_mouse_pos()[1]<600: #button area
        timer 0.01 action somehting
        
    timer 0.01 action renpy.restart_interaction
The above is a code I'm using. It's not a smart code especially on timer - restart_interaction thing.
Although it's working, I don't want to use this timer/restart thing code. So I'll support the idea to add button pressing state by default.

Post Reply

Who is online

Users browsing this forum: anonymousException