Drawing in Ren'Py

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
Human Bolt Diary
Regular
Posts: 111
Joined: Fri Oct 11, 2013 12:46 am
Contact:

Re: Drawing in Ren'Py

#16 Post by Human Bolt Diary »

Imperf3kt wrote: Tue Aug 21, 2018 9:13 pm The big question is: can you draw an Eileen with it?
I got pretty close.
Attachments
freehand.png

User avatar
MaydohMaydoh
Regular
Posts: 165
Joined: Mon Jul 09, 2018 5:49 am
Projects: Fuwa Fuwa Panic
Tumblr: maydohmaydoh
Location: The Satellite of Love
Contact:

Re: Drawing in Ren'Py

#17 Post by MaydohMaydoh »

Everyone should draw eileens.
eileen nya.png

User avatar
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Re: Drawing in Ren'Py

#18 Post by Kinmoku »

Oh my God these are all amazing! I'd almost given up on the idea, but now I'll give it a go :D So cool :)

User avatar
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Re: Drawing in Ren'Py

#19 Post by Kinmoku »

Question: How do I set the default "line_width" from 1 to 8, without having to use buttons. I'm not planning on having the choice of line thickness.

Another Question: Can you create a "Save canvas" button and use the saved drawing elsewhere in the game?

Thanks!

User avatar
MaydohMaydoh
Regular
Posts: 165
Joined: Mon Jul 09, 2018 5:49 am
Projects: Fuwa Fuwa Panic
Tumblr: maydohmaydoh
Location: The Satellite of Love
Contact:

Re: Drawing in Ren'Py

#20 Post by MaydohMaydoh »

If you're using Human Bolt Diary's example, in the FreehandCanvas init, there's a line_width variable. That controls the line width. If you're building from scratch you don't need line_width and can just give the width to the render directly.

Code: Select all

render.canvas().lines(self.colour, False, self.lines, self.line_width)
Just change the self.line_width with whatever width you want.

User avatar
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Re: Drawing in Ren'Py

#21 Post by Kinmoku »

MaydohMaydoh wrote: Fri Aug 24, 2018 11:09 am If you're using Human Bolt Diary's example, in the FreehandCanvas init, there's a line_width variable. That controls the line width. If you're building from scratch you don't need line_width and can just give the width to the render directly.

Code: Select all

render.canvas().lines(self.colour, False, self.lines, self.line_width)
Just change the self.line_width with whatever width you want.
Ah great, thank you! I was looking all over for where to edit it. I kept getting crashes ^^;

How can I save the drawings?

User avatar
MaydohMaydoh
Regular
Posts: 165
Joined: Mon Jul 09, 2018 5:49 am
Projects: Fuwa Fuwa Panic
Tumblr: maydohmaydoh
Location: The Satellite of Love
Contact:

Re: Drawing in Ren'Py

#22 Post by MaydohMaydoh »

You set screenshot crop to the size of the canvas
https://www.renpy.org/doc/html/config.h ... nshot_crop
and make a button that calls the Screenshot function

I plan to add something like that eventually.

Simple example

Code: Select all

define config.screenshot_crop = (0, 0, 500, 500)

screen canvas():
    ## drawing stuff here ##
    
    textbutton "Save" action Function(Screenshot())
I thought Screenshot was a screen action because it was capitalised but apparently it isn't and I ended up with over 200 screenshots... :roll:

User avatar
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Re: Drawing in Ren'Py

#23 Post by Kinmoku »

MaydohMaydoh wrote: Fri Aug 24, 2018 12:23 pm I thought Screenshot was a screen action because it was capitalised but apparently it isn't and I ended up with over 200 screenshots...
Haha! Good to know.

Thanks for the help, anyway. I'm going to try this out properly next week and get it working! I'm so excited I can do my idea now, hehe! :mrgreen:

User avatar
Andredron
Miko-Class Veteran
Posts: 700
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: Drawing in Ren'Py

#24 Post by Andredron »

cool! a lot of ideas arose:

Mini game - paint the sketch

draw on the school chalk board

color and draw your character, draw your game

in rpg draw your coat of arms, and a whole bunch of options!

Chains
Newbie
Posts: 11
Joined: Mon Dec 13, 2021 4:01 pm

Re: Drawing in Ren'Py

#25 Post by Chains »

Hello! I know this thread has been inactive for a long time so I don't know if this is still being worked on.

First of all this is very helpful and close to what I want in my game.

Did anyone find a way to save the image, not just as a screenshot for the player, but to display it in the game?

I want the player to draw something for fun and the drawing is displayed at a later point in the game.
This must have to work even if the player has closed the game in the meantime.
The drawing will also have to be resized to not take up the space that it needed when it was drawn.

Does anyone think that this is even possible?

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

Re: Drawing in Ren'Py

#26 Post by Imperf3kt »

If you save it as a screenshot, you can then reference that screenshot as a file. I couldn't say how exactly without digging into the documentation (I'm afraid I don't currently have any time to spare)
I would assume as long as you know what the screenshot saves as and where, you can use it as a normal image, possibly using some python to check the image actually exists, just incase the image doesn't exist, so the game doesn't crash when reaching that part.
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

Chains
Newbie
Posts: 11
Joined: Mon Dec 13, 2021 4:01 pm

Re: Drawing in Ren'Py

#27 Post by Chains »

Imperf3kt wrote: Wed Dec 15, 2021 4:49 am If you save it as a screenshot, you can then reference that screenshot as a file. I couldn't say how exactly without digging into the documentation (I'm afraid I don't currently have any time to spare)
I would assume as long as you know what the screenshot saves as and where, you can use it as a normal image, possibly using some python to check the image actually exists, just incase the image doesn't exist, so the game doesn't crash when reaching that part.
Thank you so much for letting me know!
I will look into this in the documentation and I might even be able to post a solution if I find one, in case anyone else wants to try it.

EDIT: I found this topic which pretty much sums up how it's done.
My problem is solved!

User avatar
Gabmag
Regular
Posts: 76
Joined: Wed Sep 19, 2018 10:49 pm
Completed: A Date with Death, The Divine Speaker, start;again, Amelie, The Sun and the Moon
Projects: Dreambound
Organization: Two and a Half Studios
IRC Nick: Gabmag
Location: Australia
Contact:

Re: Drawing in Ren'Py

#28 Post by Gabmag »

Thanks everyone for the great tips and tricks for drawing in Ren'py - would anyone know the best way to make the images persistent? E.g, I want to use the drawing tool as a "notepad" of sorts. If I don't reload the game, then the drawings stay in the screen, but upon saving and reloading I'm guessing the list becomes blank again and the images are gone.

EDIT: Nevermind, I got it working how I wanted!
i make games sometimes, other times i cry.

User avatar
YumaDazai
Regular
Posts: 34
Joined: Wed Jul 04, 2018 4:10 pm
Projects: PD9
Contact:

Re: Drawing in Ren'Py

#29 Post by YumaDazai »

Hello! I know this thread is very old, but I was wondering if anyone could help? When ever I click start, I get this error:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While loading <'Image' u'circle_icon.png'>:
  File "game/script.rpy", line 97, in script
    call screen freehand_draw
  File "renpy/common/000statements.rpy", line 569, in execute_call_screen
    store._return = renpy.call_screen(name, *args, **kwargs)
IOError: Couldn't find file 'circle_icon.png'.

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 97, in script
    call screen freehand_draw
  File "renpy/ast.py", line 2015, in execute
    self.call("execute")
  File "renpy/ast.py", line 2003, in call
    return renpy.statements.call(method, parsed, *args, **kwargs)
  File "renpy/statements.py", line 278, in call
    return method(parsed, *args, **kwargs)
  File "renpy/common/000statements.rpy", line 569, in execute_call_screen
    store._return = renpy.call_screen(name, *args, **kwargs)
  File "renpy/exports.py", line 3134, in call_screen
    rv = renpy.ui.interact(mouse="screen", type="screen", roll_forward=roll_forward)
  File "renpy/ui.py", line 298, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "renpy/display/core.py", line 3315, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, pause=pause, pause_start=pause_start, **kwargs)
  File "renpy/display/core.py", line 3834, in interact_core
    self.draw_screen(root_widget, fullscreen_video, (not fullscreen_video) or video_frame_drawn)
  File "renpy/display/core.py", line 2555, in draw_screen
    renpy.config.screen_height,
  File "render.pyx", line 492, in renpy.display.render.render_screen
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/layout.py", line 824, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/layout.py", line 824, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/layout.py", line 824, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/screen.py", line 688, in render
    child = renpy.display.render.render(self.child, w, h, st, at)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/layout.py", line 824, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/layout.py", line 1027, in render
    surf = render(d, width - x, rh, cst, cat)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/layout.py", line 985, in render
    surf = render(d, rw, height - y, cst, cat)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/layout.py", line 1027, in render
    surf = render(d, width - x, rh, cst, cat)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/behavior.py", line 791, in render
    rv = super(Button, self).render(width, height, st, at)
  File "renpy/display/layout.py", line 1254, in render
    st, at)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/im.py", line 623, in render
    return cache.get(self, render=True)
  File "renpy/display/im.py", line 287, in get
    surf = image.load()
  File "renpy/display/im.py", line 704, in load
    raise e
IOError: Couldn't find file 'circle_icon.png'.

Windows-10-10.0.19041
Ren'Py 7.4.10.2178
ggfg 1.0
Fri Mar 18 15:21:37 2022
I try adding a circle icon png file, but that doesn't fix the issue. Any help would be great!
Programmer that will work paid and or for free! Message me on discord for more info at: Yuma#8158

User avatar
Andredron
Miko-Class Veteran
Posts: 700
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: Drawing in Ren'Py

#30 Post by Andredron »



the coolest way to use in games that I've seen

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], Semrush [Bot]