//private GraphicsDeviceManager Graphics; ////constructor //public MenuScreen(GraphicsDeviceManager graphics) //{ // this.Graphics = graphics; //} /// <summary> /// /// </summary> public override void LoadContent() { //DrawShape draw = new DrawShape(); //Texture2D circleOverlay = draw.drawShape("Circle", 20, this.Graphics); this.content = new ContentManager(ScreenManager.Game.Services, "Content"); this.menuBackground = this.content.Load<Texture2D>("Sprites/MenuBackground"); //Buttons are 300 x 75 but lets change it to have the drawShape method make the shape for us DrawShape mydraw = new DrawShape(); //Texture2D exitText = mydraw.drawShape("Square", 100, this.Graphics); //Texture2D patientText = mydraw.drawShape("Circle", 100, this.Graphics); //Texture2D optionsText = mydraw.drawShape("Rectanlge", 100, this.Graphics); Texture2D exitText = content.Load<Texture2D>("GUI/ExitButton"); Texture2D patientText = content.Load<Texture2D>("GUI/PatientButton"); Texture2D optionsText = content.Load<Texture2D>("GUI/OptionsButton"); int menuX = (ScreenManager.GraphicsDevice.Viewport.Width / 2) - (menuBackground.Width / 2); int menuY = (ScreenManager.GraphicsDevice.Viewport.Height / 2) - (menuBackground.Height / 2); menuRect = new Rectangle(menuX, menuY, menuBackground.Width, menuBackground.Height); int buttonSpace = 75; int buttonX = menuX + (menuBackground.Width / 2) - 150; int buttonY = menuY + buttonSpace; Rectangle patientRect = new Rectangle(buttonX, buttonY, patientText.Width, patientText.Height); Rectangle optionsRect = new Rectangle(buttonX, patientRect.Y + buttonSpace + patientText.Height, optionsText.Width, optionsText.Height); Rectangle exitRect = new Rectangle(buttonX, optionsRect.Y + buttonSpace + exitText.Height, exitText.Width, exitText.Height); exitButton = new GameLibrary.UI.Button(exitText, exitRect); patientButton = new GameLibrary.UI.Button(patientText, patientRect); optionsButton = new GameLibrary.UI.Button(optionsText, optionsRect); }
protected override void Update(GameTime gameTime) { //Get the current state of the Mouse MouseState aMouse = Mouse.GetState(); testObject1.Update(aMouse); testObject2.Update(aMouse); //optionsButton.Update(aMouse); foreach (Button myBut in buttonList) { myBut.Update(aMouse); } foreach (Button myBut in buttonList) { if (myBut.IsClicked()) { Console.WriteLine("Your but has been clicked"); myBut.Rect = new Rectangle(750, 750, 50, 50); } } if (testObject1.IsClicked()) { DrawShape mydraw = new DrawShape(); //Texture2D exitText = mydraw.drawShape("Circle", 100, graphics); Rectangle exitRect = new Rectangle(500, 500, 100, 100); Texture2D exitText = new DrawNumber("5", exitRect, Color.Green).drawNumber(graphics, Content); Button temp = new Button(exitText, exitRect); buttonList.Add(temp); } else if (testObject2.IsClicked()) { DrawShape mydraw = new DrawShape(); //Texture2D exitText = mydraw.drawShape("Triangle", 50, graphics); Rectangle exitRect = new Rectangle(500, 100, 100, 100); Texture2D exitText = new DrawLetter("G", exitRect, Color.Green).drawLetter(graphics, Content); Button temp = new Button(exitText, exitRect); buttonList.Add(temp); } //else if (optionsButton.IsClicked()) // { //OptionsScreen os = new OptionsScreen(); // ScreenManager.AddScreen(os, false); // this.ScreenState = State.Hidden; // Cursor.Current = Cursors.WaitCursor; // } base.Update(gameTime); }