/// <summary> /// The main entry point for the application. /// </summary> static void Main() { var time = new TimeMonitor(1000); // Request a 32-bits depth buffer when creating the window var contextSettings = new ContextSettings { DepthBits = 32 }; // Create the main window var window = new RenderWindow(new VideoMode(1600, 900), "TenSeconds", Styles.Close | Styles.Titlebar, contextSettings); // Make it the active window for OpenGL calls window.SetActive(); var windowInfo = OpenTK.Platform.Utilities.CreateWindowsWindowInfo(window.SystemHandle); var graphicsContext = new OpenTK.Graphics.GraphicsContext(OpenTK.Graphics.GraphicsMode.Default, windowInfo); graphicsContext.MakeCurrent(windowInfo); graphicsContext.LoadAll(); // Setup event handlers window.Closed += OnClosed; window.KeyPressed += OnKeyPressed; window.Resized += OnResized; var inputManager = new InputManager(); inputManager.Init(window); var game = new Game(); game.Init(window); while (window.IsOpen() && game.IsRunning) { time.Update(); // Process events window.DispatchEvents(); inputManager.Update(window); game.HandleInput(inputManager); game.Update(time); // Clear color and depth buffer GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); game.Draw(window); // Finally, display the rendered frame on screen window.Display(); } }