[solved]ui to screen language

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
k i r a
Regular
Posts: 34
Joined: Sat Nov 04, 2006 9:39 pm
Contact:

[solved]ui to screen language

#1 Post by k i r a »

hi there,

I want to know how can I add on-screen buttons using screen language.
my current code is:

Code: Select all

    def button_game_menu():

        if show_button_game_menu:

            # to save typing
            ccinc = renpy.curried_call_in_new_context

            ui.hbox(xpos=0.99, ypos=0.98, xanchor='right', yanchor='bottom')
            ui.textbutton("Skip", clicked=toggle_skipping)#skip
            ui.textbutton("Save", clicked=ccinc("_game_menu_save"))#save
            ui.textbutton("Load", clicked=ccinc("_game_menu_load"))#load    
            ui.textbutton("Prefs", clicked=ccinc("_game_menu_preferences"))#prefs
            ui.textbutton("x", clicked= ui.callsinnewcontext("_hide_windows"))#hiding text window
            ui.close()


    config.overlay_functions.append(button_game_menu)
well, I think I know how to make save, load and prefs buttons according to this post:
http://lemmasoft.renai.us/forums/viewto ... f=8&t=8756
but I don't know how to make the window-hiding button, and neither to making them desappearing at once, without hiding one for one.

please help me!!
Last edited by k i r a on Thu Jan 27, 2011 6:39 am, edited 1 time in total.

User avatar
SleepKirby
Veteran
Posts: 255
Joined: Mon Aug 09, 2010 10:02 pm
Projects: Eastern Starlight Romance, Touhou Mecha
Organization: Dai-Sukima Dan
Location: California, USA
Contact:

Re: ui to screen language

#2 Post by SleepKirby »

The window-hiding button can work like this:

Code: Select all

     imagebutton:
         # idle, hover, xpos, ypos, etc.
         action ui.callsinnewcontext("_hide_windows")
Do you want the window-hiding button to hide the buttons, too? If so, I think the easiest way to do this is to put the buttons in the same screen as the text window. The text window is defined in the "say" screen, so if you define your own say screen and put your buttons in there, then your buttons will always show/hide along with the text window.
See backansi's post for the screen structure. Then you can define the properties for each imagebutton like in Sapphi's post.

However, if you have already done some customizations on your text window (for example, using show_side_image), then you might have to do more work on your say screen to port these customizations to screen language.

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: ui to screen language

#3 Post by Aleema »

You can also append the buttons to the window_overlay_functions, instead of just the overlay functions, which will make them only show along with the text box. The cookbook function doesn't show this, but it really should.

Code: Select all

config.window_overlay_functions.append(button_game_menu)
Only problem with that is that they'll show up with menus, too. (I guess assuming you'll practice having a say window up for menus as well, which I do, so not a problem for me.) So editing the Say screen is the best choice here.

k i r a
Regular
Posts: 34
Joined: Sat Nov 04, 2006 9:39 pm
Contact:

Re: ui to screen language

#4 Post by k i r a »

thank you!!
it worked!!

Post Reply

Who is online

Users browsing this forum: No registered users