public MainMenu(Atom a, int layer) : base(a, layer, "Atomic Engine Example Game") { AddSlidingMenuItem("Start", delegate(MenuState menu) { a.stateManager.EndState(this); TestRoom room = new TestRoom((Engine)a, 0); a.stateManager.StartState(new FadeTransition(a, 1, room)); }); AddSlidingMenuItem("Options", delegate(MenuState menu) { a.stateManager.StartState(new OptionsMenu(a, 1)); }); AddSlidingMenuItem("Exit", delegate(MenuState menu) { a.Exit(); }); guiManager.Add(new InputField(new Vector2(500, 500), new Vector2(150, 25))); guiManager.Add(new InputField(new Vector2(500, 530), new Vector2(150, 25), true)); guiManager[0].tab = guiManager[1]; guiManager[1].tab = guiManager[0]; }
/// <summary> /// First loading sequence.. only called once from ApplicationBase:Load() /// </summary> /// <returns>returns true if load is succesful</returns> public override bool OnFirstLoad() { Logger.Log("\n*** -- BEGIN LOADING -- ***\n"); // SETS THE DEFAULT STARTING SEARCH DIRECTORY // BASED ON THE GAME BEING PLAYED.... // FileSearch.SetStartingSearchDirectory(FileSearch.GetApplicationDirectory() + "\\Media\\"); almMachineStatus.Enable(); try { MultiMediaLoader ml = new MultiMediaLoader("Bingo"); ml.LoadFile("Bingo.txt"); guiManager.Add(ml); //////////////////////////////////////// un-Comment out for testing // lblFps = (GuiLabel)guiManager.Get("lbl_fps"); // lblMessage = (GuiLabel)guiManager.Get("lbl_message"); // add the 'StateLoading' state top the Bingo.stateMachine stateMachine.Add(new StateLoading(stateMachine)); // change to (display) the 'Loading' state stateMachine.ChangeActiveState("Loading"); } catch (Exception e) { Logger.Log("Exception Loading Loading State \n" + e.ToString()); MessageBox.Show("Error Loading"); return(false); } // Logger.Log("Finished 'OnFirstLoad()' \n"); return(true); }
protected override void Update(GameTime gameTime) { base.Update(gameTime); Input.Update(gameTime); switch (_gameState) { case GameStateEnum.Game: if (Input.GetInput(Inputs.QuickLoad, InputState.Pressed)) { if (LoadSession("quicksave.sav")) { Hud.Chat("Loading from quick save"); return; } } else if (Input.GetInput(Inputs.QuickSave, InputState.Pressed)) { SaveSession("quicksave.sav"); Hud.Chat("Quick saving..."); } if (Session != null) { Session.Update(gameTime); } Hud.Update(gameTime); if (Input.GetInput(Inputs.Pause, InputState.Pressed)) { var g = GuiManager.GetGuiOfType <Gui.MiniMenu>(); if (g == null) { GuiManager.Add(new Gui.MiniMenu()); } else { g.Closing = true; } } GuiManager.Update(gameTime); break; case GameStateEnum.Menu: MenuState.Update(gameTime); break; case GameStateEnum.Intro: Intro.Update(gameTime); break; } Console.Update(gameTime); }
/// <summary> /// Load content /// </summary> public override void LoadContent() { Display.RenderState.ClearColor = Color.CornflowerBlue; ResourceManager.AddStorage(new BankStorage("data/data.bnk")); Manager = new GuiManager(); Manager.TileSet = ResourceManager.CreateAsset <TileSet>("Skin"); Manager.Font = BitmapFont.CreateFromTTF(@"C:\Windows\Fonts\Verdana.ttf", 12, FontStyle.Regular); window = new Window("Title..."); window.BgColor = Color.LightCoral; window.Location = new Point(100, 100); window.Size = new Size(320, 240); Manager.Add(window); CheckBox checkbox1 = new CheckBox(); checkbox1.Location = new Point(50, 50); checkbox1.Text = "checkbox 1"; checkbox1.Font = BitmapFont.CreateFromTTF(@"C:\Windows\Fonts\Verdana.ttf", 9, FontStyle.Regular); checkbox1.CheckedChanged += new EventHandler(checkbox_CheckedChanged); window.Add(checkbox1); CheckBox checkbox2 = new CheckBox(); checkbox2.Location = new Point(50, 65); checkbox1.Text = "checkbox 2"; checkbox2.Font = BitmapFont.CreateFromTTF(@"C:\Windows\Fonts\Verdana.ttf", 10, FontStyle.Regular); checkbox2.CheckedChanged += new EventHandler(checkbox_CheckedChanged); window.Add(checkbox2); Font = BitmapFont.CreateFromTTF(@"C:\Windows\Fonts\Verdana.ttf", 9, FontStyle.Regular); Batch = new SpriteBatch(); }