GetTexture() public method

Get the texture containing the glyphs of a given size
public GetTexture ( uint characterSize ) : Texture
characterSize uint Character size
return Texture
Exemplo n.º 1
0
        public void Initialize()
        {
            //To override any of the following, change the variable after calling this function in the constructor
            goldfish = new Font("./assets/goldfish.ttf");
            goldfish.GetTexture(8).Smooth = false;
            nameText = new Text(name, goldfish, 9);
            nameText.Color = Color.Black;
            nameText.Position = new Vector2f(position.X - ((nameText.GetLocalBounds().Width / 4) + 8), position.Y + 17);
            nameText.Style = Text.Styles.Regular;
            healthbarOuter = new RectangleShape(new Vector2f(nameText.GetLocalBounds().Width + 5, nameText.GetLocalBounds().Height + 3));
            healthbar = new RectangleShape(healthbarOuter);
            healthbar.Size = new Vector2f(healthbarOuter.Size.X - 2, healthbarOuter.Size.Y - 2);
            fullHealthPixels = (int)healthbar.Size.X;
            healthbar.FillColor = new Color(153, 255, 153, 170);
            healthbarOuter.FillColor = new Color(0, 0, 0, 120);
            
            orientation = Direction.Down;
            isMoving = false;

            activeWeapon = new Weapon();

            walkingUp = new Animation();
            walkingUp.addFrame(new IntRect(0, 0, 16, 18));
            walkingUp.addFrame(new IntRect(16, 0, 16, 18));
            walkingUp.addFrame(new IntRect(32, 0, 16, 18));

            walkingRight = new Animation();
            walkingRight.addFrame(new IntRect(0, 18, 16, 18));
            walkingRight.addFrame(new IntRect(16, 18, 16, 18));
            walkingRight.addFrame(new IntRect(32, 18, 16, 18));

            walkingDown = new Animation();
            walkingDown.addFrame(new IntRect(0, 18 * 2, 16, 18));
            walkingDown.addFrame(new IntRect(16, 18 * 2, 16, 18));
            walkingDown.addFrame(new IntRect(32, 18 * 2, 16, 18));

            walkingLeft = new Animation();
            walkingLeft.addFrame(new IntRect(0, 18 * 3, 16, 18));
            walkingLeft.addFrame(new IntRect(16, 18 * 3, 16, 18));
            walkingLeft.addFrame(new IntRect(32, 18 * 3, 16, 18));

            boundingbox = new IntRect((int)position.X, (int)position.Y, 16, 16);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get the texture containing the glyphs of a given size
        /// </summary>
        /// <param name="characterSize">Character size</param>
        /// <returns>Texture storing the glyphs for the given size</returns>
        public Textures.Texture GetTexture(uint characterSize)
        {
            var texture = SFMLFont.GetTexture(characterSize);

            return(new Textures.Texture(texture));
        }
Exemplo n.º 3
0
 internal virtual Texture GetTexture(int size)
 {
     return(new Texture(font.GetTexture((uint)size)));
 }