Пример #1
0
        static void LoadTextures(PrismMap map, BinaryReader file)
        {
            #region VERSION 0+
            if (map.fileStructureVersion >= 0)
            {
                int n = file.ReadInt32();

                for (int i = 0; i < n; i++)
                {
                    string name = file.ReadString();

                    int    bitmapBytes = file.ReadInt32();
                    Bitmap bitmap      = new Bitmap(new MemoryStream(file.ReadBytes(bitmapBytes)));

                    PrismTexture set = new PrismTexture(name, bitmap);

                    int tileN = file.ReadInt32();
                    for (int j = 0; j < tileN; j++)
                    {
                        string     tileName = file.ReadString();
                        RectangleF rect     = new RectangleF(file.ReadSingle(), file.ReadSingle(), file.ReadSingle(), file.ReadSingle());

                        set.AddTile(new PrismTexture.Tile(tileName, rect, set));
                    }

                    map.AddTexture(set);
                }
            }
            #endregion
        }
Пример #2
0
 public void AddTexture(PrismTexture t)
 {
     textureList.Add(t);
 }
Пример #3
0
 public Tile(string name, RectangleF uv, PrismTexture texture)
 {
     this.name    = name;
     this.uv      = uv;
     this.texture = texture;
 }