add buttons with custom font
This commit is contained in:
		
							parent
							
								
									d842a1fa4b
								
							
						
					
					
						commit
						1ac4a12b5e
					
				
					 5 changed files with 78 additions and 10 deletions
				
			
		
							
								
								
									
										
											BIN
										
									
								
								game/assets/fonts/Montserrat-ExtraBold.otf
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								game/assets/fonts/Montserrat-ExtraBold.otf
									
										
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										7
									
								
								game/assets/fonts/Montserrat-ExtraBolt-48.tres
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								game/assets/fonts/Montserrat-ExtraBolt-48.tres
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,7 @@
 | 
				
			||||||
 | 
					[gd_resource type="DynamicFont" load_steps=2 format=2]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[ext_resource path="res://assets/fonts/Montserrat-ExtraBold.otf" type="DynamicFontData" id=1]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[resource]
 | 
				
			||||||
 | 
					size = 36
 | 
				
			||||||
 | 
					font_data = ExtResource( 1 )
 | 
				
			||||||
| 
						 | 
					@ -22,4 +22,4 @@ func transition_to(state):
 | 
				
			||||||
	assert(state in transitions[current_state])
 | 
						assert(state in transitions[current_state])
 | 
				
			||||||
	var previous_state = current_state
 | 
						var previous_state = current_state
 | 
				
			||||||
	current_state = state
 | 
						current_state = state
 | 
				
			||||||
	emit_signal("state_changed", previous_state, current_state)
 | 
						emit_signal("state_changed", previous_state, current_state)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,9 @@
 | 
				
			||||||
[gd_scene load_steps=6 format=2]
 | 
					[gd_scene load_steps=7 format=2]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[ext_resource path="res://src/Main.gd" type="Script" id=1]
 | 
					[ext_resource path="res://src/Main.gd" type="Script" id=1]
 | 
				
			||||||
[ext_resource path="res://src/Taquin.tscn" type="PackedScene" id=2]
 | 
					[ext_resource path="res://src/Taquin.tscn" type="PackedScene" id=2]
 | 
				
			||||||
[ext_resource path="res://src/GameState.gd" type="Script" id=3]
 | 
					[ext_resource path="res://src/GameState.gd" type="Script" id=3]
 | 
				
			||||||
 | 
					[ext_resource path="res://assets/fonts/Montserrat-ExtraBolt-48.tres" type="DynamicFont" id=4]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[sub_resource type="Shader" id=1]
 | 
					[sub_resource type="Shader" id=1]
 | 
				
			||||||
code = "shader_type canvas_item;
 | 
					code = "shader_type canvas_item;
 | 
				
			||||||
| 
						 | 
					@ -21,6 +22,9 @@ shader_param/blur_amount = null
 | 
				
			||||||
anchor_right = 1.0
 | 
					anchor_right = 1.0
 | 
				
			||||||
anchor_bottom = 1.0
 | 
					anchor_bottom = 1.0
 | 
				
			||||||
script = ExtResource( 1 )
 | 
					script = ExtResource( 1 )
 | 
				
			||||||
 | 
					__meta__ = {
 | 
				
			||||||
 | 
					"_edit_use_anchors_": false
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="HSplitContainer" type="HSplitContainer" parent="."]
 | 
					[node name="HSplitContainer" type="HSplitContainer" parent="."]
 | 
				
			||||||
anchor_right = 1.0
 | 
					anchor_right = 1.0
 | 
				
			||||||
| 
						 | 
					@ -29,6 +33,10 @@ margin_left = 20.0
 | 
				
			||||||
margin_top = 20.0
 | 
					margin_top = 20.0
 | 
				
			||||||
margin_right = -20.0
 | 
					margin_right = -20.0
 | 
				
			||||||
margin_bottom = -20.0
 | 
					margin_bottom = -20.0
 | 
				
			||||||
 | 
					custom_constants/separation = 0
 | 
				
			||||||
 | 
					__meta__ = {
 | 
				
			||||||
 | 
					"_edit_use_anchors_": false
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="Taquin" parent="HSplitContainer" instance=ExtResource( 2 )]
 | 
					[node name="Taquin" parent="HSplitContainer" instance=ExtResource( 2 )]
 | 
				
			||||||
margin_right = 540.0
 | 
					margin_right = 540.0
 | 
				
			||||||
| 
						 | 
					@ -36,22 +44,75 @@ margin_bottom = 560.0
 | 
				
			||||||
rows = 4
 | 
					rows = 4
 | 
				
			||||||
columns = 4
 | 
					columns = 4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="VSplitContainer" type="VSplitContainer" parent="HSplitContainer"]
 | 
					[node name="VSplitContainer" type="VBoxContainer" parent="HSplitContainer"]
 | 
				
			||||||
margin_left = 552.0
 | 
					margin_left = 548.0
 | 
				
			||||||
margin_right = 984.0
 | 
					margin_right = 984.0
 | 
				
			||||||
margin_bottom = 560.0
 | 
					margin_bottom = 560.0
 | 
				
			||||||
 | 
					alignment = 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="Button" type="Button" parent="HSplitContainer/VSplitContainer"]
 | 
					[node name="New Game" type="Button" parent="HSplitContainer/VSplitContainer"]
 | 
				
			||||||
margin_right = 432.0
 | 
					margin_top = 228.0
 | 
				
			||||||
margin_bottom = 560.0
 | 
					margin_right = 436.0
 | 
				
			||||||
text = "New game"
 | 
					margin_bottom = 278.0
 | 
				
			||||||
 | 
					rect_min_size = Vector2( 0, 50 )
 | 
				
			||||||
 | 
					flat = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[node name="ColorRect" type="ColorRect" parent="HSplitContainer/VSplitContainer/New Game"]
 | 
				
			||||||
 | 
					anchor_right = 1.0
 | 
				
			||||||
 | 
					anchor_bottom = 1.0
 | 
				
			||||||
 | 
					color = Color( 0.0705882, 0.294118, 0.396078, 1 )
 | 
				
			||||||
 | 
					__meta__ = {
 | 
				
			||||||
 | 
					"_edit_use_anchors_": false
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[node name="Label" type="Label" parent="HSplitContainer/VSplitContainer/New Game"]
 | 
				
			||||||
 | 
					anchor_right = 1.0
 | 
				
			||||||
 | 
					anchor_bottom = 1.0
 | 
				
			||||||
 | 
					custom_fonts/font = ExtResource( 4 )
 | 
				
			||||||
 | 
					text = "New Game"
 | 
				
			||||||
 | 
					align = 1
 | 
				
			||||||
 | 
					valign = 1
 | 
				
			||||||
 | 
					uppercase = true
 | 
				
			||||||
 | 
					__meta__ = {
 | 
				
			||||||
 | 
					"_edit_use_anchors_": false
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[node name="Hints" type="Button" parent="HSplitContainer/VSplitContainer"]
 | 
				
			||||||
 | 
					margin_top = 282.0
 | 
				
			||||||
 | 
					margin_right = 436.0
 | 
				
			||||||
 | 
					margin_bottom = 332.0
 | 
				
			||||||
 | 
					rect_min_size = Vector2( 0, 50 )
 | 
				
			||||||
 | 
					flat = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[node name="ColorRect" type="ColorRect" parent="HSplitContainer/VSplitContainer/Hints"]
 | 
				
			||||||
 | 
					anchor_right = 1.0
 | 
				
			||||||
 | 
					anchor_bottom = 1.0
 | 
				
			||||||
 | 
					color = Color( 0.0705882, 0.294118, 0.396078, 1 )
 | 
				
			||||||
 | 
					__meta__ = {
 | 
				
			||||||
 | 
					"_edit_use_anchors_": false
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[node name="Label" type="Label" parent="HSplitContainer/VSplitContainer/Hints"]
 | 
				
			||||||
 | 
					anchor_right = 1.0
 | 
				
			||||||
 | 
					anchor_bottom = 1.0
 | 
				
			||||||
 | 
					custom_fonts/font = ExtResource( 4 )
 | 
				
			||||||
 | 
					text = "Hints"
 | 
				
			||||||
 | 
					align = 1
 | 
				
			||||||
 | 
					valign = 1
 | 
				
			||||||
 | 
					uppercase = true
 | 
				
			||||||
 | 
					__meta__ = {
 | 
				
			||||||
 | 
					"_edit_use_anchors_": false
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="ColorRect" type="ColorRect" parent="."]
 | 
					[node name="ColorRect" type="ColorRect" parent="."]
 | 
				
			||||||
material = SubResource( 2 )
 | 
					material = SubResource( 2 )
 | 
				
			||||||
anchor_right = 1.0
 | 
					anchor_right = 1.0
 | 
				
			||||||
anchor_bottom = 1.0
 | 
					anchor_bottom = 1.0
 | 
				
			||||||
 | 
					__meta__ = {
 | 
				
			||||||
 | 
					"_edit_use_anchors_": false
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="GameState" type="Node" parent="."]
 | 
					[node name="GameState" type="Node" parent="."]
 | 
				
			||||||
script = ExtResource( 3 )
 | 
					script = ExtResource( 3 )
 | 
				
			||||||
[connection signal="state_changed" from="GameState" to="HSplitContainer/Taquin" method="_on_GameState_state_changed"]
 | 
					 | 
				
			||||||
[connection signal="state_changed" from="GameState" to="." method="_on_GameState_state_changed"]
 | 
					[connection signal="state_changed" from="GameState" to="." method="_on_GameState_state_changed"]
 | 
				
			||||||
 | 
					[connection signal="state_changed" from="GameState" to="HSplitContainer/Taquin" method="_on_GameState_state_changed"]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -191,4 +191,4 @@ func _on_GameState_state_changed(previous, current):
 | 
				
			||||||
func _on_Timer_timeout():
 | 
					func _on_Timer_timeout():
 | 
				
			||||||
	var game_state = get_node("/root/Main/GameState") as GameState
 | 
						var game_state = get_node("/root/Main/GameState") as GameState
 | 
				
			||||||
	if game_state != null:
 | 
						if game_state != null:
 | 
				
			||||||
		game_state.transition_to(GameState.State.GAME_OVER)
 | 
							game_state.transition_to(GameState.State.GAME_OVER)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue