public BigLabeledButtonComponent(Screen screen, Texture buttonTexture, Vector2f position, string text, Color buttonColor, Action onClick)
            : base(screen)
        {
            _buttonTexture = buttonTexture;
            _position = position;
            _buttonColor = buttonColor;
            _selectedColor = new Color(
                (byte)Math.Min(255, (int)_buttonColor.R + 50),
                (byte)Math.Min(255, (int)_buttonColor.G + 50),
                (byte)Math.Min(255, (int)_buttonColor.B + 50),
                255);
            _onClick = onClick;
            _font = ResourceManager.getResource<Font>("immortal_font");

            // Initialize button shape
            _buttonShape = new RectangleShape();
            _buttonShape.Texture = _buttonTexture;
            _buttonShape.Position = position;
            _buttonShape.Size = new Vector2f(_buttonShape.Texture.Size.X, _buttonShape.Texture.Size.Y);
            _buttonShape.FillColor = _buttonColor;

            // Initialize text
            _firstLetter = new Text(text.Substring(0, 1), _font, 72);
            _firstLetter.Position = position + new Vector2f(30, 0);
            _firstLetter.Color = Color.White;
            _firstLetterShadow = new Text(_firstLetter.DisplayedString, _font, 72);
            _firstLetterShadow.Position = _firstLetter.Position + new Vector2f(3, 3);
            _firstLetterShadow.Color = Color.Black;
            _word = new Text(text.Substring(1, text.Length - 1), _font, 48);
            _word.Position = _firstLetter.Position + new Vector2f(_firstLetter.GetLocalBounds().Width + 4, 13);
            _word.Color = Color.White;
            _wordShadow = new Text(_word.DisplayedString, _font, 48);
            _wordShadow.Position = _word.Position + new Vector2f(3, 3);
            _wordShadow.Color = Color.Black;
        }
        public ClassSelectorComponent(Screen screen, Texture upArrowTexture, Texture downArrowTexture, Texture classSelectorTexture, List<Texture> classTextures, Vector2f position)
            : base(screen)
        {
            _position = position;
            _classTextures = classTextures;

            _upArrow = new RectangleShape();
            _upArrow.Position = position + new Vector2f(0f, -42f);
            _upArrow.Origin = new Vector2f(8f, 8f);
            _upArrow.Texture = upArrowTexture;
            _upArrow.Size = new Vector2f(16f, 16f);

            _classSelector = new RectangleShape();
            _classSelector.Position = position;
            _classSelector.Origin = new Vector2f(32f, 32f);
            _classSelector.Texture = classSelectorTexture;
            _classSelector.Size = new Vector2f(64f, 64f);

            _classIcon = new RectangleShape();
            _classIcon.Position = position;
            _classIcon.Origin = new Vector2f(32f, 32f);
            _classIcon.Texture = _classTextures[(int)_selectedClass];
            _classIcon.Size = new Vector2f(64f, 64f);

            _downArrow = new RectangleShape();
            _downArrow.Position = position + new Vector2f(0f, 42f);
            _downArrow.Origin = new Vector2f(8f, 8f);
            _downArrow.Texture = downArrowTexture;
            _downArrow.Size = new Vector2f(16f, 16f);
        }
 public SelectedCharacterComponent(Screen screen, Texture texture)
     : base(screen)
 {
     _texture = texture;
     _shape = new RectangleShape(new Vector2f(_texture.Size.X, _texture.Size.Y));
     _shape.Texture = _texture;
     _shape.Origin = new Vector2f(_texture.Size.X, _texture.Size.Y) / 2f;
 }
 public CharacterStatusComponent(Screen screen, Font font, int entityId, Vector2f offset)
     : base(screen)
 {
     _font = font;
     _entityId = entityId;
     _text = new Text("", font, 14);
     _offset = offset;
 }
 public TemporaryWorldTextComponent(Screen screen, Font font, string value, Vector2 position)
     : base(screen)
 {
     _font = font;
     _value = value;
     _worldPosition = position;
     _text = new Text(value, font, 18);
 }
        public CharacterPaneComponent(Screen screen, Font font, int teamPosition)
            : base(screen)
        {
            _font = font;
            _teamPosition = teamPosition;
            _skillIconShapes = new RectangleShape[MAX_SKILL_ICONS];

            for (int i = 0; i < MAX_SKILL_ICONS; i++)
            {
                _skillIconShapes[i] = new RectangleShape();
                _skillIconShapes[i].Size = new Vector2f(32, 32);
            }

            _position = new Vector2f(16 + (WIDTH + 16) * teamPosition, 610);
            _backgroundColor = new Color(50, 50, 50, 128);
            _selectedOutlineColor = new Color(255, 255, 50);
            _deselectedOutlineColor = new Color(0, 0, 0);

            _backgroundShape = new RectangleShape(new Vector2f(WIDTH, HEIGHT));
            _backgroundShape.FillColor = _backgroundColor;
            _backgroundShape.OutlineColor = _deselectedOutlineColor;
            _backgroundShape.OutlineThickness = 2f;
            _backgroundShape.Position = _position;

            _classLabel = new Text("", _font, 14);
            _classLabel.Position = _position + new Vector2f(8f, 8f);
            _classLabel.Color = Color.White;

            _hpBarBackground = new RectangleShape();
            _hpBarBackground.Position = _position + new Vector2f(8f, 32f) + new Vector2f(-1f, -1f);
            _hpBarBackground.Size = new Vector2f((WIDTH - 16f) + 2f, 6f);
            _hpBarBackground.FillColor = Color.Black;

            _hpBarForeground = new RectangleShape();
            _hpBarForeground.Position = _position + new Vector2f(8f, 32f);
            _hpBarForeground.Size = new Vector2f(WIDTH - 16f, 4f);
            _hpBarForeground.FillColor = Color.Green;
        }
Example #7
0
 public ScreenComponent(Screen screen)
 {
     _screen = screen;
 }
Example #8
0
 public static void addScreen(Screen screen)
 {
     _screensToAdd.Add(screen);
 }