Files
VoxelEngine/Program.cs

42 lines
1.1 KiB
C#

using OpenTK.Mathematics;
using OpenTK.Windowing.Common;
using OpenTK.Windowing.Desktop;
using Serilog;
using Serilog.Events;
using VoxelEngine.Core;
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.Enrich.FromLogContext()
.WriteTo.Console(restrictedToMinimumLevel: LogEventLevel.Information)
.WriteTo.File(
path: "logs/voxelengine-.log",
rollingInterval: RollingInterval.Day,
retainedFileCountLimit: 14,
outputTemplate: "[{Timestamp:HH:mm:ss.fff} {Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}")
.CreateLogger();
try
{
NativeWindowSettings nativeSettings = new()
{
ClientSize = new Vector2i(1280, 720),
Title = "VoxelEngine",
APIVersion = new Version(3, 3),
Profile = ContextProfile.Core,
Flags = ContextFlags.ForwardCompatible
};
using Game game = new(GameWindowSettings.Default, nativeSettings);
game.Run();
}
catch (Exception ex)
{
Log.Fatal(ex, "Unhandled exception at top level");
throw;
}
finally
{
Log.CloseAndFlush();
}