Skip to content

Commit

Permalink
feat: use Project-wide custom theme and tweak theme.
Browse files Browse the repository at this point in the history
- theme_main: add LabelSmall variation
  • Loading branch information
davcri committed Jan 6, 2024
1 parent 4a5a8da commit 35f9134
Show file tree
Hide file tree
Showing 12 changed files with 198 additions and 236 deletions.
2 changes: 1 addition & 1 deletion addons/ggt-core/transitions/transitions.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ signal transition_covered_screen


@onready var anim: AnimationPlayer = $AnimationPlayer
@onready var progress: Control = $ColorRect/Progress
@onready var progress: Control = $ColorRect/MarginContainer/Progress

var target_progress: float = 0.0
var config = preload("res://addons/ggt-core/config.tres")
Expand Down
160 changes: 36 additions & 124 deletions addons/ggt-core/transitions/transitions.tscn
Original file line number Diff line number Diff line change
@@ -1,47 +1,9 @@
[gd_scene load_steps=15 format=3 uid="uid://82fiitkfc6wn"]
[gd_scene load_steps=11 format=3 uid="uid://82fiitkfc6wn"]

[ext_resource type="Script" path="res://addons/ggt-core/transitions/transitions.gd" id="1_frf46"]
[ext_resource type="Script" path="res://addons/ggt-core/transitions/progress.gd" id="2_2fso7"]
[ext_resource type="Texture2D" uid="uid://dtwpm3uclaspj" path="res://assets/sprites/icon.png" id="3_704bp"]
[ext_resource type="FontFile" uid="uid://cawekr44fruhm" path="res://assets/fonts/open-sans/open-sans-regular.ttf" id="4_acliu"]

[sub_resource type="Animation" id="9"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(-20, -79)]
}

[sub_resource type="Animation" id="1"]
resource_name = "idle"
length = 2.0
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:rotation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.2, 0.4, 0.6, 0.8, 1, 1.2, 2),
"transitions": PackedFloat32Array(0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5),
"update": 0,
"values": [3.48787e-16, 3.48787e-16, 3.14159, 0.0, 0.0, -3.14159, 0.0, 0.0]
}

[sub_resource type="AnimationLibrary" id="AnimationLibrary_hvhmj"]
_data = {
"RESET": SubResource("9"),
"idle": SubResource("1")
}
[ext_resource type="FontFile" uid="uid://cawekr44fruhm" path="res://assets/fonts/open-sans/open-sans-regular.ttf" id="1"]
[ext_resource type="Texture2D" uid="uid://dtwpm3uclaspj" path="res://assets/sprites/icon.png" id="2"]
[ext_resource type="Script" path="res://addons/ggt-core/transitions/progress.gd" id="3"]
[ext_resource type="Script" path="res://addons/ggt-core/transitions/transitions/transitions.gd" id="4"]

[sub_resource type="FontFile" id="4"]
fallbacks = Array[Font]([ExtResource("4_acliu")])
Expand All @@ -51,6 +13,14 @@ cache/0/16/0/underline_position = 0.0
cache/0/16/0/underline_thickness = 0.0
cache/0/16/0/scale = 1.0
cache/0/16/0/kerning_overrides/16/0 = Vector2(0, 0)
cache/0/16/0/kerning_overrides/28/0 = Vector2(0, 0)
cache/0/28/0/ascent = 0.0
cache/0/28/0/descent = 0.0
cache/0/28/0/underline_position = 0.0
cache/0/28/0/underline_thickness = 0.0
cache/0/28/0/scale = 1.0
cache/0/28/0/kerning_overrides/16/0 = Vector2(0, 0)
cache/0/28/0/kerning_overrides/28/0 = Vector2(0, 0)

[sub_resource type="Animation" id="10"]
length = 0.001
Expand Down Expand Up @@ -81,7 +51,7 @@ tracks/1/keys = {
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("ColorRect/Progress/Spinner:modulate")
tracks/2/path = NodePath("ColorRect/MarginContainer/Progress/ProgressBar:modulate")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
Expand All @@ -90,18 +60,6 @@ tracks/2/keys = {
"update": 0,
"values": [Color(1, 1, 1, 0)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("ColorRect/Progress/ProgressBar:modulate")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0)]
}

[sub_resource type="Animation" id="5"]
length = 0.001
Expand Down Expand Up @@ -161,7 +119,7 @@ tracks/1/keys = {
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("ColorRect/Progress/Spinner:modulate")
tracks/2/path = NodePath("ColorRect/MarginContainer/Progress/ProgressBar:modulate")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
Expand All @@ -170,18 +128,6 @@ tracks/2/keys = {
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("ColorRect/Progress/ProgressBar:modulate")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.2, 0.3),
"transitions": PackedFloat32Array(1, 2, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
}

[sub_resource type="Animation" id="7"]
length = 0.3
Expand Down Expand Up @@ -213,7 +159,7 @@ tracks/1/keys = {
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("ColorRect/Progress/Spinner:modulate")
tracks/2/path = NodePath("ColorRect/MarginContainer/Progress/ProgressBar:modulate")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
Expand All @@ -222,18 +168,6 @@ tracks/2/keys = {
"update": 0,
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("ColorRect/Progress/ProgressBar:modulate")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(0.5, 1),
"update": 0,
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}

[sub_resource type="Animation" id="8"]
length = 0.001
Expand Down Expand Up @@ -284,64 +218,42 @@ anchor_bottom = 1.0
mouse_filter = 2
color = Color(0.0862745, 0.0862745, 0.0862745, 0)

[node name="Progress" type="Control" parent="ColorRect"]
anchors_preset = 0
anchor_left = 1.0
anchor_top = 1.0
[node name="MarginContainer" type="MarginContainer" parent="ColorRect"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -141.0
offset_top = -55.0
offset_right = -101.0
offset_bottom = -15.0
mouse_filter = 2
script = ExtResource("2_2fso7")

[node name="Spinner" type="TextureRect" parent="ColorRect/Progress"]
modulate = Color(1, 1, 1, 0)
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -40.0
offset_top = -99.0
offset_right = 40.0
offset_bottom = -19.0
grow_horizontal = 2
grow_vertical = 2
scale = Vector2(0.6, 0.6)
pivot_offset = Vector2(40, 40)
mouse_filter = 2
texture = ExtResource("3_704bp")

[node name="AnimationPlayer" type="AnimationPlayer" parent="ColorRect/Progress/Spinner"]
autoplay = "idle"
libraries = {
"": SubResource("AnimationLibrary_hvhmj")
}
[node name="Progress" type="Control" parent="ColorRect/MarginContainer"]
layout_mode = 2
mouse_filter = 2
script = ExtResource("3")

[node name="ProgressBar" type="ProgressBar" parent="ColorRect/Progress"]
[node name="ProgressBar" type="ProgressBar" parent="ColorRect/MarginContainer/Progress"]
modulate = Color(1, 1, 1, 0)
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -85.0
offset_top = -11.0
offset_right = 85.0
offset_bottom = 11.0
layout_mode = 1
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -170.0
offset_top = -27.0
grow_horizontal = 0
grow_vertical = 0
mouse_filter = 2
theme_override_fonts/font = SubResource("4")
theme_override_font_sizes/font_size = 16
max_value = 1.0

[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "transparent"
libraries = {
"": SubResource("AnimationLibrary_y1dc8")
}
autoplay = "transparent"

[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_AnimationPlayer_animation_finished"]
[connection signal="animation_started" from="AnimationPlayer" to="." method="_on_AnimationPlayer_animation_started"]
17 changes: 0 additions & 17 deletions addons/ggt-debug-shortcuts/shortcuts/pause_game.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,10 @@
[sub_resource type="GDScript" id="GDScript_gxkwo"]
script/source = "extends Node


func _ready():
$CanvasLayer/PausedHint.visible = get_tree().paused


func _input(event):
if event.is_action_released(\"debug_pause_game\"):
get_tree().paused = !get_tree().paused


func _process(delta):
$CanvasLayer/PausedHint.visible = get_tree().paused
"
[node name="PauseGame" type="Node"]
script = SubResource("GDScript_gxkwo")
[node name="CanvasLayer" type="CanvasLayer" parent="."]
layer = 128
[node name="PausedHint" type="Label" parent="CanvasLayer"]
offset_right = 104.0
offset_bottom = 26.0
text = "TREE PAUSED"
7 changes: 0 additions & 7 deletions assets/ui-theme.tres

This file was deleted.

4 changes: 4 additions & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ window/stretch/aspect="expand"

enabled=PackedStringArray("res://addons/ggt-core/plugin.cfg", "res://addons/ggt-debug-shortcuts/plugin.cfg")

[gui]

theme/custom="res://resources/theme/theme-main.tres"

[input]

pause={
Expand Down
13 changes: 13 additions & 0 deletions resources/theme/theme-main.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[gd_resource type="Theme" load_steps=2 format=3 uid="uid://ducfept6pmkkm"]

[ext_resource type="FontFile" uid="uid://cawekr44fruhm" path="res://assets/fonts/open-sans/open-sans-regular.ttf" id="1_6yttj"]

[resource]
default_font = ExtResource("1_6yttj")
default_font_size = 20
LabelSmall/base_type = &"Label"
LabelSmall/font_sizes/font_size = 16
MarginContainer/constants/margin_bottom = 32
MarginContainer/constants/margin_left = 32
MarginContainer/constants/margin_right = 32
MarginContainer/constants/margin_top = 32
38 changes: 32 additions & 6 deletions scenes/gameplay/pause-layer/pause-layer.gd
Original file line number Diff line number Diff line change
@@ -1,12 +1,38 @@
extends CanvasLayer

@onready var pause := $PauseOverlay
@onready var pause_button := $PauseButton
@onready var resume_option := $PauseOverlay/VBoxOptions/Resume
@onready var pause := self
@onready var pause_button := $MarginContainer/Control/PauseButton
@onready var resume_option := $MarginContainer/Control/VBoxOptions/Resume
@onready var label = $MarginContainer/Control/Label
@onready var pause_options = $MarginContainer/Control/VBoxOptions
@onready var color_rect = $ColorRect

@onready var nodes_grp1 = [pause_button, label] # should be visible during gamemplay and hidden during pause
@onready var nodes_grp2 = [pause_options, color_rect] # should be visible only in pause menu


func _ready():
pause.hide()
pause_hide()


func pause_show():
for n in nodes_grp1:
print("hiding ", n.name)
n.hide()
for n in nodes_grp2:
n.show()


func pause_hide():
for n in nodes_grp1:
if n:
print("showing ", n.name)
n.show()

for n in nodes_grp2:
if n:
print("hiding ", n.name)
n.hide()


# when the node is removed from the tree (mostly because of a scene change)
Expand All @@ -27,13 +53,13 @@ func _unhandled_input(event):

func resume():
get_tree().paused = false
pause.hide()
pause_hide()


func pause_game():
resume_option.grab_focus()
get_tree().paused = true
pause.show()
pause_show()


func _on_Resume_pressed():
Expand Down
Loading

0 comments on commit 35f9134

Please sign in to comment.