mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-27 02:17:36 -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
|
grow_vertical = 2
|
||||||
script = ExtResource("4_xatjs")
|
script = ExtResource("4_xatjs")
|
||||||
ui_events = ExtResource("22_ryq4n")
|
ui_events = ExtResource("22_ryq4n")
|
||||||
|
command_events = ExtResource("22_lfk5j")
|
||||||
|
|
||||||
[node name="Blur" type="Panel" parent="UICanvas/UI"]
|
[node name="Blur" type="Panel" parent="UICanvas/UI"]
|
||||||
material = SubResource("ShaderMaterial_kc7rv")
|
material = SubResource("ShaderMaterial_kc7rv")
|
||||||
|
|
|
@ -2,7 +2,12 @@ extends Resource
|
||||||
class_name CommandEvents
|
class_name CommandEvents
|
||||||
|
|
||||||
signal send_fd
|
signal send_fd
|
||||||
|
signal set_mouse_mode(mode: int)
|
||||||
|
|
||||||
|
|
||||||
func send_fd_emit() -> void:
|
func send_fd_emit() -> void:
|
||||||
send_fd.emit()
|
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()
|
receive_commands()
|
||||||
|
|
||||||
|
|
||||||
func _execute_function(command: String) -> String:
|
func _execute_function(command: Command) -> Variant:
|
||||||
print("Recieved command: " + command)
|
print("Recieved command: " + command.name)
|
||||||
match command:
|
match command.name:
|
||||||
"send_fd":
|
"send_fd":
|
||||||
command_events.send_fd_emit()
|
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 ""
|
return ""
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
@export var ui_events: UiEvents
|
@export var ui_events: UiEvents
|
||||||
|
@export var command_events: CommandEvents
|
||||||
|
|
||||||
var mouse_mode: int = Input.MOUSE_MODE_VISIBLE
|
var mouse_mode: int = Input.MOUSE_MODE_VISIBLE
|
||||||
|
|
||||||
|
@ -9,6 +10,12 @@ func _ready() -> void:
|
||||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||||
hide_ui()
|
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:
|
func _input(event: InputEvent) -> void:
|
||||||
if event.is_action_pressed("show_ui") and not event.is_echo():
|
if event.is_action_pressed("show_ui") and not event.is_echo():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue