summaryrefslogtreecommitdiff
path: root/client/Game.cs
blob: 6bf6192fef0343f29aad4a2754905401a0498426 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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),
		});
	}
}