Imagebutton GUI Framework [GxImagebuttons]

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Message
Author
User avatar
leon
Miko-Class Veteran
Posts: 554
Joined: Sun Oct 09, 2011 11:15 pm
Completed: Visual Novel Tycoon, Night at the Hospital, Time Labyrinth, The Buried Moon, Left of Center, Super Otome Quest
Projects: Lemon Project, Porcelain Heart, Dream's Dénouement
Organization: Team ANARKY
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#31 Post by leon » Tue Mar 04, 2014 1:36 pm

Copy paste this to the end of screens.rpy:

Code: Select all

##############################################################################
# Choice
#
# Screen that's used to display in-game menus.
# http://www.renpy.org/doc/html/screen_special.html#choice

screen choice:
    window: 
        style "menu_window"        
        xalign 0.5
        yalign 0.5
        vbox:
            style "menu"
            spacing 2
            for caption, action, chosen in items:
                if action:  
                    button:
                        action action
                        style "menu_choice_button"                        
                        text caption style "menu_choice"
                else:
                    text caption style "menu_caption"

init -2 python:
    config.narrator_menu = True
    style.menu_window.set_parent(style.default)
    style.menu_choice.set_parent(style.button_text)
    style.menu_choice.clear()
    style.menu_choice_button.set_parent(style.button)
    style.menu_choice_button.xminimum = int(config.screen_width * 0.75)
    style.menu_choice_button.xmaximum = int(config.screen_width * 0.75)

User avatar
Xerofit51
Veteran
Posts: 357
Joined: Thu Jan 09, 2014 12:58 am
Completed: Freak-quency, Harvest-Moon spin off
Projects: Freak-quency
Deviantart: xerofit51
Location: Indonesia
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#32 Post by Xerofit51 » Thu Apr 03, 2014 1:22 am

Oddly I can't seem to erase my save with this GUI. Why so?

User avatar
leon
Miko-Class Veteran
Posts: 554
Joined: Sun Oct 09, 2011 11:15 pm
Completed: Visual Novel Tycoon, Night at the Hospital, Time Labyrinth, The Buried Moon, Left of Center, Super Otome Quest
Projects: Lemon Project, Porcelain Heart, Dream's Dénouement
Organization: Team ANARKY
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#33 Post by leon » Thu Apr 03, 2014 7:20 am

Add this at the end of load_save_slot screen:

Code: Select all

key "save_delete" action FileDelete(number)

User avatar
Xerofit51
Veteran
Posts: 357
Joined: Thu Jan 09, 2014 12:58 am
Completed: Freak-quency, Harvest-Moon spin off
Projects: Freak-quency
Deviantart: xerofit51
Location: Indonesia
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#34 Post by Xerofit51 » Thu Apr 03, 2014 8:03 am

leon wrote:Add this at the end of load_save_slot screen:

Code: Select all

key "save_delete" action FileDelete(number)
Thanks for replying so fast but it didn't work

User avatar
leon
Miko-Class Veteran
Posts: 554
Joined: Sun Oct 09, 2011 11:15 pm
Completed: Visual Novel Tycoon, Night at the Hospital, Time Labyrinth, The Buried Moon, Left of Center, Super Otome Quest
Projects: Lemon Project, Porcelain Heart, Dream's Dénouement
Organization: Team ANARKY
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#35 Post by leon » Thu Apr 03, 2014 11:28 am

Actually it does work if you have 3 saves, but not correctly - it always deletes the 3rd save. I really don't know what the issue is. Maybe try asking in Ren'Py Questions and Announcements...

User avatar
dyrarendy
Regular
Posts: 59
Joined: Wed Apr 02, 2014 12:26 pm
Projects: Visual Novel Dating Sims Masa SMA
Location: Indonesia, Cimahi
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#36 Post by dyrarendy » Sat Apr 05, 2014 12:48 am

After saferal times i tried to modifications this code, and i have no idea.
I need help.
Really..

example :

Code: Select all

imagebutton auto "gambar/tb_galeri_%s.png" xpos 80 ypos 340 focus_mask True action ShowMenu('xtra') hovered [ Play ("test_four", "suara/click.wav"), Show("gui_tooltip", my_picture="gambar/tooltip_main_menu_extra.png", my_tt_xpos=500, my_tt_ypos=600) ] unhovered [Hide("gui_tooltip")] at config_eff
   
As We know, the "gui_tooltip" will show up if hovered, and hide if unhovered.

Code: Select all

I really need "gui_tooltip" hide when buttons was "Clicked"
This Irritating me when i try move to different screens.

any idea ?
My Project :
Image

User avatar
leon
Miko-Class Veteran
Posts: 554
Joined: Sun Oct 09, 2011 11:15 pm
Completed: Visual Novel Tycoon, Night at the Hospital, Time Labyrinth, The Buried Moon, Left of Center, Super Otome Quest
Projects: Lemon Project, Porcelain Heart, Dream's Dénouement
Organization: Team ANARKY
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#37 Post by leon » Sat Apr 05, 2014 8:16 am

Add Hide("gui_tooltip") to every action like this:

Code: Select all

imagebutton auto "gambar/tb_galeri_%s.png" xpos 80 ypos 340 focus_mask True action [Hide("gui_tooltip"), ShowMenu('xtra')] hovered [ Play ("test_four", "suara/click.wav"), Show("gui_tooltip", my_picture="gambar/tooltip_main_menu_extra.png", my_tt_xpos=500, my_tt_ypos=600) ] unhovered [Hide("gui_tooltip")] at config_eff

User avatar
dyrarendy
Regular
Posts: 59
Joined: Wed Apr 02, 2014 12:26 pm
Projects: Visual Novel Dating Sims Masa SMA
Location: Indonesia, Cimahi
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#38 Post by dyrarendy » Sat Apr 05, 2014 5:53 pm

Ahh... Finally .. :) thankyou leon.
Its work.
My Project :
Image

User avatar
dyrarendy
Regular
Posts: 59
Joined: Wed Apr 02, 2014 12:26 pm
Projects: Visual Novel Dating Sims Masa SMA
Location: Indonesia, Cimahi
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#39 Post by dyrarendy » Sat Apr 05, 2014 6:04 pm

ah, leon, u know how to "resize" the size of "vscrollbar" at "viewport" ?
mine is kinda too small at 720 HD.

I have no idea about this.
Or, Any way to replace it with imagebuttons ?
My Project :
Image

User avatar
leon
Miko-Class Veteran
Posts: 554
Joined: Sun Oct 09, 2011 11:15 pm
Completed: Visual Novel Tycoon, Night at the Hospital, Time Labyrinth, The Buried Moon, Left of Center, Super Otome Quest
Projects: Lemon Project, Porcelain Heart, Dream's Dénouement
Organization: Team ANARKY
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#40 Post by leon » Sat Apr 05, 2014 7:17 pm

Do you mean vbar? I think setting xsize should set its width.

Code: Select all

vbar value YScrollValue("vp") xsize 50
You may find the section about customizing the bars here useful - http://lemmasoft.renai.us/forums/viewto ... =51&t=9812

User avatar
dyrarendy
Regular
Posts: 59
Joined: Wed Apr 02, 2014 12:26 pm
Projects: Visual Novel Dating Sims Masa SMA
Location: Indonesia, Cimahi
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#41 Post by dyrarendy » Sun Apr 06, 2014 4:36 am

well, the problems is at "vp".

Code: Select all

vbar value YScrollValue("vp") xsize 50
Anyway, what is :

Code: Select all

("vp")
My Project :
Image

User avatar
leon
Miko-Class Veteran
Posts: 554
Joined: Sun Oct 09, 2011 11:15 pm
Completed: Visual Novel Tycoon, Night at the Hospital, Time Labyrinth, The Buried Moon, Left of Center, Super Otome Quest
Projects: Lemon Project, Porcelain Heart, Dream's Dénouement
Organization: Team ANARKY
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#42 Post by leon » Sun Apr 06, 2014 8:17 am


lyminh99
Regular
Posts: 38
Joined: Sat Jun 14, 2014 1:09 pm
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#43 Post by lyminh99 » Tue Jun 17, 2014 5:46 am

I used other resolution is 1920 x 1080. I can't adjust the position for the thumnail file screen shot in the right place cause all the three screen shot move at the same time i adjust the y or x position leave no space between them. pls help me :'(

Edit: Ah, it's ok now, sry :)

DoctorScaglietti
Newbie
Posts: 8
Joined: Tue Dec 31, 2013 10:36 pm
Projects: Heartbleed Wonderland
Location: Right behind you
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#44 Post by DoctorScaglietti » Mon Aug 18, 2014 11:56 pm

Getting a bit of trouble implementing this. Here's what the code looks like:

Code: Select all

screen imagebuttontest:
    add "bg/imagemap/juns_room_day.png"
    imagebutton auto "sprites/full-body/(PH) Jun Full-Body.png" focus_mask True pos(400,500) action Jump("clicky")
Note: "(PH) Jun Full-Body.png" is defined as jun_full, but it seems I get an error if it's not the specific file path. Zoom is also not accepted, which I'd like to know how to get around if possible.

Code: Select all

label imagebuttontest:
    call screen imagebuttontest
    
label clicky:
    show jun at left
    jun "Awesome! It works!"
    
    jump imagebuttontest
Unfortunately, it doesn't work. (Not awesome!) Here's the traceback:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/Dev Testing.rpy", line 38, in script
    call screen imagebuttontest
  File "renpy/common/000statements.rpy", line 426, in execute_call_screen
    store._return = renpy.call_screen(name, *args, **kwargs)
  File "game/imagemaps.rpy", line 104, in <module>
    imagebutton auto "sprites/full-body/(PH) Jun Full-Body.png" focus_mask True pos(400,500) action Jump("clicky")
  File "renpy/common/00defaults.rpy", line 97, in _imagemap_auto_function
    rv = auto_param % variant
TypeError: not all arguments converted during string formatting
Does anyone know what the issue is?

User avatar
leon
Miko-Class Veteran
Posts: 554
Joined: Sun Oct 09, 2011 11:15 pm
Completed: Visual Novel Tycoon, Night at the Hospital, Time Labyrinth, The Buried Moon, Left of Center, Super Otome Quest
Projects: Lemon Project, Porcelain Heart, Dream's Dénouement
Organization: Team ANARKY
Contact:

Re: Imagebutton GUI Framework [GxImagebuttons]

#45 Post by leon » Tue Aug 19, 2014 1:38 am

To use the auto property you need to include %s in the image string and have appropriately named idle and hover images. Check the examples in the script and the documentation on how to use the auto property.

Post Reply

Who is online

Users browsing this forum: No registered users