diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c05f8cf --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "godotTools.editorPath.godot4": "/Users/u229331/GameDev/Godot/Godot_mono.app" +} \ No newline at end of file diff --git a/Scripts/Main.cs b/Scripts/Main.cs index 5d46646..a5462b0 100644 --- a/Scripts/Main.cs +++ b/Scripts/Main.cs @@ -1,12 +1,129 @@ using Godot; +using EinSoftworks.Utilities; +using EinSoftworks.Input; namespace TestGame { public partial class Main : Node2D { + private InputManager _inputManager; + private Label _statusLabel; + private Label _inputStatusLabel; + public override void _Ready() { - GD.Print("Clean test game started!"); + GD.Print("Test Game Started!"); + + // Test the utilities library + TestMathUtils(); + + // Initialize input manager + _inputManager = new InputManager(); + AddChild(_inputManager); + + // Create UI labels for testing + CreateTestUI(); + + // Connect to input events + _inputManager.ActionPressed += OnActionPressed; + _inputManager.ActionReleased += OnActionReleased; + } + + public override void _Process(double delta) + { + TestInputSystem(); + } + + private void TestMathUtils() + { + // Test degree/radian conversion + float testAngle = 90f; + float radians = MathUtils.DegreesToRadians(testAngle); + float backToDegrees = MathUtils.RadiansToDegrees(radians); + GD.Print($"90° → {radians} rad → {backToDegrees}°"); + + // Test clamping + float clampedValue = MathUtils.Clamp01(1.5f); + GD.Print($"Clamped 1.5 to 0-1 range: {clampedValue}"); + + // Test approximation + bool isApprox = MathUtils.Approximately(0.1f, 0.100001f); + GD.Print($"0.1 ≈ 0.100001: {isApprox}"); + } + + private void CreateTestUI() + { + // Main status label (existing) + _statusLabel = GetNode