mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 11:40:13 +01:00
all keys are rebindable
This commit is contained in:
@@ -29,6 +29,7 @@ from libs.transition import Transition
|
||||
from libs.utils import (
|
||||
OutlinedText,
|
||||
get_current_ms,
|
||||
get_key_code,
|
||||
global_data,
|
||||
global_tex,
|
||||
is_l_don_pressed,
|
||||
@@ -199,14 +200,14 @@ class GameScreen(Screen):
|
||||
self.song_started = True
|
||||
|
||||
def global_keys(self):
|
||||
if ray.is_key_pressed(ray.KeyboardKey.KEY_F1):
|
||||
if ray.is_key_pressed(get_key_code(global_data.config["keys"]["restart_key"])):
|
||||
if self.song_music is not None:
|
||||
audio.stop_music_stream(self.song_music)
|
||||
self.init_tja(global_data.session_data[global_data.player_num-1].selected_song)
|
||||
audio.play_sound('restart', 'sound')
|
||||
self.song_started = False
|
||||
|
||||
if ray.is_key_pressed(ray.KeyboardKey.KEY_ESCAPE):
|
||||
if ray.is_key_pressed(get_key_code(global_data.config["keys"]["back_key"])):
|
||||
if self.song_music is not None:
|
||||
audio.stop_music_stream(self.song_music)
|
||||
return self.on_screen_end('SONG_SELECT')
|
||||
|
||||
@@ -4,6 +4,7 @@ import pyray as ray
|
||||
from libs.audio import audio
|
||||
from libs.screen import Screen
|
||||
from libs.utils import (
|
||||
get_key_code,
|
||||
global_data,
|
||||
is_l_don_pressed,
|
||||
is_l_kat_pressed,
|
||||
@@ -120,7 +121,7 @@ class SettingsScreen(Screen):
|
||||
self.config[current_header][setting_key] = [new_key]
|
||||
self.editing_key = False
|
||||
logger.info(f"Key binding updated: {current_header}.{setting_key} -> {new_key}")
|
||||
elif key_pressed == ray.KeyboardKey.KEY_ESCAPE:
|
||||
elif key_pressed == get_key_code(global_data.config["keys"]["back_key"]):
|
||||
self.editing_key = False
|
||||
logger.info("Key binding edit cancelled")
|
||||
|
||||
@@ -139,7 +140,7 @@ class SettingsScreen(Screen):
|
||||
self.config[current_header][setting_key] = [button_pressed]
|
||||
self.editing_gamepad = False
|
||||
logger.info(f"Gamepad binding updated: {current_header}.{setting_key} -> {button_pressed}")
|
||||
if ray.is_key_pressed(ray.KeyboardKey.KEY_ESCAPE):
|
||||
if ray.is_key_pressed(get_key_code(global_data.config["keys"]["back_key"])):
|
||||
self.editing_gamepad = False
|
||||
logger.info("Gamepad binding edit cancelled")
|
||||
|
||||
@@ -221,7 +222,7 @@ class SettingsScreen(Screen):
|
||||
if ('keys' not in current_header) and ('gamepad' not in current_header):
|
||||
self.handle_string_cycle(current_header, setting_key)
|
||||
|
||||
elif ray.is_key_pressed(ray.KeyboardKey.KEY_ESCAPE):
|
||||
elif ray.is_key_pressed(get_key_code(global_data.config["keys"]["back_key"])):
|
||||
self.in_setting_edit = False
|
||||
logger.info("Exited section edit")
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ from libs.transition import Transition
|
||||
from libs.utils import (
|
||||
OutlinedText,
|
||||
get_current_ms,
|
||||
get_key_code,
|
||||
global_data,
|
||||
is_l_don_pressed,
|
||||
is_l_kat_pressed,
|
||||
@@ -305,8 +306,8 @@ class SongSelectScreen(Screen):
|
||||
if not current_box.is_back and get_current_ms() >= song.box.wait + (83.33*3):
|
||||
self.texture_index = current_box.texture_index
|
||||
|
||||
if ray.is_key_pressed(ray.KeyboardKey.KEY_ESCAPE):
|
||||
logger.info("Escape key pressed, returning to ENTRY screen")
|
||||
if ray.is_key_pressed(get_key_code(global_data.config["keys"]["back_key"])):
|
||||
logger.info("Back key pressed, returning to ENTRY screen")
|
||||
return self.on_screen_end('ENTRY')
|
||||
|
||||
def draw_background_diffs(self):
|
||||
|
||||
Reference in New Issue
Block a user