示例#1
0
        private void LoadDeltas(string fileName)
        {
            var dict = TextureAtlas.Deserialize <TextureAtlasDeltas>(fileName);

            _deltaImage = new LockBitmap((Bitmap)Image.FromFile(Extensions.CheckDirectorySeparator(Path.GetDirectoryName(fileName)) + dict.ImagePath));
            TextureAtlasSprites.MergeDeltas(_spriteListWindow.TextureAltas.SpriteDictionary, dict.DeltaDictionary);
        }
示例#2
0
        private void LoadSprites(string fileName)
        {
            var dict = TextureAtlas.Deserialize <TextureAtlasSprites>(fileName);

            TextureAtlasSprites.FillSpriteId(dict.SpriteDictionary);

            _spriteListWindow.TextureAltas = dict;

            _spriteImage = new LockBitmap((Bitmap)_spriteListWindow.Image);
        }
示例#3
0
        /// <summary>
        /// Creates a new instance of Textures
        /// </summary>
        /// <param name="name">The name of texture file to load.</param>
        public Textures(String name)
        {
            String path = Globals.GraphicsSubDir + Path.DirectorySeparatorChar + name + Globals.TilesSuffix;

            TextureAtlasTiles dict = TextureAtlas.Deserialize <TextureAtlasTiles>(path + Globals.XmlFormat);

            tileAtlas = dict.TileDictionary;

            Bitmap bmp = (Bitmap)Image.FromFile(path + Globals.TextureImageFormat);

            pixelPerHeight = 1f / bmp.Height;
            pixelPerWidth  = 1f / bmp.Width;
        }