protected override void OnLoad(EventArgs e) { base.OnLoad(e); GlobalResources.OpenGLInterface = GRGlInterface.CreateNativeGlInterface(); Debug.Assert(GlobalResources.OpenGLInterface.Validate()); this.context = GRContext.Create(GRBackend.OpenGL, GlobalResources.OpenGLInterface); Debug.Assert(this.context.Handle != IntPtr.Zero); this.renderTarget = CreateRenderTarget(this); CursorVisible = true; Location = new Point(Location.X, 0); _Present = new GamePresenter(this); StartGame(); CurrentState = new GenericMenuState(StandardImageBackgroundSkia.GetMenuBackgroundDrawer(), this, new TitleMenuPopulator()) { StateHeader = "BASeTris" }; }
public String GameOverText = "GAME OVER"; //+ ShowExtraLines.ToString(); public override void HandleGameKey(IStateOwner pOwner, GameKeys g) { if (g == GameKeys.GameKey_RotateCW) { if (NewScorePosition > -1) { if (GameOveredState is GameplayGameState) { var useStats = ((GameplayGameState)GameOveredState).GameStats; var MenuState = ((GameplayGameState)GameOveredState).MainMenuState; if (useStats is TetrisStatistics) { EnterHighScoreState ehs = new EnterHighScoreState (GameOveredState, pOwner, MenuState, ((GameplayGameState)GameOveredState).GetLocalScores(), (n, s) => new XMLScoreEntry <TetrisHighScoreData>(n, s, new TetrisHighScoreData(useStats as TetrisStatistics)) , useStats as TetrisStatistics); pOwner.CurrentState = ehs; TetrisGame.Soundman.PlayMusic("highscoreentry", pOwner.Settings.std.MusicVolume, true); } else { } } } else if (CompleteSummary) { IBackground bg = null; if (pOwner is BASeTris bt) { bg = StandardImageBackgroundGDI.GetStandardBackgroundDrawer(); } else if (pOwner is BASeTrisTK) { bg = StandardImageBackgroundSkia.GetStandardBackgroundDrawer(); } GenericMenuState TitleMenu = new GenericMenuState(bg, pOwner, new TitleMenuPopulator()); pOwner.CurrentState = TitleMenu; } } }
public abstract void PopulateMenu(GenericMenuState Target, IStateOwner pOwner);