mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-25 14:17:29 -04:00
gd: set_mouse_mode
This commit is contained in:
parent
ef1ee7b3a0
commit
0eda5b758d
4 changed files with 20 additions and 4 deletions
|
@ -171,6 +171,7 @@ grow_horizontal = 2
|
|||
grow_vertical = 2
|
||||
script = ExtResource("4_xatjs")
|
||||
ui_events = ExtResource("22_ryq4n")
|
||||
command_events = ExtResource("22_lfk5j")
|
||||
|
||||
[node name="Blur" type="Panel" parent="UICanvas/UI"]
|
||||
material = SubResource("ShaderMaterial_kc7rv")
|
||||
|
|
|
@ -2,7 +2,12 @@ extends Resource
|
|||
class_name CommandEvents
|
||||
|
||||
signal send_fd
|
||||
signal set_mouse_mode(mode: int)
|
||||
|
||||
|
||||
func send_fd_emit() -> void:
|
||||
send_fd.emit()
|
||||
|
||||
|
||||
func set_mouse_mode_emit(mode: int) -> void:
|
||||
set_mouse_mode.emit(mode)
|
||||
|
|
|
@ -13,11 +13,14 @@ func _physics_process(delta: float) -> void:
|
|||
receive_commands()
|
||||
|
||||
|
||||
func _execute_function(command: String) -> String:
|
||||
print("Recieved command: " + command)
|
||||
match command:
|
||||
func _execute_function(command: Command) -> Variant:
|
||||
print("Recieved command: " + command.name)
|
||||
match command.name:
|
||||
"send_fd":
|
||||
command_events.send_fd_emit()
|
||||
"set_mouse_mode":
|
||||
if command.args.size() != 1: push_error("Arg count should be 1"); return ""
|
||||
command_events.set_mouse_mode_emit(command.args[0])
|
||||
_:
|
||||
print("Command %s not implemented" % [command])
|
||||
print("Command %s not implemented" % [command.name])
|
||||
return ""
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
extends Control
|
||||
|
||||
@export var ui_events: UiEvents
|
||||
@export var command_events: CommandEvents
|
||||
|
||||
var mouse_mode: int = Input.MOUSE_MODE_VISIBLE
|
||||
|
||||
|
@ -8,6 +9,12 @@ var mouse_mode: int = Input.MOUSE_MODE_VISIBLE
|
|||
func _ready() -> void:
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
hide_ui()
|
||||
|
||||
command_events.set_mouse_mode.connect(set_mouse_mode)
|
||||
|
||||
|
||||
func set_mouse_mode(mode: int) -> void:
|
||||
if not visible: Input.set_mouse_mode(mode)
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue