summaryrefslogtreecommitdiffstats
path: root/Main.gd
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2020-07-15 08:43:13 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2020-07-15 08:43:13 +0200
commit29b17954e10c68c082c2ccc8639476d176e498eb (patch)
treee8267291d31899cfb6cccef7e50e4c3c35d29d76 /Main.gd
parent1c1e1caa39a94deb1bfaccea5c15662fdb3a8605 (diff)
downloadgodot-hexgrid-29b17954e10c68c082c2ccc8639476d176e498eb.zip
godot-hexgrid-29b17954e10c68c082c2ccc8639476d176e498eb.tar.gz
Map : clean up
Diffstat (limited to 'Main.gd')
-rw-r--r--Main.gd9
1 files changed, 4 insertions, 5 deletions
diff --git a/Main.gd b/Main.gd
index 88af749..3db3072 100644
--- a/Main.gd
+++ b/Main.gd
@@ -18,11 +18,12 @@ func _ready():
Map.on_rotate()
func on_toggle() -> void:
- Map.config(UI.get_node("LOS").pressed, UI.get_node("Move").pressed)
+ Map.set_mode(UI.get_node("LOS").pressed, UI.get_node("Move").pressed)
Map.update()
func on_hex_touched(pos : Vector2, hex : Hex, key : int) -> void:
- UI.get_node("Info").set_text("\n(%d;%d)\n -> %s\n -> %d" % [int(pos.x), int(pos.y), hex.inspect(), key])
+ var s : String = ("offmap" if key == -1 else hex.inspect())
+ UI.get_node("Info").set_text("\n(%d;%d)\n -> %s\n -> %d" % [int(pos.x), int(pos.y), s, key])
func _unhandled_input(event : InputEvent) -> void:
if event is InputEventMouseMotion:
@@ -39,9 +40,7 @@ func _unhandled_input(event : InputEvent) -> void:
elif event.button_index == 3:
drag_map = event.pressed
elif event.button_index == 1:
- Map.on_mouse_1(event.pressed)
- elif event.button_index == 2:
- Map.on_mouse_2(event.pressed)
+ Map.on_click(event.pressed)
elif event is InputEventKey:
if event.scancode == KEY_ESCAPE:
get_tree().quit()