Skip to content

Commit eeafb4a

Browse files
committed
WIP commit
1 parent acecacb commit eeafb4a

File tree

10 files changed

+89
-4
lines changed

10 files changed

+89
-4
lines changed

Scenes/Routines/PupilRoutine.tscn

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[gd_scene load_steps=3 format=3 uid="uid://cri7377d54bp0"]
2+
3+
[ext_resource type="Script" uid="uid://dd0itqehrvbxh" path="res://Scripts/RoutineInterfaces/LabelRoutineInterface.cs" id="1_y0hwu"]
4+
5+
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_u77vi"]
6+
7+
[node name="TextRoutine" type="PanelContainer" node_paths=PackedStringArray("Label")]
8+
anchors_preset = 15
9+
anchor_right = 1.0
10+
anchor_bottom = 1.0
11+
grow_horizontal = 2
12+
grow_vertical = 2
13+
theme_override_styles/panel = SubResource("StyleBoxEmpty_u77vi")
14+
script = ExtResource("1_y0hwu")
15+
Label = NodePath("Label")
16+
17+
[node name="Label" type="Label" parent="."]
18+
layout_mode = 2
19+
text = "Placeholderblablabla"
20+
horizontal_alignment = 1
21+
vertical_alignment = 1
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using Godot;
2+
3+
namespace BabbleCalibration.Scripts.RoutineInterfaces;
4+
5+
public partial class PupilRoutineInterface : LabelRoutineInterface
6+
{
7+
[Export] public Gradient Gradient;
8+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
uid://danyvt3d78tfy
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,20 @@
55

66
namespace BabbleCalibration.Scripts.Routines;
77

8-
public class TutorialRoutine : RoutineBase
8+
public class GazeRoutine : RoutineBase
99
{
10-
public LabelRoutineInterface Interface;
10+
private LabelRoutineInterface _interface;
11+
1112
public override void Initialize(IBackend backend, Dictionary args = null)
1213
{
1314
base.Initialize(backend, args);
14-
(var tutorial, Interface) = this.Load<LabelRoutineInterface>("res://Scenes/Routines/TutorialRoutine.tscn");
15+
(var tutorial, _interface) = this.Load<LabelRoutineInterface>("res://Scenes/Routines/GazeRoutine.tscn");
1516
tutorial.ElementTransform = Transform3D.Identity.TranslatedLocal((Vector3.Forward * 2) + Vector3.Up);
1617
}
1718

1819
public override void Update(float delta)
1920
{
2021
base.Update(delta);
21-
Interface.Label.Text = Random.Shared.Next().ToString();
22+
_interface.Label.Text = Random.Shared.Next().ToString();
2223
}
2324
}

Scripts/Routines/PupilRoutine.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using BabbleCalibration.Scripts.RoutineInterfaces;
3+
using Godot;
4+
using Godot.Collections;
5+
6+
namespace BabbleCalibration.Scripts.Routines;
7+
8+
public class PupilRoutine : RoutineBase
9+
{
10+
private PupilRoutineInterface _interface;
11+
12+
public override void Initialize(IBackend backend, Dictionary args = null)
13+
{
14+
base.Initialize(backend, args);
15+
(var tutorial, _interface) = this.Load<PupilRoutineInterface>("res://Scenes/Routines/PupilRoutine.tscn");
16+
tutorial.ElementTransform = Transform3D.Identity.TranslatedLocal((Vector3.Forward * 2) + Vector3.Up);
17+
}
18+
19+
public override void Update(float delta)
20+
{
21+
base.Update(delta);
22+
_interface.Label.Text = Random.Shared.Next().ToString();
23+
24+
var secondsElapsed = Time.GetTicksMsec() / 1000f;
25+
var progress = secondsElapsed % 10f;
26+
_interface.Gradient.Colors[0] = Colors.White.Lerp(Colors.Black, progress / 10f);
27+
}
28+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
uid://c05hqarqy0mj1
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
using BabbleCalibration.Scripts.RoutineInterfaces;
3+
using Godot;
4+
using Godot.Collections;
5+
6+
namespace BabbleCalibration.Scripts.Routines;
7+
8+
public class TrainingRoutine : RoutineBase
9+
{
10+
private LabelRoutineInterface _interface;
11+
12+
public override void Initialize(IBackend backend, Dictionary args = null)
13+
{
14+
base.Initialize(backend, args);
15+
(var tutorial, _interface) = this.Load<LabelRoutineInterface>("res://Scenes/Routines/TrainingRoutine.tscn");
16+
tutorial.ElementTransform = Transform3D.Identity.TranslatedLocal((Vector3.Forward * 2) + Vector3.Up);
17+
}
18+
19+
public override void Update(float delta)
20+
{
21+
base.Update(delta);
22+
_interface.Label.Text = Random.Shared.Next().ToString();
23+
}
24+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
uid://b7xnt8eyk4nua

0 commit comments

Comments
 (0)