public TextureAtlas(int tilesPerCol, int tilesPerRow, Texture texture, Rectangle[] frames) { TilesPerCol = tilesPerCol; TilesPerRow = tilesPerRow; FrameCount = tilesPerRow*tilesPerCol; Texture = texture; CreateUvMappings(frames); }
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); }
public TextureAtlas(int tilesPerCol, int tilesPerRow, Texture texture, int tileSize) : this(tilesPerCol, tilesPerRow, texture, CreateFrames(tilesPerCol, tilesPerRow, tileSize)) { }