void InitializeGUI(ContentManager Content, MenuHandler menuHandler, GameSceneDirector sceneDirector) { DrawProperties button = new DrawProperties(Content.Load <Texture2D>(@"Buttons/button"), PuzzleEngineAlpha.Scene.DisplayLayer.Menu, 1.0f, 0.0f, Color.White); DrawProperties frame = new DrawProperties(Content.Load <Texture2D>(@"Buttons/frame"), PuzzleEngineAlpha.Scene.DisplayLayer.Menu + 0.02f, 1.0f, 0.0f, Color.White); DrawProperties clickedButton = new DrawProperties(Content.Load <Texture2D>(@"Buttons/clickedButton"), DisplayLayer.Menu + 0.01f, 1.0f, 0.0f, Color.White); DrawTextProperties textProperties = new DrawTextProperties("play", 11, Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Color.Black, PuzzleEngineAlpha.Scene.DisplayLayer.Menu + 0.03f, 1.0f); components.Add(new PuzzleEngineAlpha.Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, 0), ButtonSize, this.MenuRectangle)); components[0].StoreAndExecuteOnMouseRelease(new ExitMenuAction()); textProperties.text = "load"; components.Add(new PuzzleEngineAlpha.Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, ButtonSize.Y), ButtonSize, this.MenuRectangle)); components[1].StoreAndExecuteOnMouseRelease(new Actions.SwapGameWindowAction(menuHandler, "loadMap")); textProperties.text = "settings"; components.Add(new PuzzleEngineAlpha.Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, (ButtonSize.Y) * 2), ButtonSize, this.MenuRectangle)); components[2].StoreAndExecuteOnMouseRelease(new Actions.SwapGameWindowAction(menuHandler, "settings")); textProperties.text = "editor"; components.Add(new PuzzleEngineAlpha.Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, (ButtonSize.Y) * 3), ButtonSize, this.MenuRectangle)); components[3].StoreAndExecuteOnMouseRelease(new PuzzleEngineAlpha.Actions.ToggleActiveSceneryAction((PuzzleEngineAlpha.Scene.SceneDirector)sceneDirector)); textProperties.text = "exit"; components.Add(new PuzzleEngineAlpha.Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, (ButtonSize.Y) * 4), ButtonSize, this.MenuRectangle)); components[4].StoreAndExecuteOnMouseRelease(new Actions.TerminateGameAction()); }
// ComponentEnumerator enumerator; #endregion #region Constructor public MainMenu(ContentManager Content, MenuHandler menuHandler, GameSceneDirector sceneDirector) { // enumerator = new ComponentEnumerator(Microsoft.Xna.Framework.Input.Keys.Down, Microsoft.Xna.Framework.Input.Keys.Up, Microsoft.Xna.Framework.Input.Keys.Enter); components = new List <AGUIComponent>(); InitializeGUI(Content, menuHandler, sceneDirector); backGround = Content.Load <Texture2D>(@"textures/whiteRectangle"); PuzzleEngineAlpha.Resolution.ResolutionHandler.Changed += ResetSizes; }
public MainMenu(ContentManager Content, MenuHandler menuHandler, GameSceneDirector sceneDirector) { components = new List <AGUIComponent>(); InitializeGUI(Content, menuHandler, sceneDirector); backGround = Content.Load <Texture2D>(@"textures/whiteRectangle"); PuzzleEngineAlpha.Resolution.ResolutionHandler.Changed += ResetSizes; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); sceneDirector = new GameSceneDirector(GraphicsDevice, Content, this.resolutionHandler); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); sceneDirector = new GameSceneDirector(GraphicsDevice, Content); }
public MenuHandler(ContentManager Content, GraphicsDevice graphicsDevice, MapHandlerScene mapHandler, PuzzleEngineAlpha.Level.TileMap tileMap, ResolutionHandler resolutionHandler, GameSceneDirector sceneDirector) { this.graphicsDevice = graphicsDevice; menuWindows = new Dictionary <string, IScene>(); menuWindows.Add("mainMenu", new MainMenu(Content, this, sceneDirector)); menuWindows.Add("loadMap", new LoadMapMenu(graphicsDevice, Content, this, mapHandler, tileMap)); menuWindows.Add("settings", new SettingsMenu(Content, this, resolutionHandler)); activeWindow = menuWindows["mainMenu"]; IsActive = false; currentState = new MenuStateEnum(); currentState = MenuStateEnum.Hidden; transition = new PuzzleEngineAlpha.Animations.SmoothTransition(0.0f, 0.011f, 0.0f, 1.0f); this.camera = new PuzzleEngineAlpha.Camera.Camera(Vector2.Zero, new Vector2(ResolutionHandler.WindowWidth, ResolutionHandler.WindowHeight), new Vector2(ResolutionHandler.WindowWidth, PuzzleEngineAlpha.Resolution.ResolutionHandler.WindowHeight)); camera.Zoom = transition.Value; ResolutionHandler.Changed += ResetSizes; }