From 5419864859c7548b96f7a64348da6928771f1175 Mon Sep 17 00:00:00 2001 From: adrienmalin <41926238+adrienmalin@users.noreply.github.com> Date: Wed, 16 Jan 2019 15:35:46 +0100 Subject: [PATCH] Hint text --- .gitignore | 3 +- source/Tetrominos/TetroJ.tscn | 2 +- source/Tetrominos/TetroT.tscn | 2 +- source/controls.gd | 12 +++++- source/controls.tscn | 72 ++++++++++++++++++++++++----------- 5 files changed, 64 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index 9b1fabb..788d651 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ export_presets.cfg midi/FluidR3 GM.sf2 release/ -*.import \ No newline at end of file +*.import +*.tmp \ No newline at end of file diff --git a/source/Tetrominos/TetroJ.tscn b/source/Tetrominos/TetroJ.tscn index aff0e9b..9e0ee86 100644 --- a/source/Tetrominos/TetroJ.tscn +++ b/source/Tetrominos/TetroJ.tscn @@ -3,7 +3,7 @@ [ext_resource path="res://Tetrominos/Tetromino.gd" type="Script" id=1] [ext_resource path="res://Tetrominos/Mino/Mino.tscn" type="PackedScene" id=2] -[node name="TetroJ" type="Spatial" index="0"] +[node name="TetroJ" type="Spatial"] script = ExtResource( 1 ) diff --git a/source/Tetrominos/TetroT.tscn b/source/Tetrominos/TetroT.tscn index 0f8dd94..52226e7 100644 --- a/source/Tetrominos/TetroT.tscn +++ b/source/Tetrominos/TetroT.tscn @@ -3,7 +3,7 @@ [ext_resource path="res://Tetrominos/TetroT.gd" type="Script" id=1] [ext_resource path="res://Tetrominos/Mino/Mino.tscn" type="PackedScene" id=2] -[node name="TetroT" type="Spatial"] +[node name="TetroT" type="Spatial" index="0"] script = ExtResource( 1 ) diff --git a/source/controls.gd b/source/controls.gd index 4e2b17b..4b9b0a5 100644 --- a/source/controls.gd +++ b/source/controls.gd @@ -98,8 +98,9 @@ func _input(event): InputMap.action_add_event(action, event) save_to_config("input", action, scancode) enable_resume = true - - + + hint_text() + func _ready(): # Load config if existing, if not it will be generated with default values load_config() @@ -111,6 +112,13 @@ func _ready(): var button = get_node("bindings").get_node(action).get_node("Button") button.text = OS.get_scancode_string(input_event.scancode) button.connect("pressed", self, "wait_for_input", [action]) + + hint_text() + +func hint_text(): + var input_event = InputMap.get_action_list("pause")[0] + var scancode = OS.get_scancode_string(input_event.scancode) + $hint.text = "Press "+ scancode + " to resume\nor click on a button to change key assignment" # Do not start processing input until a button is pressed set_process_input(false) diff --git a/source/controls.tscn b/source/controls.tscn index 18e9e7d..0d7550b 100644 --- a/source/controls.tscn +++ b/source/controls.tscn @@ -19,9 +19,9 @@ anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 margin_left = -30.0 -margin_top = 10.0 +margin_top = 20.0 margin_right = 10.0 -margin_bottom = 50.0 +margin_bottom = 60.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 0 @@ -39,10 +39,10 @@ anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = -40.0 -margin_top = -150.0 -margin_right = 110.0 -margin_bottom = -111.0 +margin_left = -220.0 +margin_top = -190.0 +margin_right = 280.0 +margin_bottom = -151.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 2 @@ -53,6 +53,8 @@ custom_fonts/font = ExtResource( 2 ) custom_colors/font_color = Color( 0.443137, 0.709804, 0.819608, 0.533333 ) custom_colors/font_color_shadow = Color( 1, 1, 1, 0.0968627 ) text = "PAUSE" +align = 1 +valign = 1 percent_visible = 1.0 lines_skipped = 0 max_lines_visible = -1 @@ -82,9 +84,9 @@ anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 margin_left = 50.0 -margin_top = 50.0 +margin_top = 65.0 margin_right = 90.0 -margin_bottom = 90.0 +margin_bottom = 105.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 0 @@ -130,9 +132,9 @@ anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 margin_left = 226.0 -margin_top = 51.0 +margin_top = 66.0 margin_right = 266.0 -margin_bottom = 91.0 +margin_bottom = 106.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 0 @@ -178,9 +180,9 @@ anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 margin_left = 230.0 -margin_top = 100.0 +margin_top = 115.0 margin_right = 270.0 -margin_bottom = 140.0 +margin_bottom = 155.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 0 @@ -225,9 +227,9 @@ anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 margin_left = 45.0 -margin_top = 100.0 +margin_top = 115.0 margin_right = 85.0 -margin_bottom = 140.0 +margin_bottom = 155.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 0 @@ -273,9 +275,9 @@ anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 margin_left = 50.0 -margin_top = 150.0 +margin_top = 165.0 margin_right = 90.0 -margin_bottom = 190.0 +margin_bottom = 205.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 0 @@ -320,9 +322,9 @@ anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 margin_left = 226.0 -margin_top = 151.0 +margin_top = 166.0 margin_right = 266.0 -margin_bottom = 191.0 +margin_bottom = 206.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 0 @@ -367,9 +369,9 @@ anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 margin_left = 50.0 -margin_top = 200.0 +margin_top = 215.0 margin_right = 90.0 -margin_bottom = 240.0 +margin_bottom = 255.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 0 @@ -413,9 +415,9 @@ anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 margin_left = 226.0 -margin_top = 201.0 +margin_top = 216.0 margin_right = 266.0 -margin_bottom = 241.0 +margin_bottom = 256.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 0 @@ -453,4 +455,30 @@ align = 1 position = Vector2( 34, 19 ) texture = ExtResource( 11 ) +[node name="hint" type="Label" parent="." index="2"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = -220.0 +margin_top = -135.0 +margin_right = 280.0 +margin_bottom = -103.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 2 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 4 +custom_fonts/font = ExtResource( 3 ) +text = "Press the pause/resume key to resume +or click on a button to change key assignment" +align = 1 +valign = 1 +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 +_sections_unfolded = [ "custom_fonts" ] +