I'm looking to overlay basic shapes over a scene, mainly lines and polygons, but need to be able to manipulate them in-scene. I understand this could probably be accomplished with just semi-transparent overlay images, but I'm looking more for that retro heavily-aliased feeling of early 90s games. Is there any way to draw basic vectors over a scene, and change them based on coords?
I know I could probably do it in Pygame, but will I be able to overlay that over a Ren'Py scene, and manipulate it as the scene progresses (would this necessitate a re-render for each change?). Ideally, I'd like to be able animate mid-text/line, but I understand that's probably unfeasible.
Question: Any draw module? [Solved]
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.
Question: Any draw module? [Solved]
Last edited by Unin on Sat Mar 30, 2013 6:34 pm, edited 3 times in total.
- PyTom
- Ren'Py Creator
- Posts: 16096
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Question: Any draw module?
You can do this.
You need to create a Creator-Defined Displayable, and then call the canvas method of a render to get the render object.
You need to create a Creator-Defined Displayable, and then call the canvas method of a render to get the render object.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
Re: Question: Any draw module?
awesome, and canvas is just pygame.draw sans surfaces?
edit: found the udd page. thanks a ton. dynamic heads-up-display, here I come.
edit: found the udd page. thanks a ton. dynamic heads-up-display, here I come.
- PyTom
- Ren'Py Creator
- Posts: 16096
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Question: Any draw module?
That's exactly what it is. Internally, it makes a surface, and draws to it using the pygame.draw functions. (It also sets up code that turns that surface into a GL texture, and adds that texture to a render.)Unin wrote:awesome, and canvas is just pygame.draw sans surfaces?
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
Re: Question: Any draw module? (Resolved)
Wonderful. Is there any way I can add text to the render such that I don't have to manipulate text and my custom expression as 2 separate displayables?
I have a render I made scroll with crop, and want text to scroll with it, however changing the text changes the size of the width of the text displayable, which alters the rate it scales, making a huge heading in terms of alignment. If I could have my text on the same surface as the render, I could align it once and then crop as needed... That or find a way to get text with minwidth to play nice with crop
I have a render I made scroll with crop, and want text to scroll with it, however changing the text changes the size of the width of the text displayable, which alters the rate it scales, making a huge heading in terms of alignment. If I could have my text on the same surface as the render, I could align it once and then crop as needed... That or find a way to get text with minwidth to play nice with crop
- Attachments
-
- script.rpy
- w.i.p. HUD (updated)
- (17.63 KiB) Downloaded 35 times
- PyTom
- Ren'Py Creator
- Posts: 16096
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Question: Any draw module? [mostly solved]
Yes.
Code: Select all
class MyDD(renpy.Displayable):
def __init__(self):
self.text = Text("Hello, World")
def render(self, width, height, st, at):
rv = renpy.Render(width, height)
# Draw the text.
text_render = renpy.render(self.text, width, height, st, at)
rv.blit(text_render, (0, 0))
canvas = rv.canvas()
# ...
return rv
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
Re: Question: Any draw module? [Solved]
Ah, I hadn't tried in the init.That makes sense now. Does that mean all text needs to be hard coded into the class, or is there some way to pass a string into it? can I get away with calling a global string?
Thanks for all your help by the way. Hope I'm not drifting too far outside the scope of the question.
Thanks for all your help by the way. Hope I'm not drifting too far outside the scope of the question.
- PyTom
- Ren'Py Creator
- Posts: 16096
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Question: Any draw module? [Solved]
You can pass in strings using normal Python parameter passing.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot], MisterPinetree