예제 #1
0
 protected override void LoadScreenContent(ContentManager content)
 {
     background = new Background(content);
     titleText = new Text(font, "Drive & Dodge!",
         new Vector2(0, (int)(ScreenHeight/3)),
         Color.Brown, Color.Beige,
         Text.Alignment.Horizontal,
         new Rectangle(0, 0, ScreenWidth, 0));
     startButton = new Button(content, "Start Game", new Vector2(30, 500), Color.BurlyWood);
     exitButton = new Button(content, "Exit", new Vector2(30, 650), Color.BurlyWood );
 }
예제 #2
0
        public Button(ContentManager content, 
            string displayText,
            Vector2 displayPosition,
            Color color)
            : base(content, "Images/Button")
        {
            Position = displayPosition;
            this.displayText = displayText;
            this.color = color;

            touchArea = new Rectangle((int) displayPosition.X,
                                      (int) displayPosition.Y, texture.Width, texture.Height);
            buttonFont = content.Load<SpriteFont>("Fonts/buttonFont");
            buttonText = new Text(buttonFont, displayText, Vector2.Zero, Color.White,
                                  Text.Alignment.Both, TouchArea);
        }