Major refactor and organization, optimizations to chunk, world and renderer

This commit is contained in:
max
2026-03-24 22:31:40 +01:00
parent dbc546fd0e
commit eb6294c09e
25 changed files with 410 additions and 441 deletions

38
Core/Input.cs Normal file
View File

@@ -0,0 +1,38 @@
using OpenTK.Windowing.Common;
using OpenTK.Windowing.GraphicsLibraryFramework;
namespace Voxel.Core
{
public static class Input
{
private static Dictionary<Keys, bool> _keystates = new Dictionary<Keys, bool>();
private static Dictionary<MouseButton, bool> _mouseButtonStates = new Dictionary<MouseButton, bool>();
public static Action<MouseWheelEventArgs> OnMouseWheel;
public static bool GetMouseButton(MouseButton button)
{
return _mouseButtonStates.TryGetValue(button, out bool pressed) && pressed;
}
public static void SetMouseButton(MouseButton button, bool pressed)
{
_mouseButtonStates[button] = pressed;
}
public static bool GetKey(Keys key)
{
return _keystates.TryGetValue(key, out bool pressed) && pressed;
}
public static void SetKey(Keys key, bool pressed)
{
_keystates[key] = pressed;
}
public static void MouseWheel(MouseWheelEventArgs e)
{
OnMouseWheel.Invoke(e);
}
}
}