Possible to get a list of images currently shown on 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
Woetoo
Regular
Posts: 26
Joined: Sat Feb 09, 2019 9:48 am
Contact:

Possible to get a list of images currently shown on screen?

#1 Post by Woetoo » Thu Jan 21, 2021 9:40 am

So I have an idea for a cellphone interface where the game shows a cellphone in the foreground and blurs the background image.
I realize I could create a screen, where I pass it the name of the current game background and do something with im.Blur().

But I had it in my head to make it more generic than that and have the screen "figure out" the current image background based on some mythical, yet unknown to me, list of active images.

The closest I can find at first glance is some combination of renpy.list_images() and renpy.showing(). But since one is a list of images and the other deals with displayable tags - I'm both not hopeful and somewhat concerned that looping through a list of ALL images looking for the showing ones might be too slow.

Can anyone point me in the direction of an alternate solution?
Ideally an image function that has a list of currently shown images.

I'm figuring with a list of current images, I could work out the image dimensions and hopefully only find a single image which is a full screen image (i.e. the current background).

I know the "pass the image name to the screen" is a simpler solution. But it'll bug me if I don't at least try to work through this more generic solution.
In all likelihood, there will be other problems that will make it impractical... but I had to ask.

Cheers in advance for any help offered.

User avatar
Angelo Seraphim
Regular
Posts: 32
Joined: Tue May 21, 2019 8:00 am
Completed: Enamored Risks (NaNoReNo 2020)
Projects: 616 Charagma
Organization: GLSUoA
Deviantart: glsuoa
itch: glsuoa
Location: London, UK
Discord: Just A Concept#9599
Contact:

Re: Possible to get a list of images currently shown on screen?

#2 Post by Angelo Seraphim » Thu Jan 21, 2021 9:58 am

Hi @Woetoo
I think this only might be what you are looking for - https://www.renpy.org/doc/html/displayi ... ist_images
It states;
Returns a list of images that have been added to Ren'Py, as a list of strings with spaces between the name components.
I believe on that same page there are functions where you can get the dimensions of an image and so on.

Not sure if there's anything else, but I hope this helps.
Image

User avatar
PyTom
Ren'Py Creator
Posts: 15893
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: Possible to get a list of images currently shown on screen?

#3 Post by PyTom » Thu Jan 21, 2021 10:15 am

What you probably want to do, in 7.4.1, is to use a blur transform. The setup:

Code: Select all

define config.gl2 = True

transform blur:
    blur 8
Then something like:

Code: Select all

show layer master at blur
call screen cellphone
show layer master
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
_ticlock_
Veteran
Posts: 393
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: Possible to get a list of images currently shown on screen?

#4 Post by _ticlock_ » Thu Jan 21, 2021 12:25 pm

You can also add the transform directly to the screen cellphone like this:

Code: Select all

define config.gl2 = True

screen cellphone:
    on "show" action Function(renpy.show_layer_at, linear_blur(0,8), layer='master')
    on "hide" action Function(renpy.show_layer_at, linear_blur(8,0), layer='master')
    ...

transform linear_blur(start,end):
    blur start
    linear 0.5 blur end
In this case, screen cellphone have linear blur transform when the screen is shown(called) and linear blur transform back to the normal background when the screen is hidden(returned from call statement).
If you want instantaneous transition you can remove linear 0.5

Woetoo
Regular
Posts: 26
Joined: Sat Feb 09, 2019 9:48 am
Contact:

Re: Possible to get a list of images currently shown on screen?

#5 Post by Woetoo » Thu Jan 21, 2021 1:02 pm

Cheers all.
I'm not seeing how each will work yet, but I can have a play. Ta.

But since it'll bug me if I don't ask... is it possible to get the list of currently displayed images?

Post Reply

Who is online

Users browsing this forum: Bing [Bot]