How to add "im.matrix.saturation" to the original buttons?

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
Posts: 6
Joined: Mon Nov 04, 2019 3:56 pm

How to add "im.matrix.saturation" to the original buttons?

#1 Post by Avalonica » Fri Nov 08, 2019 8:42 am

Hello all, I would just love to implement this "im.matrix.saturation" over to the original Ren'py buttons without making lots of new code for a button every time I need it.

Here is the code I want to use on the original Ren'py buttons in gui.rpy and screens.rpy:

Code: Select all

define over = im.matrix.saturation(0.98) * im.matrix.contrast(1.07) * im.matrix.brightness(0.07)
define noop = im.matrix.saturation(1.02) * im.matrix.contrast(0.93) * im.matrix.brightness(-.07)
define live = im.matrix.saturation(2.38) * im.matrix.contrast(0.93) * im.matrix.brightness(0.07)
This is how I currently use it for stand-alone buttons:

Code: Select all

image menu_btn = 'gui/button/button_generic_popup_full.png'
image menu_btn_idle = Frame('menu_btn',
                            left=14, top=9, right=10, bottom=17)
image menu_btn_over = Frame(im.MatrixColor(ImageReference('menu_btn'), over),
                            left=14, top=9, right=10, bottom=17)
image menu_btn_noop = Frame(im.MatrixColor(ImageReference('menu_btn'), noop),
                            left=14, top=9, right=10, bottom=17)
image menu_btn_live = Frame(im.MatrixColor(ImageReference('menu_btn'), live),
                            left=14, top=9, right=10, bottom=17)

style menu_button:
    align (.5, .5)
    hover_background 'menu_btn_over'
    idle_background 'menu_btn_idle'
    insensitive_background 'menu_btn_noop'
    padding (23, 10, 20, 15)
    selected_background 'menu_btn_live'
    selected_hover_background 'menu_btn_over'
    xysize (200, 55)
So, it's a dream of mine to get rid of this code and have the "im.matrix.saturation" work on the Ren'py "vanilla" buttons directly, but I can't find any reference to the physical .png files in gui.rpy or screens.rpy in order to add the "im.matrix.saturation" effect.

Can anyone of you veterans please (if possible) post a workaround or something "that works" since this is the final step I have to solve before I can start to work on my actual Visual Novel.

Post Reply

Who is online

Users browsing this forum: amekoi, VoidWalker