frame-of-mind/src/singletons/global_state.gd

42 lines
1.2 KiB
GDScript3
Raw Normal View History

extends Node
var screen_reader:bool = false
var disable_rendering: bool = false
var simplified_navigation:bool = false
var enable_subtitles: bool = false
var reduce_motion: bool = false
var show_content_notes: bool = false
var provide_summaries: bool = false
var allow_skipping: bool = false
var current_focus: Node
func request_focus(new_focus: Node, yoink:bool = false) -> bool:
if (current_focus == null or yoink) and new_focus != null:
current_focus = new_focus
return true
else: return false
func pass_focus_to(to: Node) -> bool:
if "has_focus" in to:
if not current_focus == null:
drop_focus_of(current_focus)
to.has_focus = true
return true
else: return false
func drop_own_focus(node: Node):
if current_focus == node:
current_focus = null
else:
push_error(node.name + " attempted to drop focus while not owning it!")
func drop_focus_of(node: Node):
if current_focus == node:
current_focus = null
if node.has_focus: node.has_focus = false
else:
node.has_focus = false
push_warning("Attempted to drop Focus for " + node.name + " while it wasn't focused!")