protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); font = Content.Load<SpriteFont>("Fonts/Georgia"); Texture2D texture = Content.Load<Texture2D>("Textures/Square"); Group group = new Group(); Button playButton = new Button(); playButton.Font = font; playButton.Texture = texture; playButton.Bounds = new Rectangle(50, 50, 300, 20); playButton.Action += PlayGame; playButton.Text = "Play"; group.Children.Add(playButton); CheckBox optionBox = new CheckBox(); optionBox.Texture = texture; optionBox.Font = font; optionBox.Box = texture; optionBox.Bounds = new Rectangle(50, 75, 300, 20); optionBox.Action += MakeFullScreen; optionBox.Text = "Full Screen"; group.Children.Add(optionBox); guiElements.Add(group); scenes.Add(GameState.Menu, new Scene(MainMenuUpdate, MainMenuDraw)); scenes.Add(GameState.Play, new Scene(PlayUpdate, PlayDraw)); //scenes.Add(GameState.Pause, new Scene(PauseUpdate, PauseDraw)); currentScene = scenes[GameState.Menu]; }
public TextPanel(Vector2 position, int cubeNumber) { Position = position; CubeNumber = cubeNumber.ToString("D2"); CloseButton = new Button(position.X + 423, position.Y + 16, "UI/ButtonClose", Events.ShowHideDataCubePanel); CloseButton.DeregisterEvents(); Game1.EventMan.Register(Events.ShowHideDataCubePanel, ShowHideDataCubePanel); }
private void Init () { listboxParts = new Texture2D[4]; listboxParts[0] = BaseGame.ContentMgr.Load<Texture2D>( Path.Combine( Directories.UIContent, "textbox_left" ) ); listboxParts[1] = BaseGame.ContentMgr.Load<Texture2D>( Path.Combine( Directories.UIContent, "textbox_middle" ) ); listboxParts[2] = BaseGame.ContentMgr.Load<Texture2D>( Path.Combine( Directories.UIContent, "textbox_right" ) ); listboxRect = new Rectangle( 0, 0, (width - listboxParts[0].Width) - listboxParts[1].Width, listboxParts[0].Height ); listBoxButton = new Button( "bt_Combo", "combo_button", position + new Vector2( listboxParts[0].Width + listboxParts[1].Width + listboxParts[2].Width, 0f ), Color.White ); listBoxButton.OnMousePress += new EventHandler( listBoxButton_onMousePress ); }
public virtual void Setup() { // Center in screen float x = (Game1.SCREEN_WIDTH - 896) / 2; float y = (Game1.SCREEN_HEIGHT - 500) / 2; Position = new Vector2(x, y); ButtonClose = new Button((int)x + 816, (int)y + 20, "UI/ButtonCLose", PanelEvent); ButtonClose.DeregisterEvents(); }
public UISettings() { PanelEvent = Events.ShowHideSettings; base.Setup(); Quit = new Button(Position.X + 564, Position.Y + 380, "UI/ButtonQuit", Events.Quit); SoundVolume = new ProgressBar(new Vector2(Position.X + 415, Position.Y + 130), 0.5f, Events.SFXVolume); MusicVolume = new ProgressBar(new Vector2(Position.X + 415, Position.Y + 200), 0.5f, Events.MusicVolume); Quit.DeregisterEvents(); Game1.EventMan.Register(Events.Quit, QuitGame); }
public UIWiki() { CrittersAvailable = DB.CurrentSave.CrittersFound; PanelEvent = Events.ShowHideWiki; base.Setup(); CritterStartPosition = new Vector2(Position.X + 73, Position.Y + 65); Left = new Button(Position.X + 15, Position.Y + 200, "UI/ButtonLeft", Events.WikiPageLeft); Right = new Button(Position.X + 833, Position.Y + 200, "UI/ButtonRight", Events.WikiPageRight); Left.DeregisterEvents(); Right.DeregisterEvents(); Game1.EventMan.Register(Events.WikiPageLeft, WikiPageLeft); Game1.EventMan.Register(Events.WikiPageRight, WikiPageRight); }
private void Init () { switch (axis) { case Axis.Horizontal: scrollUp = new Button( "btScrollUp", "scroll_left", position, new Color( new Vector4( 0.9f, 0.9f, 0.9f, 1f ) ) );//, /*style,*/ true ); scrollDown = new Button( "btScrollDown", "scroll_right", position + new Vector2( size.X - scrollUp.size.Y, 0f ), new Color( new Vector4( 0.9f, 0.9f, 0.9f, 1f ) ) ); size.Y = scrollUp.size.Y; break; case Axis.Vertical: scrollUp = new Button( "btScrollUp", "scroll_up", position, new Color( new Vector4( 0.9f, 0.9f, 0.9f, 1f ) ) );//, /*style,*/ true ); scrollDown = new Button( "btScrollDown", "scroll_down", position + new Vector2( 0f, size.Y - scrollUp.size.Y ), new Color( new Vector4( 0.9f, 0.9f, 0.9f, 1f ) ) );//,/* style,*/ true ); size.X = scrollUp.size.X; break; } CreateTexture(); RedrawScroller(); }
public NumericUpDown ( string name, Vector2 position, int width, int min, int max, int value, int increment ) { Type = ControlType.NumericUpDown; this.name = name; this.position = position; this.width = width; this.min = min; this.max = max; this.value = value; this.increment = increment; if (this.increment == 0) this.increment = 1; textbox = new Textbox( "txt_numericUpDown", position, width, value.ToString(), true );//, HUD.TextFont, Form.Style.Default); buttonUp = new Button( "bt_numericUp", "numeric_up", new Vector2( position.X + width, position.Y - 2 ), new Color( new Vector4( 0.9f, 0.9f, 0.9f, 1f ) ) );//, Form.Style.Default, true); buttonDown = new Button( "bt_numericDown", "numeric_down", new Vector2( position.X + width, position.Y + buttonUp.size.Y ), new Color( new Vector4( 0.9f, 0.9f, 0.9f, 1f ) ) );//, Form.Style.Default, true); buttonUp.OnMouseRelease += new EventHandler( onButtonUp ); buttonDown.OnMouseRelease += new EventHandler( onButtonDown ); textbox.OnKeyPress += new EventHandler( onKeyPress ); }