From 88b1c71e48bd83decb43503af14df94c8dfe60b0 Mon Sep 17 00:00:00 2001 From: Terry Hearst Date: Mon, 16 Dec 2024 17:58:49 -0500 Subject: [PATCH] Fix button hovering on mobile --- src/global.gd | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/global.gd b/src/global.gd index 6c42c09..8bfbc77 100644 --- a/src/global.gd +++ b/src/global.gd @@ -38,6 +38,7 @@ func _ready() -> void: generable_words = parse_words(GENERABLE_WORDS_FILENAME, MIN_WORD_LENGTH, MAX_WORD_LENGTH) all_words = parse_words(ALL_WORDS_FILENAME, MIN_WORD_LENGTH, MAX_WORD_LENGTH) + fix_hovering() detect_params() @@ -83,6 +84,15 @@ func is_valid_word(word: String) -> bool: return word.to_upper() in words_list +## Fixes the theme so that on mobile, buttons don't incorrectly show as hovered +func fix_hovering() -> void: + if OS.has_feature("mobile") or OS.has_feature("web_android") or OS.has_feature("web_ios"): + var default_theme := ThemeDB.get_default_theme() + var project_theme := ThemeDB.get_project_theme() + var stylebox := default_theme.get_stylebox("normal", "Button") + project_theme.set_stylebox("hover", "Button", stylebox) + + ## Checks for command line/URL parameters and configures the game accordingly func detect_params() -> void: var daily := false