feat(app): Silk.NET window smoke — clear to navy
Minimal Silk.NET window wiring: 1280x720, OpenGL 4.3 core profile, VSync, dark navy clear color, Escape to close. No rendering beyond the clear call — terrain and shader land in Tasks 8 and 9. Manual smoke: process starts, stays alive past GL context creation, produces no stderr, no uncaught exceptions. Actual visual check will happen end-to-end after Task 10. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
baf0db303d
commit
6d18e0bd38
2 changed files with 66 additions and 2 deletions
|
|
@ -1,3 +1,5 @@
|
|||
// src/AcDream.App/Program.cs
|
||||
Console.WriteLine("acdream app — phase 1 skeleton");
|
||||
using AcDream.App.Rendering;
|
||||
|
||||
var window = new GameWindow();
|
||||
window.Run();
|
||||
return 0;
|
||||
|
|
|
|||
62
src/AcDream.App/Rendering/GameWindow.cs
Normal file
62
src/AcDream.App/Rendering/GameWindow.cs
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
using Silk.NET.Input;
|
||||
using Silk.NET.Maths;
|
||||
using Silk.NET.OpenGL;
|
||||
using Silk.NET.Windowing;
|
||||
|
||||
namespace AcDream.App.Rendering;
|
||||
|
||||
public sealed class GameWindow : IDisposable
|
||||
{
|
||||
private IWindow? _window;
|
||||
private GL? _gl;
|
||||
private IInputContext? _input;
|
||||
|
||||
public void Run()
|
||||
{
|
||||
var options = WindowOptions.Default with
|
||||
{
|
||||
Size = new Vector2D<int>(1280, 720),
|
||||
Title = "acdream — phase 1",
|
||||
API = new GraphicsAPI(
|
||||
ContextAPI.OpenGL,
|
||||
ContextProfile.Core,
|
||||
ContextFlags.ForwardCompatible,
|
||||
new APIVersion(4, 3)),
|
||||
VSync = true,
|
||||
};
|
||||
|
||||
_window = Window.Create(options);
|
||||
_window.Load += OnLoad;
|
||||
_window.Render += OnRender;
|
||||
_window.Closing += OnClosing;
|
||||
|
||||
_window.Run();
|
||||
}
|
||||
|
||||
private void OnLoad()
|
||||
{
|
||||
_gl = GL.GetApi(_window!);
|
||||
_input = _window!.CreateInput();
|
||||
foreach (var kb in _input.Keyboards)
|
||||
kb.KeyDown += (_, key, _) =>
|
||||
{
|
||||
if (key == Key.Escape)
|
||||
_window!.Close();
|
||||
};
|
||||
|
||||
_gl.ClearColor(0.05f, 0.10f, 0.18f, 1.0f);
|
||||
}
|
||||
|
||||
private void OnRender(double deltaSeconds)
|
||||
{
|
||||
_gl!.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
|
||||
}
|
||||
|
||||
private void OnClosing()
|
||||
{
|
||||
_input?.Dispose();
|
||||
_gl?.Dispose();
|
||||
}
|
||||
|
||||
public void Dispose() => _window?.Dispose();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue