Fix button hovering on mobile

This commit is contained in:
Terry Hearst 2024-12-16 17:58:49 -05:00
parent dee5fba60e
commit 88b1c71e48

View file

@ -38,6 +38,7 @@ func _ready() -> void:
generable_words = parse_words(GENERABLE_WORDS_FILENAME, MIN_WORD_LENGTH, MAX_WORD_LENGTH) 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) all_words = parse_words(ALL_WORDS_FILENAME, MIN_WORD_LENGTH, MAX_WORD_LENGTH)
fix_hovering()
detect_params() detect_params()
@ -83,6 +84,15 @@ func is_valid_word(word: String) -> bool:
return word.to_upper() in words_list 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 ## Checks for command line/URL parameters and configures the game accordingly
func detect_params() -> void: func detect_params() -> void:
var daily := false var daily := false