Add project files.
This commit is contained in:
48
Window.cs
Normal file
48
Window.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user