Can I blit onto an imagemap?

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
docclox
Newbie
Posts: 20
Joined: Thu Oct 12, 2017 6:26 am
Contact:

Can I blit onto an imagemap?

#1 Post by docclox »

Let's start with the "Why" of it: I have a navigation screen. It's basically circles with connectors and a label for each area.

Image

But when you hover you get more detail about the area.

Image

The thing is, the station starts off needing a lot of work to get it fully operational, so most of the systems are going to be offline or absent at the start. So I'd like to have the map update as the repair work progresses. But it isn't feasible to generate a hover image for every possible combination.

It would get a lot more manageable with imagebuttons, but then the buttons need to be precisely placed and I remember reading that imagebuttons can lose alignment when the screen is resized. That's less of a problem if I make the connectors part of the background image rather than in the hotspots I suppose, but even doing all the permutations for individual buttons is a lot of work.

So the question is, can I take a blank red hover map and blit the room descriptions onto the image? Or does imagemap need to take a filename? Or is there a better way to approach the problem?

Any suggestions gratefully received :)

User avatar
Qwxlea
Newbie
Posts: 18
Joined: Sat Jun 10, 2017 3:58 am
IRC Nick: qwxlea
Github: Qwxlea
Contact:

Re: Can I blit onto an imagemap?

#2 Post by Qwxlea »

If you want to use images for everything then I would suggest using imagemagick to create all your different combinations.
A combination of these and a script could automate the creation of your imagemaps.

User avatar
korova
Veteran
Posts: 217
Joined: Sat Jun 27, 2009 5:15 pm
Completed: Ivy, Chocolate, Time, Clair Obscur
Projects: Writing exercises, The House [Nano18]
Tumblr: korova08
itch: korova
Location: Normandie, France
Contact:

Re: Can I blit onto an imagemap?

#3 Post by korova »

What I would do is define the hover images as variables, and when your area is repaired, update the variable, that will update the hover image too.

User avatar
Alex
Lemma-Class Veteran
Posts: 3093
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Can I blit onto an imagemap?

#4 Post by Alex »

You can make a screen and show it over the hotspot. This might be several screens - the one for each hotspot, or you can make one template screen and pass argument to it (like position of this screen, list of text lines etc.).

Code: Select all

screen info_scr(inf_pos, inf_txt):
    vbox:
        pos inf_pos
        for line in inf_txt:
            text line

screen my_map():
    textbutton "!!!" action [[]] hovered Show("info_scr", dissolve, inf_pos=(100,100), inf_txt=loc_1_info) unhovered Hide("info_scr", dissolve) pos (90, 110)
    
label start:
    $ loc_1_info = ["Line 1", "Line 2"]
    "..."
    show screen my_map
    "... ..."
    $ loc_1_info.append("Line 3")
    "?"

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Can I blit onto an imagemap?

#5 Post by Imperf3kt »

Might I suggest you use tooltips?
That way you don't need to worry what possible combination players have unlocked, you just pass a variable on the individual tooltips (repaired, not repaired, etc) based on how a player 'repairs' these stations. Ren'Py will take care of the rest.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
docclox
Newbie
Posts: 20
Joined: Thu Oct 12, 2017 6:26 am
Contact:

Re: Can I blit onto an imagemap?

#6 Post by docclox »

Good ideas! Thank you all.

I wouldn't have thought of ImageMagick, but it would do the job nicely. Is there a pure Python implementation? I'm not sure what I'd have to do to bundle it.

Putting a screen over the hotspot works, but I still need several different images for each area.

Tooltips are an interesting possibility. I've been meaning to dig into how to make them work anyway. A pop-up info panel at the side could do the same thing as well.

Thanks for the ideas. Much appreciated :)

User avatar
ISAWHIM
Veteran
Posts: 318
Joined: Sun Nov 06, 2016 5:34 pm
Contact:

Re: Can I blit onto an imagemap?

#7 Post by ISAWHIM »

Image-button misalignment is marginal.
However, if you use dynamic images, which are tied to the variables, as file-names... It can update as desired, individually, without change to the image-buttons above/below. (Clicks and mouse-moves pass through images displayed over image-buttons. Seems that the area-sense is on the overlay layer, or higher.)

or

Use one whole image as your "we are broken" displays.
Then just SHOW the "fixed" images as they get fixed.
While the image-button is just a blank PNG for idle, and the INFO when hovered-over. (Then you can also click it to do something there, if that is how you want them to get to each area to fix.)

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]