Пример #1
0
 public UILabel(PixelFont font, Vector2 position, float scale = 1.0f)
     : base(new Vector2(), position)
 {
     _font = font;
     _text = new PixelText(font, scale);
     Colour = Color4.Black;
     CanResize = false;
     IsEnabled = false;
 }
Пример #2
0
        public UITextBox(Vector2 size, Vector2 position, float scale = 1.0f)
            : base(size, position)
        {
            PaddingLeft = PaddingTop = PaddingRight = PaddingBottom = 4.0f * scale;

            _sprite = new FrameSprite(PanelsTexture, scale) {
                SubrectSize = new Vector2(16, 16),
                SubrectOffset = new Vector2(0, 32),
                FrameTopLeftOffet = new Vector2(4, 4),
                FrameBottomRightOffet = new Vector2(4, 4),
                Size = size
            };

            _font = PixelFont.Large;
            _text = new UILabel(_font, scale);
            AddChild(_text);

            CharacterLimit = (int) (InnerWidth / (_font.CharWidth * scale));

            _underlineChar = new Sprite(scale * _font.CharWidth, scale * 2.0f, OpenTK.Graphics.Color4.Black);
        }
Пример #3
0
 public PixelText(PixelFont font, float scale = 1.0f)
     : base(font.Texture, scale)
 {
     _text = "";
     _font = font;
 }
Пример #4
0
        public UILabel(PixelFont font, float scale = 1.0f)
            : this(font, new Vector2(), scale)
        {

        }