Exemple #1
0
 public TileSet(TileSetInfo info, Texture2D texture)
 {
     this.info    = info;
     this.texture = texture;
     tiles        = new Tile[info.Width * info.Height];
     w            = info.Width; h = info.Height;
     clearSet();
 }
Exemple #2
0
        public static TileSetInfo loadFromStream(System.IO.Stream stream)
        {
            System.IO.BinaryReader reader = new System.IO.BinaryReader(stream);

            uint width  = uint.Parse(Utility.readToBrakpoint(reader));
            uint height = uint.Parse(Utility.readToBrakpoint(reader));

            TileSetInfo info = new TileSetInfo(width, height);

            stream.Close();

            return(info);
        }
Exemple #3
0
        public static TileSet loadFromTexture(Texture2D texture, TileSetInfo info, TileMask[] masks)
        {
            TileSet ts = new TileSet(info, texture);

            for (uint y = 0; y < ts.Height; y++)
            {
                for (uint x = 0; x < ts.Width; x++)
                {
                    ts.setTile(x, y, new Tile(ts, masks[x + y * ts.Width], x + y * ts.Width));
                }
            }

            return(ts);
        }