Over-Ambitious GUI Question (Solved)

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.
Message
Author
philat
Eileen-Class Veteran
Posts: 1912
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Over-Ambitious GUI Question

#16 Post by philat »

namastaii wrote:making alpha false I believe makes it so the buttons are only active when the actual text is being hovered.
No, it does the opposite.



Again, it is HIGHLY LIKELY that the ground image of the imagemap is simply blocking the background image from being seen. There are multiple ways to achieve what OP wants. Off the top of my head:

1. Make the imagemap not fullscreen.
2. Make the ground image completely transparent, with idle/hover images transparent other than the buttons parts.
3. Make the ground image a ConditionSwitch, which is controlled with SetVariable (rather than SetScreenVariable).
4. Use imagebuttons.

camisteja
Regular
Posts: 28
Joined: Thu Jan 14, 2016 4:54 pm
Contact:

Re: Over-Ambitious GUI Question

#17 Post by camisteja »

philat wrote:
No, it does the opposite.



Again, it is HIGHLY LIKELY that the ground image of the imagemap is simply blocking the background image from being seen. There are multiple ways to achieve what OP wants. Off the top of my head:

1. Make the imagemap not fullscreen.
2. Make the ground image completely transparent, with idle/hover images transparent other than the buttons parts.
3. Make the ground image a ConditionSwitch, which is controlled with SetVariable (rather than SetScreenVariable).
4. Use imagebuttons.
Yes, both images are fullscreen backgrounds. I sort of assumed that it wouldn't be difficult to swap one background image for another, but this became way more confusing than I bargained for.

I tried to follow advice #3 but I think I'm doing something wrong with the ConditionSwitch code. I'm going to do some research on how to make imagebuttons and/or use ConditionSwitch then. I'm not savvy at all when it comes to doing anything with imagemaps, as you can see. Thanks for the tips~

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

Re: Over-Ambitious GUI Question

#18 Post by philat »

Two things.

1. Try this. Literally the only thing I changed is the ground image in the imagemap.

Code: Select all

screen main_menu:
    default i = 0

    tag menu
    if i == 0:
        add "blah_ground.png"
    elif i == 1:
        add "blah_bghover.png"
    
    imagemap:
        
        ground Null()
        idle "blah_idle.png"
        hover "blah_hover.png" 
       
        hotspot (0, 40, 378, 176) action Start() hovered SetScreenVariable("i", 1) unhovered SetScreenVariable("i", 0)
        hotspot (0, 136, 378, 176) action ShowMenu('load') hovered SetScreenVariable("i", 1) unhovered SetScreenVariable("i", 0)
        hotspot (0, 235, 378, 176) action ShowMenu("preferences") hovered SetScreenVariable("i", 1) unhovered SetScreenVariable("i", 0)
        hotspot (0, 325, 378, 176) action Quit(confirm=False) hovered SetScreenVariable("i", 1) unhovered SetScreenVariable("i", 0)
2. I can't think of any reason the above wouldn't work, and given what you already have, it would seem to be the simplest solution. But obviously I can't test it, so on the offhand chance that it doesn't work, the below should be a decent place to start for ConditionSwitch. See also http://lemmasoft.renai.us/forums/viewto ... 51&t=19063 (the two separate imagemaps are just to give you an idea of where the hotspot is -- it's a 30, 30 rectangle from the top left corner of a 50, 50 solid square)

Code: Select all

image white = Solid("FFF", xysize=(50,50))
image red = Solid("F00", xysize=(50,50))

default testvar = True
image testcs = ConditionSwitch(
        "testvar", "white",
        "not testvar", "red")

screen test():
    imagemap:
        ground "testcs"
        idle "white"
        hover "red"

        hotspot (0, 0, 30, 30) action Null() hovered SetVariable("testvar", False) unhovered SetVariable("testvar", True)

    imagemap:
        xalign 0.9
        ground "white"
        idle "white"
        hover "red"

        hotspot (0, 0, 30, 30) action Null() hovered SetVariable("testvar", False) unhovered SetVariable("testvar", True)

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Over-Ambitious GUI Question

#19 Post by namastaii »

It's possible because it works on mine. You just want the background to change when you're hovering over the buttons right? And the background to go back to normal when the mouse ins't hovering? If so, if you want you could send the file to me and I'll see if it works on mine lol I don't know why it wouldn't be working.

camisteja
Regular
Posts: 28
Joined: Thu Jan 14, 2016 4:54 pm
Contact:

Re: Over-Ambitious GUI Question (Solved)

#20 Post by camisteja »

I am very sorry for the delayed response! For a while, I tried to research alternate solutions to my problem (as in, I gave up and tried to find an alternative to Renpy) but when that didn't work out very well, I decided to try harder to learn GUIs. In the end, I think I understand imagemaps a LOT better, so I'm going to just mark this forum as closed.

I really appreciate all the help everyone gave! Much thanks~

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Over-Ambitious GUI Question (Solved)

#21 Post by namastaii »

I read over this again and realized I misread Philats posts. He's right. If your imagemap is a full picture, it's going to be slapped on top of everything else, including the background picture, buttons, and anything else. So if you need an imagemap on your picture, you're going to need to make it transparent and empty except for the buttons you are using, etc. Well, I hope everything works out for you. Good luck

Post Reply

Who is online

Users browsing this forum: Li yuanlin, Vamp-sama