Hi everyone,
I'm working on a life simulator game that requires the player to decide how to budget their time each day, which obviously makes it a perfect fit for DSE. However, instead of displaying a button for each possible activity the player can spend a period doing, I would like to use a pie chart- one circle broken into 10-15 wedges, with each wedge constituting an activity. My first thought was to simply hard-code the screen coords for each wedge, but since pie slices aren't rectangular that seems like a very dicey solution.
Is there a better way to implement this that I'm missing?
Using pie chart as interface
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.
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.
Re: Using pie chart as interface
One way would be to use the alpha True property in your imagemap, that does not focus transparent areas in your imagemap even if they are inside a hotspot, but for a pie chart hotspots would overlap probably, so don't know if this would work.
Or else, you could use an imagebutton for each chart slice with the focus_mask = True argument, so transparent areas in each button do not gain focus.
Check this thread as well, in the last post there are examples for each approach with accompanying buttons and code, so you can see what suits you best.
Or else, you could use an imagebutton for each chart slice with the focus_mask = True argument, so transparent areas in each button do not gain focus.
Check this thread as well, in the last post there are examples for each approach with accompanying buttons and code, so you can see what suits you best.
Re: Using pie chart as interface
Ooh thank you for the citation, I'll try implementing it and report back... this probably won't work, but I'm reading about imagebuttons and if I were to make multiple .pngs, with each .png being one wedge of a circle with a transparent background, would hover and selected idle/active trigger when the user moused over the invisible transparent background?
Re: Using pie chart as interface
If the imagebutton has the "focus_mask = True" argument, no it should not. Only opaque pixels trigger those states.
Re: Using pie chart as interface
Oh that's excellent to know, now I know that I have at least one option if all else fails.. thank you very much for the advice + clarification, I'll post back later when I've tried the original suggestion. ^^
- i1abnrk
- Regular
- Posts: 38
- Joined: Wed Nov 20, 2013 1:50 pm
- Projects: Critter Corral, Haremu Kikkemu Mo
- IRC Nick: i1abnrk
- Deviantart: i1abnrk
- Github: i1abnrk
- Location: Wisconsin
- Contact:
Re: Using pie chart as interface
If I were to tackle this I would start with a single image of an arc segment. Then I would apply a transformation of the arc segment and make n copies, each one rotated i * angle about the center point. Where n is the number of slices, i is a loop counter and angle is n/360 degrees.
The other way is to directly render a drawing to a canvas, specifically the renpy window. Here you would need to calculate points which can be formulated with the "unit circle" (see wikipedia). Essentially, the points are: center, the two angles in radians times the radius. The x-coordinate is sine(angle) and the y-coordinate is cosine(angle). (Or maybe it's the other way around :p) Last to convert radians to degrees is multiply by 360/pi.
So basically you need use trigonometry like my examples.
The other way is to directly render a drawing to a canvas, specifically the renpy window. Here you would need to calculate points which can be formulated with the "unit circle" (see wikipedia). Essentially, the points are: center, the two angles in radians times the radius. The x-coordinate is sine(angle) and the y-coordinate is cosine(angle). (Or maybe it's the other way around :p) Last to convert radians to degrees is multiply by 360/pi.
So basically you need use trigonometry like my examples.
Re: Using pie chart as interface
How is this "thing" still not b@nned... ?i1abnrk wrote:If I were to tackle this I would start with a single image of an arc segment. Then I would apply a transformation of the arc segment and make n copies, each one rotated i * angle about the center point. Where n is the number of slices, i is a loop counter and angle is n/360 degrees.
The other way is to directly render a drawing to a canvas, specifically the renpy window. Here you would need to calculate points which can be formulated with the "unit circle" (see wikipedia). Essentially, the points are: center, the two angles in radians times the radius. The x-coordinate is sine(angle) and the y-coordinate is cosine(angle). (Or maybe it's the other way around :p) Last to convert radians to degrees is multiply by 360/pi.
So basically you need use trigonometry like my examples.
Apologies, odd username and this reply confused the hell out of me...
Who is online
Users browsing this forum: No registered users