Exemple #1
0
        public void AddLabel(GUILabel label)
        {
            //Add padding value to label position
            label.Position = new Vector2(Position.X + label.Position.X + borderPadding.X, Position.Y + label.Position.Y + borderPadding.Y);

            //If label is in the menu
            if (label.Rectangle.Intersects(this.Rectangle))
            {
                labels.Add(label);
            }
            else
            {
                labels.Add(label);
                Debug.Log("Button out of bounds"
                          + " X: " + label.Position.X
                          + " Y: " + label.Position.Y
                          + " W: " + label.Width
                          + " H: " + label.Height);
            }
        }
Exemple #2
0
        public GUIManager(ContentManager Content)
        {
            mediumFont = Content.Load <SpriteFont>("textFont");
            hugeFont   = Content.Load <SpriteFont>("messageFont");
            hudFont    = Content.Load <SpriteFont>("hudFont");
            smallFont  = Content.Load <SpriteFont>("upgradeFont");
            bigFont    = Content.Load <SpriteFont>("bigFont");

            toolTip = new GUITooltip(Content, mediumFont);

            windows = new List <GUIWindow>();
            labels  = new List <GUILabel>();
            sprites = new List <GUISprite>();

            crossHair  = new GUISprite(Content, "crosshair", Vector2.Zero);
            scoreLabel = new GUILabel(hudFont, GameManager.SpaceCash.ToString(), new Vector2(Game.GAME_WIDTH - 80, 37));
            sprites.Add(new GUISprite(Content, "spaceCash", new Vector2(Game.GAME_WIDTH - 140, 30)));

            messagePosition = new Vector2(Game.GAME_WIDTH / 2, 100);
            messageDuration = 5000;
        }