Skip to content

Commit ac5f565

Browse files
committed
Improved the experimental visualizer
2 parents e04ca4b + 2684a9a commit ac5f565

18 files changed

+746
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@
3434
/Syllabore/.vs/
3535
/Syllabore/Syllabore.Example/bin/Debug/net7.0
3636
/Syllabore/Syllabore.Tests/bin/Debug/net5.0
37+
/Syllabore/Syllabore.Visualizer/.vs/ProjectEvaluation
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[gd_resource type="LabelSettings" load_steps=2 format=3 uid="uid://bk6ghtaibqhya"]
2+
3+
[ext_resource type="FontFile" uid="uid://dpthqbkpqte48" path="res://Fonts/Kenney Pixel.ttf" id="1_g83er"]
4+
5+
[resource]
6+
font = ExtResource("1_g83er")
7+
font_size = 18
8+
font_color = Color(0.509804, 0.509804, 0.509804, 1)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
The license for the files '../Fonts/Kenney Mini.ttf'
2+
and '../Fonts/Kenney Pixel.ttf' is provided below.
3+
4+
---
5+
6+
Font package (free)
7+
8+
Created/distributed by Kenney (www.kenney.nl)
9+
10+
------------------------------
11+
12+
License: (Creative Commons Zero, CC0)
13+
http://creativecommons.org/publicdomain/zero/1.0/
14+
15+
This content is free to use in personal, educational and commercial projects.
16+
Support us by crediting (Kenney or www.kenney.nl), this is not mandatory.
17+
18+
------------------------------
19+
20+
Donate: http://support.kenney.nl
21+
Request: http://request.kenney.nl
22+
Patreon: http://patreon.com/kenney/
23+
24+
Follow on Twitter for updates:
25+
@KenneyNL
Binary file not shown.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[remap]
2+
3+
importer="font_data_dynamic"
4+
type="FontFile"
5+
uid="uid://8dcyb60yu3ub"
6+
path="res://.godot/imported/Kenney Mini.ttf-cae9f4188ec099302813ee760aa78bae.fontdata"
7+
8+
[deps]
9+
10+
source_file="res://Fonts/Kenney Mini.ttf"
11+
dest_files=["res://.godot/imported/Kenney Mini.ttf-cae9f4188ec099302813ee760aa78bae.fontdata"]
12+
13+
[params]
14+
15+
Rendering=null
16+
antialiasing=1
17+
generate_mipmaps=false
18+
multichannel_signed_distance_field=false
19+
msdf_pixel_range=8
20+
msdf_size=48
21+
allow_system_fallback=true
22+
force_autohinter=false
23+
hinting=1
24+
subpixel_positioning=1
25+
oversampling=0.0
26+
Fallbacks=null
27+
fallbacks=[]
28+
Compress=null
29+
compress=true
30+
preload=[]
31+
language_support={}
32+
script_support={}
33+
opentype_features={}
Binary file not shown.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[remap]
2+
3+
importer="font_data_dynamic"
4+
type="FontFile"
5+
uid="uid://dpthqbkpqte48"
6+
path="res://.godot/imported/Kenney Pixel.ttf-81d50fd9036595aeb2ef7347717d979e.fontdata"
7+
8+
[deps]
9+
10+
source_file="res://Fonts/Kenney Pixel.ttf"
11+
dest_files=["res://.godot/imported/Kenney Pixel.ttf-81d50fd9036595aeb2ef7347717d979e.fontdata"]
12+
13+
[params]
14+
15+
Rendering=null
16+
antialiasing=1
17+
generate_mipmaps=false
18+
multichannel_signed_distance_field=false
19+
msdf_pixel_range=8
20+
msdf_size=48
21+
allow_system_fallback=true
22+
force_autohinter=false
23+
hinting=1
24+
subpixel_positioning=1
25+
oversampling=0.0
26+
Fallbacks=null
27+
fallbacks=[]
28+
Compress=null
29+
compress=true
30+
preload=[]
31+
language_support={}
32+
script_support={}
33+
opentype_features={}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
using Godot;
2+
using System;
3+
4+
public partial class GraphemeEditor : Control
5+
{
6+
public event Action GraphemeEditorChanged;
7+
8+
protected virtual void OnGraphemeEditorChanged()
9+
{
10+
GraphemeEditorChanged?.Invoke();
11+
}
12+
13+
protected virtual void OnVSliderChanged(float value)
14+
{
15+
this.UpdatePercentageLabel(value);
16+
GraphemeEditorChanged?.Invoke();
17+
}
18+
19+
protected virtual void OnCheckBoxToggled(bool buttonPressed)
20+
{
21+
this.UpdateEnabledStatus();
22+
this.GetNode<CheckBox>("LeftPanel/CheckBox").ReleaseFocus();
23+
GraphemeEditorChanged?.Invoke();
24+
}
25+
26+
public string LabelText
27+
{
28+
get
29+
{
30+
return this.GetNode<Label>("LeftPanel/Label").Text;
31+
}
32+
set
33+
{
34+
this.GetNode<Label>("LeftPanel/Label").Text = value;
35+
}
36+
}
37+
38+
public string Text
39+
{
40+
get
41+
{
42+
return this.GetNode<TextEdit>("LeftPanel/TextEdit").Text;
43+
}
44+
set
45+
{
46+
47+
this.GetNode<TextEdit>("LeftPanel/TextEdit").Text = value;
48+
}
49+
}
50+
51+
public bool Enabled
52+
{
53+
get
54+
{
55+
return this.GetNode<CheckBox>("LeftPanel/CheckBox").ButtonPressed;
56+
}
57+
set
58+
{
59+
this.GetNode<CheckBox>("LeftPanel/CheckBox").ButtonPressed = value;
60+
this.UpdateEnabledStatus();
61+
}
62+
}
63+
64+
public double Probability
65+
{
66+
get
67+
{
68+
var vSlider = this.GetNode<VSlider>("RightPanel/VSlider");
69+
return vSlider.Value / vSlider.MaxValue; // Normalize to [0,1]
70+
}
71+
set
72+
{
73+
var vSlider = this.GetNode<VSlider>("RightPanel/VSlider");
74+
this.GetNode<VSlider>("RightPanel/VSlider").Value = value * vSlider.MaxValue; // Normalize to [0,100]
75+
this.UpdatePercentageLabel(value * vSlider.MaxValue);
76+
}
77+
}
78+
79+
public void UpdateEnabledStatus()
80+
{
81+
this.GetNode<TextEdit>("LeftPanel/TextEdit").Editable = this.Enabled;
82+
this.GetNode<VSlider>("RightPanel/VSlider").Editable = this.Enabled;
83+
}
84+
85+
private void UpdatePercentageLabel(double value)
86+
{
87+
this.GetNode<Label>("RightPanel/PercentageLabel").Text = $"{(int)value}%";
88+
}
89+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
[gd_scene load_steps=5 format=3 uid="uid://dfh0hshtdjms1"]
2+
3+
[ext_resource type="Script" path="res://GraphemeEditor.cs" id="1_7by6n"]
4+
[ext_resource type="LabelSettings" uid="uid://bk6ghtaibqhya" path="res://EditorLabelGray.tres" id="1_886yt"]
5+
[ext_resource type="FontFile" uid="uid://8dcyb60yu3ub" path="res://Fonts/Kenney Mini.ttf" id="3_5e4ym"]
6+
7+
[sub_resource type="LabelSettings" id="LabelSettings_yvqpb"]
8+
font = ExtResource("3_5e4ym")
9+
10+
[node name="GraphemeEditor" type="Control"]
11+
layout_mode = 3
12+
anchors_preset = 15
13+
anchor_right = 1.0
14+
anchor_bottom = 1.0
15+
offset_right = -940.0
16+
offset_bottom = -700.0
17+
grow_horizontal = 2
18+
grow_vertical = 2
19+
script = ExtResource("1_7by6n")
20+
21+
[node name="LeftPanel" type="Panel" parent="."]
22+
layout_mode = 0
23+
offset_right = 170.0
24+
offset_bottom = 70.0
25+
26+
[node name="Label" type="Label" parent="LeftPanel"]
27+
layout_mode = 0
28+
offset_left = 26.0
29+
offset_top = 2.0
30+
offset_right = 166.0
31+
offset_bottom = 25.0
32+
text = "Grapheme Label"
33+
label_settings = ExtResource("1_886yt")
34+
vertical_alignment = 1
35+
36+
[node name="TextEdit" type="TextEdit" parent="LeftPanel"]
37+
layout_mode = 0
38+
offset_left = 5.0
39+
offset_top = 25.0
40+
offset_right = 165.0
41+
offset_bottom = 62.0
42+
43+
[node name="CheckBox" type="CheckBox" parent="LeftPanel"]
44+
layout_mode = 0
45+
offset_top = 2.0
46+
offset_right = 24.0
47+
offset_bottom = 26.0
48+
49+
[node name="RightPanel" type="Panel" parent="."]
50+
layout_mode = 0
51+
offset_left = 177.0
52+
offset_right = 252.0
53+
offset_bottom = 70.0
54+
55+
[node name="VSlider" type="VSlider" parent="RightPanel"]
56+
layout_mode = 0
57+
offset_left = 1.0
58+
offset_top = 5.0
59+
offset_right = 27.0
60+
offset_bottom = 62.0
61+
value = 100.0
62+
63+
[node name="PercentageLabel" type="Label" parent="RightPanel"]
64+
layout_mode = 0
65+
offset_left = 25.0
66+
offset_top = 9.0
67+
offset_right = 67.0
68+
offset_bottom = 61.0
69+
text = "100%"
70+
label_settings = SubResource("LabelSettings_yvqpb")
71+
horizontal_alignment = 1
72+
vertical_alignment = 1
73+
74+
[node name="Label" type="Label" parent="RightPanel"]
75+
visible = false
76+
layout_mode = 0
77+
offset_left = 1.0
78+
offset_top = 2.0
79+
offset_right = 74.0
80+
offset_bottom = 25.0
81+
text = "Probability"
82+
label_settings = ExtResource("1_886yt")
83+
horizontal_alignment = 1
84+
vertical_alignment = 1
85+
86+
[connection signal="text_changed" from="LeftPanel/TextEdit" to="." method="OnGraphemeEditorChanged"]
87+
[connection signal="toggled" from="LeftPanel/CheckBox" to="." method="OnCheckBoxToggled"]
88+
[connection signal="value_changed" from="RightPanel/VSlider" to="." method="OnVSliderChanged"]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace Syllabore.Visualizer
8+
{
9+
public interface ITemporalController
10+
{
11+
public bool IsSlowed { get; set; }
12+
public bool IsPaused { get; set; }
13+
14+
}
15+
}

0 commit comments

Comments
 (0)