예제 #1
0
 public ITextureRegion AddRegion(string name, int x, int y, int width, int height)
 {
     var region = new TextureRegion(this, name, x, y, width, height);
     _regionList.Add(region);
     return region;
 }
예제 #2
0
        private void Draw(TextureRegion textureRegion, IRectangle destinationRectangle)
        {
            var texture = _textureMap[textureRegion.TextureAtlas.TextureName];

            if(texture != null)
            {
                var sourceRectangle = new Rectangle(textureRegion.X, textureRegion.Y, textureRegion.Width, textureRegion.Height);

                _spriteBatch.Draw(texture, ToRectangle(destinationRectangle), sourceRectangle, Color.White);
            }
        }