This commit is contained in:
2023-02-14 00:33:57 +01:00
parent 78c43de381
commit 42da5b9235
3 changed files with 7 additions and 14 deletions

View File

@@ -76,8 +76,10 @@ var _current_mouse_pos = Vector2.ZERO
var tooltip2_node: Object
func _ready():
$tooltip_layer/tooltip.connect("tooltip_size_updated", self, "update_tooltip_following_mouse_position", [tooltip_node])
$tooltip_layer/tooltip.connect("tooltip2_size_updated", self, "update_tooltip_following_mouse_position", [tooltip2_node])
if $tooltip_layer/tooltip.connect("tooltip_size_updated", self, "update_tooltip_following_mouse_position", [tooltip_node]) != 0:
escoria.logger.error(self, "Error connecting tooltip_size_updated")
if $tooltip_layer/tooltip2.connect("tooltip2_size_updated", self, "update_tooltip_following_mouse_position", [tooltip2_node]) != 0:
escoria.logger.error(self, "Error connecting tooltip2_size_updated")
func _enter_tree():
@@ -100,7 +102,8 @@ func _enter_tree():
if _is_gamepad_connected:
_on_gamepad_connected()
Input.connect("joy_connection_changed", self, "_on_joy_connection_changed")
if Input.connect("joy_connection_changed", self, "_on_joy_connection_changed") != 0:
escoria.logger.error(self, "Error connecting joy_connection_changed")
func _exit_tree():
@@ -164,9 +167,7 @@ func _process(_delta) -> void:
var delta_x = int(x * AXIS_WEIGHT) if abs(x) > DEADZONE else 0
var delta_y = int(y * AXIS_WEIGHT) if abs(y) > DEADZONE else 0
if delta_x or delta_y:
var direction: Vector2
direction.x = delta_x
direction.y = delta_y
var direction = Vector2(delta_x, delta_y)
escoria.logger.trace("gamepad direction:", [direction])
var viewport = get_viewport()
viewport.warp_mouse(viewport.get_mouse_position() + direction)

View File

@@ -33,9 +33,5 @@ func update_tooltip_text():
func _on_room_ready():
escoria.logger.warn(
self,
"ON ROOM READY TOOLTIP2 id=" + String(id)
)
escoria.main.current_scene.game.tooltip2_node = self
_room_is_ready = true

View File

@@ -33,9 +33,5 @@ func update_tooltip_text():
func _on_room_ready():
escoria.logger.warn(
self,
"ON ROOM READY id=" + String(id)
)
escoria.main.current_scene.game.tooltip_node = self
_room_is_ready = true