Transparent background

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
MarFazzo
Newbie
Posts: 7
Joined: Tue Jan 26, 2016 10:44 am
Contact:

Transparent background

#1 Post by MarFazzo » Wed Feb 10, 2016 11:17 am

Hi all. I have this code:

Code: Select all

define myChar = Character(what_size=34, what_outlines=[(1, "#000", 0, 0)], what_text_align=0, window_right_margin=150, window_left_margin=150)

This permits, when used in a part of the game, to have a box with 150 pixels of margin from left and from right. I know that i can specify a background with:"window_background=#HEX", and without specifying it i have a black background with a bit of transparency.

How can i obtain total transparency?

User avatar
octacon100
Regular
Posts: 163
Joined: Thu Sep 12, 2013 11:23 pm
Projects: Regeria Hope
Organization: Golden Game Barn
IRC Nick: Octacon100
Location: Boston, MA
Contact:

Re: Transparent background

#2 Post by octacon100 » Wed Feb 10, 2016 12:58 pm

"#0000" Usually produces a transparent background for me.
Image
Current Digital Projects -
Image
Regiera Hope Completed Game Forum Post

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: Transparent background

#3 Post by PyTom » Thu Feb 11, 2016 2:27 am

window_background=None

is a better way of accomplishing this. When you use "#0000", Ren'Py will actually create an appropriately-sized image, filled with transparent pixels, and draw it to the screen. Even if a pixel is transparent, it still needs to be sent to the graphics card and drawn. Setting the background to None triggers a special case where nothing at all is drawn - which is faster. It probably won't make a difference, but I figured I'd clarify this in case it ever does.
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

Post Reply

Who is online

Users browsing this forum: zyric