public void SetGameState(GameState state) { CurrentGameStateObject.Unload(); CurrentGameStateObject = GameStateObjects[state]; //TODO: Ensure game is always in valid state CurrentGameState = state; CurrentGameStateObject.Load(this); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); VSync = VSyncMode.On; //TODO: Load preferred from settings file GL.ClearColor(Color.CornflowerBlue); GL.Viewport(0, 0, Width, Height); GL.MatrixMode(MatrixMode.Projection); GL.LoadIdentity(); GL.Ortho(0.0f, IntendedSize.X, IntendedSize.Y, 0.0f, 0.0f, 1.0f); //Map (0, 0) -> (0, 0) and (Width, Height) -> (1, 1) GL.Enable(EnableCap.Texture2D); GL.Enable(EnableCap.AlphaTest); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location); Title = "osutk!cuttingedge b20160118"; CurrentGameState = MainMenu; CurrentGameStateObject = GameStateObjects[MainMenu]; CurrentGameStateObject.Load(this); }