示例#1
0
文件: Block.cs 项目: beamery/bTris
 public Block(TextureManager textureManager, Engine.Color color, int gridPosX, int gridPosY)
 {
     sprite = new Sprite();
     sprite.Texture = textureManager.Get("block");
     sprite.SetScale(0.625, 0.625);
     sprite.SetColor(color);
     this.gridPosX = gridPosX;
     this.gridPosY = gridPosY;
 }
示例#2
0
        private void SetFont(CharacterData charData, Sprite sprite, Texture texture)
        {
            sprite.Texture = _texture;
            Point topLeft = new Point((float)charData.X / (float)_texture.Width,
                                      (float)charData.Y / (float)_texture.Height);
            Point bottomRight = new Point(topLeft.X + ((float)charData.Width / (float)_texture.Width),
                                          topLeft.Y + ((float)charData.Height / (float)_texture.Height));

            sprite.SetUVs(topLeft, bottomRight);
            sprite.SetWidth(charData.Width);
            sprite.SetHeight(charData.Height);
            sprite.SetColor(new Color(1, 1, 1, 1));
        }
示例#3
0
        public CharacterSprite CreateSprite(char c)
        {
            CharacterData charData = _characterData[c];
            Sprite sprite = new Sprite();
            sprite.Texture = _texture;

            // Setup UVs
            Point topLeft = new Point((float)charData.X / (float)_texture.Width,
                                        (float)charData.Y / (float)_texture.Height);
            Point bottomRight = new Point(topLeft.X + ((float)charData.Width / (float)_texture.Width),
                                          topLeft.Y + ((float)charData.Height / (float)_texture.Height));
            sprite.SetUVs(topLeft, bottomRight);
            sprite.SetWidth(charData.Width);
            sprite.SetHeight(charData.Height);
            sprite.SetColor(new Color(1, 1, 1, 1));

            return new CharacterSprite(sprite, charData);
        }
        public CharacterSprite CreateSprite(char c)
        {
            CharacterData charData = _characterData[c];
            Sprite        sprite   = new Sprite();

            sprite.Texture = _texture;

            // Setup UVs
            Point topLeft = new Point((float)charData.X / (float)_texture.Width,
                                      (float)charData.Y / (float)_texture.Height);
            Point bottomRight = new Point(topLeft.X + ((float)charData.Width / (float)_texture.Width),
                                          topLeft.Y + ((float)charData.Height / (float)_texture.Height));

            sprite.SetUVs(topLeft, bottomRight);
            sprite.SetWidth(charData.Width);
            sprite.SetHeight(charData.Height);
            sprite.SetColor(new Color(1, 1, 1, 1));

            return(new CharacterSprite(sprite, charData));
        }