Exemplo n.º 1
0
 public TextureAtlas(int tilesPerCol, int tilesPerRow, Texture texture, Rectangle[] frames)
 {
     TilesPerCol = tilesPerCol;
     TilesPerRow = tilesPerRow;
     FrameCount = tilesPerRow*tilesPerCol;
     Texture = texture;
     CreateUvMappings(frames);
 }
Exemplo n.º 2
0
        public void Initialize()
        {
            ActorFactory.AddComponent<TransformComponent>();
            ActorFactory.AddComponent<SpriteComponent>();
            ActorFactory.AddComponent<SpinnerComponent>();

            var xml = File.ReadAllText(Data.Actors.AnimatedSquare);
            var doc = XDocument.Parse(xml);

            // create a bunch of Animated Squares
            for (int i = 0; i < 75; i++)
            {
                for (int j = 0; j < 75; j++)
                {
                    var actor = ActorFactory.Create(doc);
                    actor.TransformComponent.Move(i * 400, j * 400);
                    Repository.Add(actor);
                }
            }

            SpriteBatch = new SpriteBatch(6000, new DefaultShader());

            var tex = new Texture();
            tex.Load(Data.Images.TerrainDebug);
            _atlas = new TextureAtlas(4, 4, tex, 64);
        }
Exemplo n.º 3
0
 public TextureAtlas(int tilesPerCol, int tilesPerRow, Texture texture, int tileSize)
     : this(tilesPerCol, tilesPerRow, texture,
         CreateFrames(tilesPerCol, tilesPerRow, tileSize))
 {
 }