diff options
| author | Sophia Pearson <codergal89@gmail.com> | 2022-05-20 00:45:25 +0200 |
|---|---|---|
| committer | Sophia Pearson <codergal89@gmail.com> | 2022-05-20 18:56:04 +0200 |
| commit | 05d29ccce1898ed89c0b650c77242c2fa2805128 (patch) | |
| tree | e8ee3bcb570fa6f3d9d96273c2bf4d4c8618d08b /Scripts/Game.cs | |
| download | texty-05d29ccce1898ed89c0b650c77242c2fa2805128.tar.xz texty-05d29ccce1898ed89c0b650c77242c2fa2805128.zip | |
texty: initial commit
Diffstat (limited to 'Scripts/Game.cs')
| -rw-r--r-- | Scripts/Game.cs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Scripts/Game.cs b/Scripts/Game.cs new file mode 100644 index 0000000..645c922 --- /dev/null +++ b/Scripts/Game.cs @@ -0,0 +1,30 @@ +using System.Diagnostics; +using Godot; + +namespace Texty.Scripts +{ + public abstract class Game : MarginContainer + { + public VBoxContainer LayoutContainer; + public OutputContainer OutputContainer; + + [Export(PropertyHint.File, "*.tscn")] public PackedScene OutputRowScene; + + public override void _Ready() + { + Debug.Assert(OutputRowScene != null, $"The {nameof(OutputRowScene)} was not set!"); + + LayoutContainer = GetNode<VBoxContainer>(nameof(LayoutContainer)); + OutputContainer = LayoutContainer.GetNode<OutputContainer>(nameof(OutputContainer)); + } + + public void OnInputSubmitted(string text) + { + var newRow = OutputRowScene.Instance<OutputRow>(); + newRow.InputText = text; + newRow.OutputText = "THE OUTPUT SHOULD GO HERE!"; + + OutputContainer.Add(newRow); + } + } +}
\ No newline at end of file |
