diff --git a/project.godot b/project.godot index f8724e6..be9fd84 100644 --- a/project.godot +++ b/project.godot @@ -52,13 +52,12 @@ window/size/resizable=false window/size/test_width=600 window/size/test_height=1200 window/dpi/allow_hidpi=true +window/energy_saving/keep_screen_on=false window/handheld/orientation="portrait" window/size/width.mobile=600 window/size/height.mobile=1200 window/stretch/mode.mobile="2d" window/stretch/aspect.mobile="expand" -window/size/width.pc=1024 -window/size/height.pc=600 [filesystem] @@ -72,7 +71,6 @@ theme/custom="res://assets/taqin_theme.tres" [input_devices] pointing/emulate_touch_from_mouse=true -pointing/emulate_mouse_from_touch=false [rendering] diff --git a/src/DepthButton.tscn b/src/DepthButton.tscn index 27a2435..9154d52 100644 --- a/src/DepthButton.tscn +++ b/src/DepthButton.tscn @@ -20,6 +20,7 @@ text = "Press Me" anchor_top = 0.5 anchor_right = 1.0 anchor_bottom = 1.0 +mouse_filter = 2 [node name="Button" type="Button" parent="."] anchor_right = 1.0 diff --git a/src/Main.gd b/src/Main.gd index 216df57..fb2407f 100644 --- a/src/Main.gd +++ b/src/Main.gd @@ -13,6 +13,10 @@ func _notification(what): save_game() get_tree().quit() # default behavior +func _gui_input(event): + # Forward events to taquin so we can swipe from anywhere + taquin._gui_input(event) + func layout_reflow(): if container == null: return diff --git a/src/Piece.tscn b/src/Piece.tscn index cd8041c..5792617 100644 --- a/src/Piece.tscn +++ b/src/Piece.tscn @@ -258,6 +258,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 margin_right = 160.0 margin_bottom = 160.0 +mouse_filter = 2 __meta__ = { "_edit_use_anchors_": false } diff --git a/src/Taquin.gd b/src/Taquin.gd index 0b2e214..ed24c1d 100644 --- a/src/Taquin.gd +++ b/src/Taquin.gd @@ -82,7 +82,11 @@ func _ready() -> void: new_game(NewGamePanel.normal_columns, NewGamePanel.normal_rows, NewGamePanel.normal_iterations) -func _input(event): +func _unhandled_input(event): + # Forward keyboard event + _gui_input(event) + +func _gui_input(event): if $AnimationPlayer.is_playing(): # Disable input during animation return @@ -102,12 +106,16 @@ func _input(event): # if event.is_action_pressed("ui_up"): move_piece(Direction.UP, 1.0) + return if event.is_action_pressed("ui_down"): move_piece(Direction.DOWN, 1.0) + return if event.is_action_pressed("ui_left"): move_piece(Direction.LEFT, 1.0) + return if event.is_action_pressed("ui_right"): move_piece(Direction.RIGHT, 1.0) + return # # Handle touch input diff --git a/src/Taquin.tscn b/src/Taquin.tscn index 9b0b8ff..c2b0caa 100644 --- a/src/Taquin.tscn +++ b/src/Taquin.tscn @@ -64,6 +64,7 @@ margin_left = -300.0 margin_top = -300.0 margin_right = 300.0 margin_bottom = 300.0 +mouse_filter = 2 color = Color( 0.12549, 0.235294, 0.337255, 1 ) __meta__ = { "_edit_use_anchors_": false