Exemplo n.º 1
0
 public Tilemap(Entity entity, uint tileWidth, uint tileHeight, ITexels texture) : base(entity)
 {
     this.texture     = texture;
     this.tileWidth   = tileWidth;
     this.tileHeight  = tileHeight;
     this.frameHelper = new FrameHelper(tileWidth, tileHeight);
     this.vbo         = new VertexBuffer(6, PrimitiveType.Triangles, VertexBuffer.UsageSpecifier.Static);
 }
Exemplo n.º 2
0
 public AnimatedSprite(Entity entity, ITexels texture, uint frameWidth, uint frameHeight) : base(entity)
 {
     this.texture        = texture;
     this.vao            = new Vertex[6];
     this.Color          = null;
     this.frameHelper    = new FrameHelper(frameWidth, frameHeight);
     this.animationClock = new Clock();
     this.animations     = new Dictionary <string, Animation>();
 }
Exemplo n.º 3
0
 public AnimatedSprite(Entity entity) : base(entity)
 {
     this.texture        = null;
     this.vao            = new Vertex[6];
     this.Color          = null;
     this.frameHelper    = null;
     this.animationClock = new SFML.System.Clock();
     this.animations     = new Dictionary <string, Animation>();
 }
Exemplo n.º 4
0
        public virtual TexelsAtlas GetFrameTexel(ITexels texture, uint frameId)
        {
            var framesWide = texture.Width / this.Width;

            var frameRow    = frameId / framesWide;
            var frameColumn = frameId % framesWide;

            var frameTopLeft = texture.TopLeft + new Vector2(frameColumn * this.Width, frameRow * this.Height);

            return(new TexelsAtlas(texture.Texture, (ushort)frameTopLeft.X, (ushort)frameTopLeft.Y, (ushort)this.Width, (ushort)this.Height));
        }
Exemplo n.º 5
0
        public void SetTextureData(ITexels texture, uint tileWidth, uint tileHeight, FrameHelper frameHelper = null)
        {
            this.texture    = texture;
            this.tileWidth  = tileWidth;
            this.tileHeight = tileHeight;

            if (frameHelper != null)
            {
                this.frameHelper = frameHelper;
            }
            else
            {
                this.frameHelper = new FrameHelper(tileWidth, tileHeight);
            }

            this.rebuildVBO();
        }
Exemplo n.º 6
0
        public static AnimatedSprite Create(Entity entity, ITexels texture)
        {
            SpritesheetStyle type = SpritesheetStyle.Standard;

            var ret = new AnimatedSprite(entity);

            switch (type)
            {
            case SpritesheetStyle.Oversized:
                ret.SetTextureData(texture, OversizedFrameHelper);
                break;

            default:
                ret.SetTextureData(texture, StandardFrameHelper);
                break;
            }

            return(ret);
        }
Exemplo n.º 7
0
 public BasicSprite(Entity entity, ITexels texture) : base(entity)
 {
     this.texture = texture;
     this.vao     = new Vertex[6];
     this.Color   = null;
 }
Exemplo n.º 8
0
 public void SetTextureData(ITexels texture, FrameHelper frameHelper)
 {
     this.texture     = texture;
     this.frameHelper = frameHelper;
 }
Exemplo n.º 9
0
 public void SetTextureData(ITexels texture, uint frameWidth, uint frameHeight)
 {
     this.texture     = texture;
     this.frameHelper = new FrameHelper(frameWidth, frameHeight);
 }
Exemplo n.º 10
0
        public ITexels PackTexels(ITexels texels)
        {
            var ret = new TexelsAtlas(WorkingTexture, 0, 0, texels.Width, texels.Height);

            return(ret);
        }