player added

This commit is contained in:
maxwes08
2025-09-30 10:58:12 +02:00
parent 38dccf0a84
commit 11f76ca429
11 changed files with 259 additions and 48 deletions

View File

@@ -10,14 +10,16 @@ namespace Voxel
{
public readonly int Width = width;
public readonly int Height = height;
public Player Player;
public uint frames = 0;
public double timeElapsed = 0;
public event Action<float> Update;
protected override void OnUpdateFrame(FrameEventArgs e)
{
base.OnUpdateFrame(e);
float deltaTime = (float)e.Time;
if (Input.GetKey(Keys.Escape))
{
Close();
@@ -31,10 +33,7 @@ namespace Voxel
WindowState = WindowState.Normal;
}
if (Player != null)
{
Player.Update((float)e.Time);
}
Update.Invoke(deltaTime);
}
protected override void OnRenderFrame(FrameEventArgs e)
@@ -52,7 +51,6 @@ namespace Voxel
frames = 0;
}
Camera.Update((float)e.Time);
Renderer.Render();
SwapBuffers();
@@ -123,8 +121,6 @@ namespace Voxel
if (e.OffsetY < 0)
inverted = true;
Player.SwitchBlock(inverted);
}
}
}