//Creates Buttons on the screen. private Texture2D grabObject(GraphicsDeviceManager graphics, ContentManager content) { Texture2D texture; texture = DrawShape.drawShape(objectName, rectangle.Width, graphics); if (shapeType == "Shape") { texture = DrawShape.drawShape(objectName, rectangle.Width, graphics); } else if (shapeType == "Letter") { DrawLetter draw = new DrawLetter(objectName, rectangle, color); texture = draw.drawLetter(graphics, content); } else if (shapeType == "Number") { DrawNumber draw = new DrawNumber(objectName, rectangle, color); texture = draw.drawNumber(graphics, content); } else { Console.WriteLine("There was an error in Object.cs"); } return texture; }
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); }