adding automatic theme switching

This commit is contained in:
betalars 2024-02-06 21:58:29 +01:00
parent 6755b6ab3d
commit 477bf3b1a4
15 changed files with 88 additions and 1543 deletions

Binary file not shown.

View File

@ -0,0 +1,33 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://bgno8yoimx87x"
path="res://.godot/imported/AtkinsonHyperlegible-Italic.ttf-2a9077906a1b44d4c09220b52c0f17c1.fontdata"
[deps]
source_file="res://import/fonts/AtkinsonHyperlegible-Italic.ttf"
dest_files=["res://.godot/imported/AtkinsonHyperlegible-Italic.ttf-2a9077906a1b44d4c09220b52c0f17c1.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

File diff suppressed because one or more lines are too long

View File

@ -93,6 +93,9 @@ func _ready():
$BackgroundSprite.frame = text.hash() % $BackgroundSprite.sprite_frames.get_frame_count($BackgroundSprite.animation)
$Label.text = self.text
$Label.theme = State.current_main_theme
State.theme_changed.connect(func change_theme(new_theme): $Label.theme = new_theme)
wiggle_pos = float(text.hash() % 100)
if not Engine.is_editor_hint():
_handle_wiggle(0)

View File

@ -1,8 +1,7 @@
[gd_scene load_steps=11 format=3 uid="uid://dy5rd437h5hsw"]
[gd_scene load_steps=10 format=3 uid="uid://dy5rd437h5hsw"]
[ext_resource type="Script" path="res://logic-scenes/board/card.gd" id="1_emip0"]
[ext_resource type="Texture2D" uid="uid://sv0nhkkur1tt" path="res://logic-scenes/board/card-textures/cardsheet.png" id="2_ioijn"]
[ext_resource type="Theme" uid="uid://b056fn288p8ha" path="res://logic-scenes/themes/easy-handwriting.theme" id="3_rktsa"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_foovg"]
radius = 110.0
@ -64,7 +63,7 @@ shape = SubResource("CapsuleShape2D_foovg")
clip_children = 2
scale = Vector2(0.6, 0.6)
sprite_frames = SubResource("SpriteFrames_ckivt")
frame = 3
frame = 1
[node name="Label" type="Label" parent="."]
anchors_preset = 8
@ -79,7 +78,6 @@ offset_bottom = 88.0
grow_horizontal = 2
grow_vertical = 2
rotation = 0.00872665
theme = ExtResource("3_rktsa")
theme_type_variation = &"card_text"
autowrap_mode = 3

View File

@ -64,6 +64,8 @@ func _ready() -> void:
$Content/Label.text = self.text
$Content/BackgroundSprite.frame = text.hash() % $Content/BackgroundSprite.sprite_frames.get_frame_count($Content/BackgroundSprite.animation)
$Content/Label.theme = State.current_main_theme
State.theme_changed.connect(func change_theme(new_theme): $Content/Label.theme = new_theme)
func replace_with(sticky_note: StickyNote):
self.text = sticky_note.text

View File

@ -1,8 +1,7 @@
[gd_scene load_steps=18 format=3 uid="uid://vkcdj8c3ytbq"]
[gd_scene load_steps=17 format=3 uid="uid://vkcdj8c3ytbq"]
[ext_resource type="Script" path="res://logic-scenes/board/sticky-note.gd" id="1_yvh5n"]
[ext_resource type="Texture2D" uid="uid://c8ckkjmdegyis" path="res://logic-scenes/board/card-textures/postitsheet.png" id="2_j17jn"]
[ext_resource type="Theme" uid="uid://b056fn288p8ha" path="res://logic-scenes/themes/easy-handwriting.theme" id="3_hu2as"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_ml4q7"]
radius = 48.0
@ -130,7 +129,6 @@ offset_right = 239.0
offset_bottom = 47.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("3_hu2as")
theme_type_variation = &"card_text"
vertical_alignment = 1
autowrap_mode = 3

View File

@ -7,3 +7,7 @@ extends Panel
else:
has_stage = false
State.drop_own_focus(self)
func _ready():
theme = State.current_main_theme
State.theme_changed.connect(func change_theme(new_theme): theme = new_theme)

View File

@ -1,7 +1,7 @@
[gd_scene load_steps=11 format=3 uid="uid://gldtxysavetf"]
[ext_resource type="Texture2D" uid="uid://d0ucjqi8tx6vt" path="res://import/interface-elements/frame.png" id="1_8giso"]
[ext_resource type="Theme" uid="uid://rtfhl42vrsq0" path="res://logic-scenes/themes/hyperlegible.theme" id="1_x555l"]
[ext_resource type="Theme" uid="uid://dla4kae5kbwdh" path="res://logic-scenes/themes/system.theme" id="1_ot7jp"]
[ext_resource type="Script" path="res://logic-scenes/startup/volume_sliders.gd" id="3_q2gbh"]
[ext_resource type="Texture2D" uid="uid://bwicl5q0lw06q" path="res://import/interface-elements/bottom.png" id="3_s5ssh"]
[ext_resource type="PackedScene" uid="uid://dy5rd437h5hsw" path="res://logic-scenes/board/card.tscn" id="5_7c77g"]
@ -13,26 +13,30 @@ script/source = "extends Panel
func _ready():
theme = State.current_main_theme
State.theme_changed.connect(func change_theme(new_theme): theme = new_theme)
func starting():
$\"CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility/navbuttons/Next\".grab_focus()
func _on_reduce_motion_toggled(toggled_on):
State.reduce_motion = toggled_on
# toggle for disable rendering
func _on_disable_rendering_toggled(button_pressed):
State.disable_rendering = button_pressed
func _on_disable_rendering_toggled(toggled_on):
State.disable_rendering = toggled_on
# toggle for simplified controls
func _on_simplified_controls_toggled(button_pressed):
State.simplified_navigation = button_pressed # this is how you reach the global state
show_navigation_buttons.disabled = not button_pressed # if simpl. controls was toggled - disabled = false
func _on_simplified_controls_toggled(toggled_on):
State.simplified_navigation = toggled_on # this is how you reach the global state
show_navigation_buttons.disabled = not toggled_on # if simpl. controls was toggled - disabled = false
# toggle for show nav buttons
func _on_show_nav_ui_toggled(button_pressed):
State.show_navigation_buttons = button_pressed
func _on_show_nav_ui_toggled(toggled_on):
State.show_navigation_buttons = toggled_on
# toggle streaming notes
func _on_streaming_notes_toggled(button_pressed):
State.streaming_content_notes = button_pressed
func _on_streaming_notes_toggled(toggled_on):
State.streaming_content_notes = toggled_on
# select font
@ -40,23 +44,22 @@ func _on_streaming_notes_toggled(button_pressed):
func _on_font_style_selected(index):
match index:
0:
print_debug(\"messy handwriting selected\")
#self.theme.set_font(\"NanumBrushScript.ttf\")
return
1:
State.current_main_theme = preload(\"res://logic-scenes/themes/easy-handwriting.theme\")
print_debug(\"easy handwriting selected\")
#owner.theme.set_font(\"NanumPenScript.ttf\")
return
2:
print_debug(\"legible serif selected\")
State.current_main_theme = preload(\"res://logic-scenes/themes/serif.theme\")
#owner.theme.set_font(\"Eczar-VariableFont_wght.ttf\")
return
3:
print_debug(\"hyperlegible sans selected\")
State.current_main_theme = preload(\"res://logic-scenes/themes/hyperlegible.theme\")
#owner.theme.set_font(\"AtkinsonHyperlegible.ttf\")
return
4:
print_debug(\"system front selected\")
State.current_main_theme = preload(\"res://logic-scenes/themes/system.theme\")
#owner.theme.set_font(SystemFont.fallbacks[0])
return
@ -123,6 +126,9 @@ func hide():
self_tween.tween_property(self, \"modulate\", Color(1, 1, 1, 0), .5)
await self_tween.finished
self.visible = false
"
[sub_resource type="GDScript" id="GDScript_ia432"]
@ -211,7 +217,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_x555l")
theme = ExtResource("1_ot7jp")
script = SubResource("GDScript_a78qq")
[node name="Label" type="Label" parent="."]
@ -271,21 +277,25 @@ text = "physical Accessibility"
[node name="Label4" type="Label" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility"]
layout_mode = 2
text = "sorry none of these work yet :c"
text = "Greyed-out items do not work yet."
[node name="Container2" type="VBoxContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility"]
layout_mode = 2
[node name="reduce motion" type="CheckBox" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility/Container2"]
layout_mode = 2
text = "reduce motion"
[node name="Screenreader" type="CheckBox" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility/Container2"]
layout_mode = 2
disabled = true
text = "activate Screenreader"
text = "use Screenreader"
script = SubResource("GDScript_v567h")
[node name="margin2" type="MarginContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility/Container2"]
layout_mode = 2
[node name="show nav buttons" type="CheckBox" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility/Container2/margin2"]
[node name="disable rendering" type="CheckBox" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility/Container2/margin2"]
layout_mode = 2
disabled = true
text = "disable rendering"
@ -322,9 +332,10 @@ item_count = 5
selected = 1
popup/item_0/text = "messy handwriting"
popup/item_0/id = 0
popup/item_0/disabled = true
popup/item_1/text = "easy handwriting"
popup/item_1/id = 1
popup/item_2/text = "legible serif"
popup/item_2/text = "serif"
popup/item_2/id = 2
popup/item_3/text = "hyperlegible sans"
popup/item_3/id = 3
@ -363,6 +374,10 @@ layout_mode = 2
[node name="HSlider" type="HSlider" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility/Container2/GridContainer"]
custom_minimum_size = Vector2(0, 60)
layout_mode = 2
min_value = 0.5
max_value = 3.0
step = 0.0
value = 1.0
editable = false
[node name="navbuttons" type="VSplitContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility"]
@ -701,8 +716,9 @@ text = "I stream this game, please show content notes."
position = Vector2(1491, 598)
text = "I never put in much effort for Homework"
[connection signal="toggled" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility/Container2/reduce motion" to="." method="_on_reduce_motion_toggled"]
[connection signal="toggled" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility/Container2/Screenreader" to="CenterContainer/PanelContainer/VBoxContainer/TabContainer" method="_on_screenreader_toggled"]
[connection signal="toggled" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility/Container2/margin2/show nav buttons" to="." method="_on_disable_rendering_toggled"]
[connection signal="toggled" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility/Container2/margin2/disable rendering" to="." method="_on_disable_rendering_toggled"]
[connection signal="toggled" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility/Container2/simplified controls" to="." method="_on_simplified_controls_toggled"]
[connection signal="toggled" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility/Container2/margin/show nav ui" to="." method="_on_show_nav_ui_toggled"]
[connection signal="item_selected" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility/Container2/GridContainer/font settings" to="." method="_on_font_style_selected"]

Binary file not shown.

Binary file not shown.

View File

@ -15,7 +15,12 @@ var allow_skipping: bool = false
var stage_list:Array = []
var lock_focus: bool = false
var current_main_theme:Theme = preload("res://logic-scenes/themes/easy-handwriting.theme")
signal theme_changed
var current_main_theme:Theme = preload("res://logic-scenes/themes/easy-handwriting.theme"):
set(theme):
current_main_theme = theme
emit_signal("theme_changed", theme)
func _ready():
for child in get_parent().get_children():