summaryrefslogtreecommitdiff
path: root/client/Game.cs
diff options
context:
space:
mode:
Diffstat (limited to 'client/Game.cs')
-rw-r--r--client/Game.cs37
1 files changed, 37 insertions, 0 deletions
diff --git a/client/Game.cs b/client/Game.cs
new file mode 100644
index 0000000..6bf6192
--- /dev/null
+++ b/client/Game.cs
@@ -0,0 +1,37 @@
+using Godot;
+using System;
+using Djup.Native;
+
+public partial class Game : Node2D
+{
+ private World world;
+
+ private int[] balls = new int[100];
+ private Random rng = new();
+
+ // Called when the node enters the scene tree for the first time.
+ public unsafe override void _Ready()
+ {
+ RenderingServer.SetDefaultClearColor(Colors.LightGray);
+ LibDjup.log_set_output((level, source, line, msg) => {
+ string level_name = level switch
+ {
+ LogLevel.Trace => "trace",
+ LogLevel.Debug => "debug",
+ LogLevel.Info => " info",
+ LogLevel.Warn => " warn",
+ LogLevel.Error => "error",
+ LogLevel.Fatal => "fatal",
+ _ => "UNKNOWN"
+ };
+ GD.Print($"libdjup {source.PadLeft(10)}:{line.ToString().PadRight(3)} {level_name}: {msg}");
+ });
+
+ world = GetNode<World>("World");
+
+ world.PutPlayer(0, new Djup.Native.Player()
+ {
+ Position = new Vec2(100f, 100f),
+ });
+ }
+}