Ejemplo n.º 1
0
        public override void Draw()
        {
            MouseState mouse = Mouse.GetState();

            posX = mouse.Position.X;
            posY = mouse.Position.Y;
            for (int i = 0; i < subMenus.Count; i++)
            {
                batch.Draw(BasicShapes.Rect(300, 75), new Vector2(posX, posY + 75 * i), subMenus[i].backgroundColor);
                batch.DrawString(game.font, subMenus[i].Text, new Vector2(posX, posY + 75 * i), Color.Black);

                if (Utils.isInRect(mouse.Position.ToVector2(), posX, posY + 75 * i, posX + 300, posY + 75 * (i + 1)))
                {
                    batch.Draw(BasicShapes.Rect(300, 75, false, 5), new Vector2(posX, posY + 75 * i), Color.Black);
                    Mouse.SetCursor(MouseCursor.Hand);
                    if (mouse.LeftButton == ButtonState.Pressed)
                    {
                        subMenus[i].onClick();
                    }
                }
                else
                {
                    Mouse.SetCursor(MouseCursor.Arrow);
                }
            }
        }
Ejemplo n.º 2
0
 void drawHovered()
 {
     batch.Draw(BasicShapes.Rect(size, size), new Vector2(posX - size / 2, posY - size / 2), Color.Gray);
     batch.Draw(BasicShapes.Rect(size, size, false, size / 15), new Vector2(posX - size / 2, posY - size / 2), Color.DarkGray);
 }
Ejemplo n.º 3
0
 void drawDefault()
 {
     batch.Draw(BasicShapes.Rect(size, size), new Vector2(posX - size / 2, posY - size / 2), Color.White);
     batch.Draw(BasicShapes.Rect(size, size, false, size / 10), new Vector2(posX - size / 2, posY - size / 2), Color.LightGray);
 }