Add project files.

This commit is contained in:
maxwes08
2025-08-26 16:00:58 +02:00
parent 3c864f793b
commit 1d062528aa
8 changed files with 270 additions and 0 deletions

48
Window.cs Normal file
View File

@@ -0,0 +1,48 @@
using OpenTK.Graphics.OpenGL4;
using OpenTK.Windowing.Common;
using OpenTK.Windowing.Desktop;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Voxel
{
public class Window(int width, int height, string title) : GameWindow(GameWindowSettings.Default, new NativeWindowSettings() { Size = (width, height), Title = title })
{
private Triangle _triangle;
protected override void OnUpdateFrame(FrameEventArgs args)
{
base.OnUpdateFrame(args);
}
protected override void OnRenderFrame(FrameEventArgs args)
{
base.OnRenderFrame(args);
GL.Clear(ClearBufferMask.ColorBufferBit);
_triangle.Draw();
SwapBuffers();
}
protected override void OnFramebufferResize(FramebufferResizeEventArgs e)
{
base.OnFramebufferResize(e);
GL.Viewport(0, 0, e.Width, e.Height);
}
protected override void OnLoad()
{
base.OnLoad();
_triangle = new Triangle();
GL.ClearColor(0.5f, 0.5f, 0.5f, 1f);
}
}
}