Displaying a screenshot of the current screen

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
DarkClaymore
Regular
Posts: 57
Joined: Thu Jan 14, 2010 3:45 pm
Completed: Marriage Contract, Black Nirvana
Projects: God Vessel Online
Contact:

Displaying a screenshot of the current screen

#1 Post by DarkClaymore »

I'd like to know whether there are some built-in ways that allow (at least partially) to implement something like the second picture:

Image
Image

The idea is to automatically display a zoomed in portion of the current screen (or some layers of it) elsewhere on the screen, in this case to display part of the view inside the protagonist's camera.

I'd assume that the straightforward implementation would be something along the lines of:
> Take a screenshot of the current screen (perhaps while hiding layers which aren't meant to be displayed on the camera)
> Manipulate the taken image with crop/enlarge.
> Display it on top of the camera's sprite.

User avatar
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: Displaying a screenshot of the current screen

#2 Post by PyTom »

I'd suggest just working with the original image. While we can take screenshots, those screenshots will be downscaled - you won't be able to blow it up like you do there.

What might make a lot of sense would be to create an image (like a livecomposite) and apply multiple Transforms to it, one for the background, one for the close-up.

Code: Select all

image kittybg = LiveComposite((1600, 1200), (0, 0), "schoolbg.png", (1200, 600), "kitty.png")
show kittybg at Transform(zoom=.5)
show kittybg as closeup at Transform(crop=(1200, 600, 400, 300), pos=(400, 100))
[code]
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
DarkClaymore
Regular
Posts: 57
Joined: Thu Jan 14, 2010 3:45 pm
Completed: Marriage Contract, Black Nirvana
Projects: God Vessel Online
Contact:

Re: Displaying a screenshot of the current screen

#3 Post by DarkClaymore »

Thanks for the reply, this works great :D

I have two follow up questions to this regarding the matter, here's hoping to make it more automatic.

- Is there a way for me to "sample" all the currently displayed sprites on screen and to collect their data into an list?
The idea is to compose the camera's screen display automatically from the current display of the screen, without me having to manually input the parameters each and every the time. As you said, directly zooming-in a screenshot would indeed wreck the quality, which is why the kind of info I'll probably need about each displayed sprite would be image dimensions (to know the scaling needed) and the path to the original picture (Which I have a feeling I'll need to store myself in some list).


- There is something I'm missing regarding how Renpy language and Python are integrated. When I do something like this:

Code: Select all

$ Kitten_Pos = (557, 297)
image kittybg = LiveComposite((800, 600), (0, 0), "StreetBG.jpg", Kitten_Pos, "Kitten.png")
It tells me that "Kitten_Pos" isn't defined for the method call of LiveComposite. Is there some sort of scope issue?

Post Reply

Who is online

Users browsing this forum: Bing [Bot]