https://www.renpy.org/doc/html/gesture.html
It gives very little information and unlike other pages in the documentation - there is no example of use, just obscure theory.
PyTom responded to a user's question about it by saying that gestures are simply matched with keystrokes, and he considers this system a mistake and is not going to improve it in the future. But for us it's not a big deal - the main thing is that it works.
viewtopic.php?p=482127#p482127
Now I'll tell you how I figured it out, did it, customized it and what bugs the presence of gestures causes and how to fix them.
Initialization - let's write one of them in options.rpy:
Code: Select all
define config.variants = ["phone", "tablet", "touch", "ios", None]
define config.gestures = { "n" : "game_menu",
"w" : "help",
"e" : "toggle_skip",
"s" : "hide_windows"}
init -1700 python:
_game_menu_screen = "save"
North - North, South - South, West - West, East - East. They can be combined via underscores, for example: "n_w".
Well, since the gesture system is just matched with keystrokes, and a keystroke doesn't do what you want - nothing will work, so we have only 4 actions - i.e. we can say 4 screens. I'll tell you what to do about it now, but the gesture system already works after you put in the code and there are already 2 bugs.
Let's say that by swiping down["s"] we want to hide the interface - all is well. Swipe right["e"] to enable skipping - all good. But by swiping up["n"] we want to open not the settings or save menu, but for example - "about the game". Yes, that's how we wanted, but we can only action - game_menu.
The solution - simply in script.rpy or optinons.rpy we write
Code: Select all
init -1700 python:
_game_menu_screen = "about"
Now let's deal with another error - the history screen is called in the main menu. We write about this code and check, and then set the value of the variable "scr_show" at the beginning of the label "start" with the value "True":
screen.rpy
Code: Select all
screen help() :###screen history
tag menu
if scr_show:
#screen history code
else:
$ renpy_quit()
Code: Select all
label start:
$ scr_show = True
############
jump prolog
if renpy.variant("") — "pc" , "small", "touch" .
And you can fix it by simply replacing this check with a regular variable check.
I leave a link to a project we are experimenting with for the second time and now it has a gesture system built in in addition to the gallery
https://disk.yandex.ru/d/CUJyqjmaczuSkA
Author - https://vk.com/@miosion_pub-sistema-zhestov-v-renpy
viewtopic.php?p=548711- Hide the interface with an upward gesture
viewtopic.php?p=330957 - Crutch number 1
viewtopic.php?p=554242 - Crutch number 2