So after making such screen it is neccessary to use it in main menu screen, save/load, preferences, yesno_prompt screens. Also, right in the beginning of start label one must set the value for this ordinary variable and show "cursor_changer" screen.
Code: Select all
screen cursor_changer:
######################################
#
# The green one for "pref", "save" and "load"
if not renpy.get_screen("yesno_prompt") and ( renpy.get_screen("preferences") or renpy.get_screen("save") or renpy.get_screen("load") ):
$ config.mouse = {"default" :[("cur1.png", 0, 0)]}
# The red one for main menu
elif renpy.get_screen("main_menu"):
$ config.mouse = {"default" :[("cur2.png", 0, 0)]}
# The grey one - when Ren'Py asks for confirmation
elif renpy.get_screen("yesno_prompt"):
$ config.mouse = {"default" :[("cur0.png", 0, 0)]}
# This will change cursor in game
elif cur_new != "def_cur":
$ config.mouse = {"default" :[cur_new]}
else:
$ config.mouse = None # The default value, that makes Ren'Py to use system cursor
#
######################################
Code: Select all
screen main_menu:
use cursor_changer
Code: Select all
screen save:
# This ensures that any other menu screen is replaced.
tag menu
use navigation
use cursor_changer
use file_picker
screen load:
# This ensures that any other menu screen is replaced.
tag menu
use navigation
use cursor_changer
use file_picker
Code: Select all
screen preferences:
use cursor_changer
Code: Select all
screen yesno_prompt:
use cursor_changer
Code: Select all
define e = Character('Eileen', color="#c8ffc8")
###################################################
# The game starts here.
label start:
$ cur_new = ( "cur0.png", 0, 0) # At first - we'll set the default value
show screen cursor_changer # Then - will show our screen, that will change the cursor during the game according to "cur_new" variable value
e "Hi! Now we see grey cursor"
$ cur_new = ("cur1.png", 0, 0) # Changing the "cur_new" value will change the cursor
e "Oh, it became green. That cursor change can be properly saved and restored from save, 'cause the cursor outlook is dinamically changing according to \"cur_new\" variable value - everything will work ok as long as we can save \"cur_new\"'s value."
e "Rollback works too."
$ cur_new = ( "cur2.png", 0, 0)
e "And now - it's red."
$ cur_new = "def_cur"
e "We are able to use the default (system) cursor."