private unsafe static void ApiThread <T>(string name, CommonWindow window) where T : App, new() { var app = new T(); app.window = window; app.name = name; app.queue = window.queue; PlatformData platform = default; Init ini = default; init_ctor(&ini); ini.vendorId = 0; ini.resolution.width = 1280; ini.resolution.height = 720; platform.nwh = window.nwh; ini.platformData = platform; ini.type = Bgfx.bgfx.RendererType.Direct3D11; ini.resolution.reset = (uint)Bgfx.bgfx.ResetFlags.Vsync; app.Initialize(&ini); app._previousGameTime = DateTime.UtcNow; bool exit = false; while (!exit) { exit = app.OnUpdate(); } window.exit = exit; }
public unsafe static void Run <T>(string name) where T : App, new() { var display = new DisplayConfig().initialize((1280, 720), (1280, 720), (1280, 720), name); var window = new CommonWindow(display); window.queue = new ConcurrentQueue <KeyCode>(); render_frame(-1); var task = new Task(() => ApiThread <T>(name, window)); task.Start(); window.RunLoop(); }