Skip to content

Commit

Permalink
Fix Ms/S button not setting properly at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
ObaniGemini committed Jul 28, 2020
1 parent 729dd67 commit 5105182
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions Main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ onready var BPM = $Container/BPM/LineEdit
onready var Time = $Container/Time/LineEdit
onready var Hz = $Container/Hz/LineEdit
onready var Speed = $Speed/current
onready var TimeUnitButton = $Container/Time/HBoxContainer/Button

var speed = 1
var timeUnit = 1
Expand All @@ -28,7 +29,8 @@ func _ready():
SM.load_config()

set_speed( SM.config.speedIndex )
timeUnit = SM.config.timeUnit
if( timeUnit != SM.config.timeUnit ):
switchTimeUnit()
BPM.text = SM.config.BPM
Time.text = SM.config.Time
Hz.text = SM.config.Hz
Expand Down Expand Up @@ -113,11 +115,11 @@ func set_speed( value ):

func switchTimeUnit():
if( timeUnit == 1 ):
$Container/Time/HBoxContainer/Button.text = "Ms"
TimeUnitButton.text = "Ms"
$Container/Time/Sub.text = "Milliseconds"
timeUnit = 1000
else:
$Container/Time/HBoxContainer/Button.text = "S"
TimeUnitButton.text = "S"
$Container/Time/Sub.text = "Seconds"
timeUnit = 1

Expand Down
4 changes: 2 additions & 2 deletions Window.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ margin_left = 39.0
margin_right = 85.0
margin_bottom = 40.0
rect_min_size = Vector2( 46, 40 )
text = "Ms"
text = "S"

[node name="Sub" type="Label" parent="Container/Time"]
modulate = Color( 1, 1, 1, 0.784314 )
margin_top = 74.0
margin_right = 125.0
margin_bottom = 91.0
custom_fonts/font = ExtResource( 2 )
text = "Milliseconds"
text = "Seconds"
align = 1

[node name="LineEdit" type="LineEdit" parent="Container/Time"]
Expand Down

0 comments on commit 5105182

Please sign in to comment.