コード例 #1
0
ファイル: ButtonRenderer.cs プロジェクト: Cellmon95/WarGames
        public ButtonRenderer(Button data)
        {
            this.data = data;
            body = new RectangleShape();
            body.Position = data.Position;
            body.Size = data.Size;
            body.FillColor = data.FillColor;
            body.OutlineColor = data.OutlineColor;
            body.OutlineThickness = data.OutlineThicknes;

            text = new Text(data.Text, Assets.ArialFont);
            text.Position = new SFML.Window.Vector2f(data.Position.X + data.Size.X / 2 - 20, data.Position.Y - 3);
            text.CharacterSize = 18;
            text.Color = data.TextColor;
        }
コード例 #2
0
ファイル: ButtonRenderer.cs プロジェクト: Cellmon95/Wargames2
        public ButtonRenderer(Button data)
        {
            this.data = data;
            body = new RectangleShape
            {
                Position = data.Position,
                Size = data.Size,
                FillColor = data.FillColor,
                OutlineColor = data.OutlineColor,
                OutlineThickness = data.OutlineThicknes
            };

            text = new Text(data.Text, Assets.ArialFont)
            {
                Position = new SFML.Window.Vector2f(data.Position.X + data.Size.X/2 - 20, data.Position.Y - 3),
                CharacterSize = 18,
                Color = data.TextColor
            };
        }
コード例 #3
0
 /// <summary>
 /// This method make sure that you can only select one button att a time and
 /// also make so that when you select a button the button before will 
 /// deselect.
 /// </summary>
 /// <param name="selectedButton"></param>
 /// <param name="status"></param>
 private void selectButtonAndStatus(Button selectedButton, UnitHandler.UnitStatus status)
 {
     if (curentSelectedButton == null)
     {
         curentSelectedButton = selectedButton;
         curentSelectedButton.Selected = true;
         screen.UnitHandler.CurrentUnitStatus = status;
     }
     else if (selectedButton == curentSelectedButton)
     {
         curentSelectedButton.Selected = false;
         curentSelectedButton = null;
         screen.UnitHandler.CurrentUnitStatus = UnitHandler.UnitStatus.NONE;
     }
     else if (curentSelectedButton != null)
     {
         curentSelectedButton.Selected = false;
         curentSelectedButton = selectedButton;
         curentSelectedButton.Selected = true;
         screen.UnitHandler.CurrentUnitStatus = status;
     }
 }