Brightness in game settings

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
User avatar
Andredron
Miko-Class Veteran
Posts: 722
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Brightness in game settings

#1 Post by Andredron »

Write this code first

Code: Select all

define config.gl2 = True
default persistent.brightvar = 0.0

init:
    transform bright:
        matrixcolor BrightnessMatrix((persistent.brightvar))
Further, for convenience, in the settings we will write a bar where you can change the values

Code: Select all

vbox:
    xsize 525
    label _("Brightness")
    bar value FieldValue(persistent, "brightvar", range=2.0, offset=-1, style="slider")

Registration of all code, check its performance

Code: Select all

default persistent.brightvar = 0.0

init:
    transform bright:
        matrixcolor BrightnessMatrix((persistent.brightvar))



label start:
    scene ball10 at bright
    "Hi"
    scene ball50 at bright
    "test"
     return
As you can see, the code works, but the problem is highlighted that a lot of unnecessary writing will have to be written, in order to avoid this, we will write such a function

Code: Select all

init python:
   def myShow( *args, **kwargs ):
        if not "at" in kwargs: kwargs["at_list"] = []
        kwargs["at_list"].append(bright )
        renpy.show( *args, **kwargs )
   config.show = myShow
Or:

https://www.reddit.com/r/RenPy/comments ... s_setting/

Post Reply

Who is online

Users browsing this forum: No registered users