Skip to content

Commit

Permalink
Using centered GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
Dariasteam committed Dec 14, 2018
1 parent 3ea37b2 commit 1de9dcf
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 48 deletions.
64 changes: 25 additions & 39 deletions Scenes/Input_Handler.tscn
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
[gd_scene load_steps=11 format=1]
[gd_scene load_steps=10 format=1]

[ext_resource path="res://input_handler.gd" type="Script" id=1]
[ext_resource path="res://Scenes/Column.tscn" type="PackedScene" id=2]
[ext_resource path="res://Sprites/Particle.png" type="Texture" id=3]
[ext_resource path="res://icon.png" type="Texture" id=4]
[ext_resource path="res://points_handler.gd" type="Script" id=5]
[ext_resource path="res://Fonts/points_font.fnt" type="BitmapFont" id=6]
[ext_resource path="res://Scenes/default_button.tscn" type="PackedScene" id=7]
[ext_resource path="res://Scenes/button_shadow.tres.gd" type="Script" id=8]
[ext_resource path="res://points_handler.gd" type="Script" id=4]
[ext_resource path="res://Fonts/points_font.fnt" type="BitmapFont" id=5]
[ext_resource path="res://Scenes/default_button.tscn" type="PackedScene" id=6]
[ext_resource path="res://Scenes/button_shadow.tres.gd" type="Script" id=7]

[sub_resource type="StyleBoxFlat" id=1]

Expand Down Expand Up @@ -40,14 +39,18 @@ func _ready():
[node name="Control" type="Control"]
anchor/left = 3
anchor/top = 3
anchor/right = 3
anchor/bottom = 3
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 0.0
margin/right = 718.0
margin/bottom = 1287.0
size_flags/horizontal = 0
size_flags/vertical = 0
margin/left = 360.0
margin/top = 640.0
margin/right = -360.0
margin/bottom = -640.0
script/script = ExtResource( 1 )
[node name="Spatial" parent="." instance=ExtResource( 2 )]
Expand Down Expand Up @@ -85,32 +88,17 @@ params/anim_speed_scale = 1.0
params/anim_initial_pos = 0.0
randomness/initial_size = 1.0
[node name="TouchScreenButton" type="TouchScreenButton" parent="."]
visibility/opacity = 0.0
transform/pos = Vector2( 3.70129, 1.18372 )
transform/scale = Vector2( 7.1743, 12.9134 )
normal = ExtResource( 4 )
pressed = null
bitmask = null
shape = null
shape_centered = true
shape_visible = true
passby_press = false
action = ""
visibility_mode = 0
[node name="PointsHadler" type="Control" parent="."]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = -16.0
margin/left = 0.0
margin/top = 121.0
margin/right = 704.0
margin/right = 720.0
margin/bottom = 376.0
script/script = ExtResource( 5 )
script/script = ExtResource( 4 )
[node name="TotalPoints" type="Label" parent="PointsHadler"]
Expand All @@ -121,11 +109,11 @@ focus/ignore_mouse = true
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 0
margin/left = 343.0
margin/left = 360.0
margin/top = 67.0
margin/right = -376.0
margin/right = -359.0
margin/bottom = 98.0
custom_fonts/font = ExtResource( 6 )
custom_fonts/font = ExtResource( 5 )
custom_colors/font_color = Color( 1, 0.941406, 0.964752, 1 )
text = "0"
align = 1
Expand Down Expand Up @@ -167,15 +155,15 @@ margin/left = 358.0
margin/top = 13.0
margin/right = -361.0
margin/bottom = 1184.0
custom_fonts/font = ExtResource( 6 )
custom_fonts/font = ExtResource( 5 )
custom_colors/font_color = Color( 1, 0.941406, 0.964752, 1 )
text = "Nivel"
align = 1
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="ButtonSound" parent="." instance=ExtResource( 7 )]
[node name="ButtonSound" parent="." instance=ExtResource( 6 )]
margin/left = 549.0
margin/top = -33.0
Expand All @@ -184,14 +172,12 @@ margin/bottom = 14.0
config_name = "sound_enabled"
pattern_name = "sound_button_pattern"
[node name="ButtonShadow" parent="." instance=ExtResource( 7 )]
[node name="ButtonShadow" parent="." instance=ExtResource( 6 )]
margin/left = -59.0
margin/top = -33.0
margin/right = 37.0
margin/bottom = 14.0
script/script = ExtResource( 8 )
[connection signal="pressed" from="TouchScreenButton" to="." method="_on_TouchScreenButton_pressed"]
script/script = ExtResource( 7 )
6 changes: 3 additions & 3 deletions engine.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ force_fps=60

[display]

stretch_aspect="expand"
stretch_mode="2d"
resizable=true
width=720
height=1280
resizable=true
orientation="portrait"
emulate_touchscreen=true
stretch_mode="2d"
stretch_aspect="ignore"

[physics]

Expand Down
10 changes: 4 additions & 6 deletions input_handler.gd
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ func handle_pos (pos):
game.lock_rot();

func _input(event):
if (event.type==InputEvent.SCREEN_TOUCH):
last_pos = get_local_mouse_pos().x
game.lock_rot();
if (event.type==InputEvent.SCREEN_DRAG):
handle_pos (float(-(event.pos.x - last_pos) * 100) / width)
handle_pos (float(-(get_local_mouse_pos().x - last_pos) * 100) / width)

func _on_TouchScreenButton_pressed():
last_pos = get_local_mouse_pos().x
game.lock_rot();


0 comments on commit 1de9dcf

Please sign in to comment.