void InitializeGUI(ContentManager Content, MenuHandler menuHandler, SceneDirector sceneDirector) { DrawProperties button = new DrawProperties(Content.Load <Texture2D>(@"Buttons/button"), Scene.DisplayLayer.Menu, 1.0f, 0.0f, Color.White); DrawProperties frame = new DrawProperties(Content.Load <Texture2D>(@"Buttons/frame"), Scene.DisplayLayer.Menu + 0.02f, 1.0f, 0.0f, Color.White); DrawProperties clickedButton = new DrawProperties(Content.Load <Texture2D>(@"Buttons/clickedButton"), Scene.DisplayLayer.Menu + 0.01f, 1.0f, 0.0f, Color.White); DrawTextProperties textProperties = new DrawTextProperties("editor", 11, Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Color.Black, Scene.DisplayLayer.Menu + 0.03f, 1.0f); components.Add(new Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, 0), ButtonSize, this.MenuRectangle)); components[0].StoreAndExecuteOnMouseRelease(new Actions.ExitMenuAction()); textProperties.text = "new"; components.Add(new Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, ButtonSize.Y), ButtonSize, this.MenuRectangle)); components[1].StoreAndExecuteOnMouseRelease(new Actions.SwapEditorWindowAction(menuHandler, "newMap")); textProperties.text = "load"; components.Add(new Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, (ButtonSize.Y) * 2), ButtonSize, this.MenuRectangle)); components[2].StoreAndExecuteOnMouseRelease(new Actions.SwapEditorWindowAction(menuHandler, "loadMap")); textProperties.text = "save"; components.Add(new Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, (ButtonSize.Y) * 3), ButtonSize, this.MenuRectangle)); components[3].StoreAndExecuteOnMouseRelease(new Actions.SwapEditorWindowAction(menuHandler, "saveMap")); textProperties.text = "game"; components.Add(new Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, (ButtonSize.Y) * 4), ButtonSize, this.MenuRectangle)); components[4].StoreAndExecuteOnMouseRelease(new Actions.ToggleActiveSceneryAction(sceneDirector)); textProperties.text = "exit"; components.Add(new Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, (ButtonSize.Y) * 5), ButtonSize, this.MenuRectangle)); components[5].StoreAndExecuteOnMouseRelease(new Actions.TerminateGameAction()); }
void InitializeGUI(ContentManager Content, IScene selectionScene, IScene actorSelectionScene) { Passable = true; textBox = new TextBox(new Input.KeyboardInput(), Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Content.Load <Texture2D>(@"Textboxes/textbox"), new Vector2(5, 5) + SceneLocation, 160, 30, Scene.DisplayLayer.Editor - 0.01f); textBox.StoreAndExecuteOnTextChange(new Actions.SetSelectedCodeValueAction(textBox)); DrawProperties button = new DrawProperties(Content.Load <Texture2D>(@"Buttons/button"), Scene.DisplayLayer.Editor, 1.0f, 0.0f, Color.White); DrawProperties frame = new DrawProperties(Content.Load <Texture2D>(@"Buttons/frame"), Scene.DisplayLayer.Editor + 0.02f, 1.0f, 0.0f, Color.White); DrawProperties clickedButton = new DrawProperties(Content.Load <Texture2D>(@"Buttons/clickedButton"), Scene.DisplayLayer.Editor + 0.01f, 1.0f, 0.0f, Color.White); DrawTextProperties textProperties = new DrawTextProperties("is passable", 11, Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Color.Black, Scene.DisplayLayer.Editor + 0.03f, 1.0f); components.Add(new MenuButton(button, frame, clickedButton, textProperties, new Vector2(5, 50) + SceneLocation, new Vector2(160, 40), this.SceneRectangle)); components[0].StoreAndExecuteOnMouseRelease(new Actions.TogglePassableAction((MenuButton)components[0])); textProperties.text = "deselect"; components.Add(new MenuButton(button, frame, clickedButton, textProperties, new Vector2(5, 100) + SceneLocation, new Vector2(160, 40), this.SceneRectangle)); components[1].StoreAndExecuteOnMouseRelease(new Actions.UnSelectedTileAction()); textProperties.text = "tiles"; components.Add(new MenuButton(button, frame, clickedButton, textProperties, new Vector2(0, 150) + SceneLocation, new Vector2(85, 60), this.SceneRectangle)); components[2].StoreAndExecuteOnMouseRelease(new Actions.ToggleSelectionAction((SelectionScene)selectionScene, (SelectionScene)actorSelectionScene, true)); textProperties.text = "actors"; components.Add(new MenuButton(button, frame, clickedButton, textProperties, new Vector2(85, 150) + SceneLocation, new Vector2(85, 60), this.SceneRectangle)); components[3].StoreAndExecuteOnMouseRelease(new Actions.ToggleSelectionAction((SelectionScene)selectionScene, (SelectionScene)actorSelectionScene, false)); }
void InitializeGUI(ContentManager Content, MenuHandler menuHandler, Level.TileMap tileMap) { int messageOffset = 148; textboxes.Add("initialID", new TextBox(new Input.KeyboardNumberInput(), Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Content.Load <Texture2D>(@"Textboxes/textbox"), Location, TextBoxWidth, TextBoxHeight, Scene.DisplayLayer.Menu + 0.01f)); messages.Add(new Animations.DisplayMessage(Content, new Vector2(-23, +messageOffset), "initial id", -1)); textboxes["initialID"].Text = "0"; textboxes.Add("tilesize", new TextBox(new Input.KeyboardNumberInput(), Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Content.Load <Texture2D>(@"Textboxes/textbox"), Location + new Vector2(0, TextBoxHeight), TextBoxWidth, TextBoxHeight, Scene.DisplayLayer.Menu + 0.01f)); messages.Add(new Animations.DisplayMessage(Content, new Vector2(-23, +messageOffset - TextBoxHeight), "tile size ", -1)); textboxes["tilesize"].Text = "64"; textboxes.Add("mapwidth", new TextBox(new Input.KeyboardNumberInput(), Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Content.Load <Texture2D>(@"Textboxes/textbox"), Location + new Vector2(0, 2 * TextBoxHeight), TextBoxWidth, TextBoxHeight, Scene.DisplayLayer.Menu + 0.01f)); messages.Add(new Animations.DisplayMessage(Content, new Vector2(-23, +messageOffset - TextBoxHeight * 2), "map width ", -1)); textboxes["mapwidth"].Text = "100"; textboxes.Add("mapheight", new TextBox(new Input.KeyboardNumberInput(), Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Content.Load <Texture2D>(@"Textboxes/textbox"), Location + new Vector2(0, 3 * TextBoxHeight), TextBoxWidth, TextBoxHeight, Scene.DisplayLayer.Menu + 0.01f)); textboxes["mapheight"].Text = "100"; messages.Add(new Animations.DisplayMessage(Content, new Vector2(-23, +messageOffset - TextBoxHeight * 3), "map height", -1)); DrawProperties button = new DrawProperties(Content.Load <Texture2D>(@"Buttons/button"), Scene.DisplayLayer.Menu, 1.0f, 0.0f, Color.White); DrawProperties frame = new DrawProperties(Content.Load <Texture2D>(@"Buttons/frame"), Scene.DisplayLayer.Menu + 0.02f, 1.0f, 0.0f, Color.White); DrawProperties clickedButton = new DrawProperties(Content.Load <Texture2D>(@"Buttons/clickedButton"), Scene.DisplayLayer.Menu + 0.01f, 1.0f, 0.0f, Color.White); DrawTextProperties textProperties = new DrawTextProperties("new map", 11, Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Color.Black, Scene.DisplayLayer.Menu + 0.03f, 1.0f); components.Add(new Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, (TextBoxHeight * 4)), ButtonSize, this.MenuRectangle)); components[0].StoreAndExecuteOnMouseRelease(new Actions.NewMapAction(textboxes["initialID"], textboxes["tilesize"], textboxes["mapwidth"], textboxes["mapheight"], tileMap)); textProperties.text = "back"; components.Add(new Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, ButtonSize.Y + (TextBoxHeight * 4)), ButtonSize, this.MenuRectangle)); components[1].StoreAndExecuteOnMouseRelease(new Actions.SwapEditorWindowAction(menuHandler, "mainMenu")); }
void InitializeGUI(ContentManager Content, MenuHandler menuHandler) { DrawProperties button = new DrawProperties(Content.Load <Texture2D>(@"Buttons/button"), DisplayLayer.Menu, 1.0f, 0.0f, Color.White); DrawProperties frame = new DrawProperties(Content.Load <Texture2D>(@"Buttons/frame"), 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("previous", 11, Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Color.Black, 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 PuzzleEngineAlpha.Actions.ChangeMiniMapAction(this.miniMap, -1))); textProperties.text = "load"; components.Add(new PuzzleEngineAlpha.Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(+ButtonSize.X, 0), ButtonSize, this.MenuRectangle)); components[1].StoreAndExecuteOnMouseRelease(new PuzzleEngineAlpha.Actions.LoadMapAction(this.miniMap, this.tileMap)); textProperties.text = "next"; components.Add(new PuzzleEngineAlpha.Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(+ButtonSize.X * 2, 0), ButtonSize, this.MenuRectangle)); components[2].StoreAndExecuteOnMouseRelease((new PuzzleEngineAlpha.Actions.ChangeMiniMapAction(this.miniMap, +1))); textProperties.text = "back"; components.Add(new PuzzleEngineAlpha.Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(+ButtonSize.X, ButtonSize.Y), ButtonSize, this.MenuRectangle)); components[3].StoreAndExecuteOnMouseRelease(new Actions.SwapGameWindowAction(menuHandler, "mainMenu")); // foreach (AGUIComponent component in components) // enumerator.AddGUIComponent(component); // components[0].IsFocused = true; }
public void InitializeButtons(Rectangle sceneRectangle) { this.sceneRectangle = sceneRectangle; //move camera to its initial location this.Camera.Position = Vector2.Zero; DrawProperties button = new DrawProperties(Content.Load <Texture2D>(@"Textures/PlatformTilesTemp"), Scene.DisplayLayer.Tile, 1.0f, 0.0f, Color.White); DrawProperties buttonActor = new DrawProperties(Content.Load <Texture2D>(@"Textures/ActorsTemp"), Scene.DisplayLayer.Tile, 1.0f, 0.0f, Color.White); DrawProperties frame = new DrawProperties(Content.Load <Texture2D>(@"Buttons/tileFrame"), Scene.DisplayLayer.TileFrame, 1.0f, 0.0f, Color.White); DrawTextProperties passableText = new DrawTextProperties("x", 11, Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Color.Black, Scene.DisplayLayer.TileFrame + 0.01f, 1.0f); DrawTextProperties codeValueText = new DrawTextProperties("", 11, Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Color.Black, Scene.DisplayLayer.TileFrame + 0.01f, 1.0f); Texture2D background = Content.Load <Texture2D>(@"Textures/whiteRectangle"); editorMapSquares = new EditorMapSquare[MapWidth, MapHeight]; for (int x = 0; x < MapWidth; x++) { for (int y = 0; y < MapHeight; y++) { editorMapSquares[x, y] = new EditorMapSquare(passableText, codeValueText, background, button, buttonActor, frame, new Vector2(x * TileWidth, y * TileHeight), new Vector2(TileWidth, TileHeight), TileSourceRectangle(mapCells[x, y].LayerTile), this.Camera, sceneRectangle, mapCells[x, y].LayerTile); editorMapSquares[x, y].MapSquare = mapCells[x, y]; editorMapSquares[x, y].ActorSourceRectangle = actorTileSheet.TileSourceRectangle(mapCells[x, y].ActorID); editorMapSquares[x, y].StoreAndExecuteOnMouseDown(new Actions.SetEditorMapSquare(editorMapSquares[x, y])); editorMapSquares[x, y].StoreAndExecuteOnMouseRelease(new Actions.SetEditorSelectedTileAction(editorMapSquares[x, y])); } } }
public EditorMapSquare(DrawTextProperties passableText, DrawTextProperties codeValueText, Texture2D background, DrawProperties buttonDrawProperties, DrawProperties buttonActorDrawProperties, DrawProperties frameDrawProperties, Vector2 position, Vector2 size, Rectangle sourceRectangle, Camera.Camera camera, Rectangle generalArea, int layerTile) : base(buttonDrawProperties, frameDrawProperties, position, size, sourceRectangle, camera, generalArea, layerTile) { this.passableText = passableText; this.codeValueText = codeValueText; this.background = background; this.buttonActor = buttonActorDrawProperties; }
void InitializeGUI(ContentManager Content, MenuHandler menuHandler) { DrawProperties button = new DrawProperties(Content.Load <Texture2D>(@"Buttons/button"), DisplayLayer.Menu, 1.0f, 0.0f, Color.White); DrawProperties frame = new DrawProperties(Content.Load <Texture2D>(@"Buttons/frame"), 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("back", 11, Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Color.Black, DisplayLayer.Menu + 0.03f, 1.0f); components.Add(new MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, 0), ButtonSize, this.MenuRectangle)); components[0].StoreAndExecuteOnMouseRelease(new Actions.SwapGameWindowAction(menuHandler, "mainMenu")); }
public MenuButton(DrawProperties buttonDrawProperties, DrawProperties frameDrawProperties, DrawProperties clickedButtonDrawProperties, DrawTextProperties textProperties, Vector2 position, Vector2 size, Rectangle generalArea) : base() { button = buttonDrawProperties; frame = frameDrawProperties; clickedButton = clickedButtonDrawProperties; defaultText = textProperties; this.Size = size; this.Position = position; this.GeneralArea = generalArea; this.mouseLocation = Input.InputHandler.MousePosition; }
void InitializeGUI(ContentManager Content, MenuHandler menuHandler) { textBox = new TextBox(new Input.KeyboardInput(), Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Content.Load <Texture2D>(@"Textboxes/textbox"), Location, (int)ButtonSize.X, 30, Scene.DisplayLayer.Menu + 0.01f); textBox.Text = "mapName"; DrawProperties button = new DrawProperties(Content.Load <Texture2D>(@"Buttons/button"), Scene.DisplayLayer.Menu, 1.0f, 0.0f, Color.White); DrawProperties frame = new DrawProperties(Content.Load <Texture2D>(@"Buttons/frame"), Scene.DisplayLayer.Menu + 0.02f, 1.0f, 0.0f, Color.White); DrawProperties clickedButton = new DrawProperties(Content.Load <Texture2D>(@"Buttons/clickedButton"), Scene.DisplayLayer.Menu + 0.01f, 1.0f, 0.0f, Color.White); DrawTextProperties textProperties = new DrawTextProperties("save", 11, Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Color.Black, Scene.DisplayLayer.Menu + 0.03f, 1.0f); components.Add(new Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, 30), ButtonSize, this.MenuRectangle)); components[0].StoreAndExecuteOnMouseRelease(new Actions.SaveMapAction(this.mapHandler, this.textBox)); textProperties.text = "back"; components.Add(new Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, ButtonSize.Y + 30), ButtonSize, this.MenuRectangle)); components[1].StoreAndExecuteOnMouseRelease(new Actions.SwapEditorWindowAction(menuHandler, "mainMenu")); }
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()); // components[0].StoreAndExecuteOnMouseOver(new SetEnumeratorValueAction(this.enumerator,0)); 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")); // components[1].StoreAndExecuteOnMouseOver(new SetEnumeratorValueAction(this.enumerator, 1)); 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")); // components[2].StoreAndExecuteOnMouseOver(new SetEnumeratorValueAction(this.enumerator, 2)); 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)); // components[3].StoreAndExecuteOnMouseOver(new SetEnumeratorValueAction(this.enumerator, 3)); 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()); // components[4].StoreAndExecuteOnMouseOver(new SetEnumeratorValueAction(this.enumerator, 4)); // foreach (AGUIComponent component in components) // enumerator.AddGUIComponent(component); components[0].IsFocused = true; }
void InitializeGUI(ContentManager Content, MenuHandler menuHandler, PuzzleEngineAlpha.Resolution.ResolutionHandler resolutionHandler) { DrawProperties button = new DrawProperties(Content.Load <Texture2D>(@"Buttons/button"), DisplayLayer.Menu, 1.0f, 0.0f, Color.White); DrawProperties frame = new DrawProperties(Content.Load <Texture2D>(@"Buttons/frame"), 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("back", 11, Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Color.Black, DisplayLayer.Menu + 0.03f, 1.0f); components.Add(new MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, 0), ButtonSize, this.MenuRectangle)); components[0].StoreAndExecuteOnMouseRelease(new Actions.SwapGameWindowAction(menuHandler, "mainMenu")); // components[0].StoreAndExecuteOnMouseOver(new PuzzleEngineAlpha.Actions.SetEnumeratorValueAction(this.enumerator, 0)); ButtonCount = 1; components[0].Camera = this.camera; int i = 1; foreach (var resolution in PuzzleEngineAlpha.Resolution.ResolutionHandler.GetSupportedResolutions()) { textProperties.text = resolution.Key; components.Add(new PuzzleEngineAlpha.Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, i * ButtonSize.Y), ButtonSize, this.MenuRectangle)); components[i].StoreAndExecuteOnMouseRelease(new PuzzleEngineAlpha.Actions.ApplyResolutionAction(resolutionHandler, resolution.Value)); // components[i].StoreAndExecuteOnMouseOver(new PuzzleEngineAlpha.Actions.SetEnumeratorValueAction(this.enumerator, i)); components[i].Camera = camera; i++; ButtonCount++; } // foreach (AGUIComponent component in components) // enumerator.AddGUIComponent(component); components[0].IsFocused = true; camera = new Camera(Vector2.Zero, GUIAreaSize, Size); vScrollBar = new VScrollBar(Content.Load <Texture2D>(@"ScrollBars/bullet"), Content.Load <Texture2D>(@"ScrollBars/bar"), camera, new Vector2(this.Size.X - ScrollBarWidth, 0) + Location, new Vector2(ScrollBarWidth, Size.Y - 5), PuzzleEngineAlpha.Scene.DisplayLayer.Editor + 0.1f); ResetSizes(this, EventArgs.Empty); }