player added
This commit is contained in:
12
Window.cs
12
Window.cs
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user