Page 1 of 1

Taking in-game screenshots. Calling them back.

Posted: Wed Oct 10, 2018 4:19 am
by Kinmoku
Hi all,

I want to take screenshots of drawings the player will do in-game (see thread: viewtopic.php?f=8&t=51370) and call them back soon after.

Here's my code so far:

In script.rpy:

Code: Select all

    call screen freehand_draw
In screens.rpy:

Code: Select all

screen freehand_draw():
    
    vbox:
        hbox:
            frame:
                background "#FFF"
                padding (0, 0)
                xsize 800
                ysize 360

                add freehand_canvas
         
        hbox:
            style "draw_ui"
            for colour in colours:
                button:
                    xsize 32
                    ysize 32
                    background colour
                    action SetField(freehand_canvas, 'colour', colour)

            textbutton "New sheet" action Function(freehand_canvas.clear)
            textbutton "Thicker pen" action SetField(freehand_canvas, 'line_width', 8)
            textbutton "Done" action [Function(Screenshot()), Return] ## this is the screenshot function
And then I want to show the drawing/ screenshot:

Code: Select all

## show recent screenshot?

k "Hahaha!"
m "Don't laugh! I drew that."
#etc
My issue is that when a screenshot is taken, dialogue shows up in the top left saying one is saved to the game folder which breaks immersion. And I also don't know how to "show" a screenshot that maybe called "screenshot01" or "screenshot99" depending on how many play-throughs you've done. How do I call the last screenshot? And how can I show it again later (in the gallery or in the credits)?

Thanks.

Re: Taking in-game screenshots. Calling them back.

Posted: Wed Oct 10, 2018 7:44 am
by philat
Do you need to be able to access all of 1-99 or just the last one taken?

Re: Taking in-game screenshots. Calling them back.

Posted: Mon Oct 15, 2018 5:20 am
by Kinmoku
philat wrote:
Wed Oct 10, 2018 7:44 am
Do you need to be able to access all of 1-99 or just the last one taken?
Hi Philat. Both, really. I want to show what the player has drawn soon after they've drawn it in the script... and then, later in the credits/ gallery (but this is less important)

There will be a few drawings, though, which is where it may get complicated, unless there's a way to name a specific screenshot, and replace it (if the player plays the game again)

Re: Taking in-game screenshots. Calling them back.

Posted: Mon Oct 15, 2018 5:25 am
by philat
If you don't need it to be saved, you can just use FileTakeScreenshot and FileCurrentScreenshot. Makes things much simpler for the former, if you don't absolutely need the latter.

https://www.renpy.org/doc/html/screen_a ... Screenshot
https://www.renpy.org/doc/html/screen_a ... Screenshot

If you need it to be saved, I guess you can use some sort of data structure (like a list) to keep track of screenshots.