Exemplo n.º 1
0
        public SpriteParser(ITexture2D tex, IEngineChips chips, bool unique = true)
        {
            this.tex = tex;

            this.chips = chips;
            spriteChip = chips.spriteChip;
        }
Exemplo n.º 2
0
        public FontParser(IImageParser imageParser, IEngineChips chips, string name = "Default") : base(imageParser,
                                                                                                        chips, true, chips.fontChip)
        {
            fontChip = chips.fontChip;

            this.name = name;
        }
Exemplo n.º 3
0
        public FlagColorParser(IImageParser imageParser, IEngineChips chips) : base(imageParser)
        {
            flagColorChip = new ColorChip();

            chips.chipManager.ActivateChip(flagColorChipName, flagColorChip, false);

            maskColor = new ColorData(chips.colorChip.maskColor);
        }
Exemplo n.º 4
0
        public FlagColorParser(ITexture2D tex, IEngineChips chips)
        {
            flagColorChip = new ColorChip();

            chips.chipManager.ActivateChip(flagColorChipName, flagColorChip, false);

            maskColor = new ColorData(chips.colorChip.maskColor);
            flagTex   = tex;
        }
Exemplo n.º 5
0
//        private ITexture2D tileFlagTex;
//        private IColor clear;
//
//        private int flag;
//        private int offset;

        public TilemapParser(IImageParser imageParser, byte[] tileFlagData, IEngineChips chips) :
            base(imageParser, chips)
        {
            tilemapChip = chips.tilemapChip;

            autoImport = tilemapChip.autoImport;

//            clear = new ColorData(0f){a = 0f};
            maskColor = ColorUtils.HexToColor(chips.colorChip.maskColor);
        }
Exemplo n.º 6
0
//        protected ITextureFactory textureFactory;
//        protected byte[] data;

        public SpriteParser(IImageParser imageParser, IEngineChips chips, bool unique = true) : base(imageParser)
        {
//            this.textureFactory = textureFactory;



            this.chips = chips;
            spriteChip = chips.spriteChip;

            spriteWidth  = spriteChip.width;
            spriteHeight = spriteChip.height;
        }
Exemplo n.º 7
0
        public FontParser(IImageParser imageParser, IEngineChips chips, string name = "Default") : base(imageParser, chips)
        {
            fontChip = chips.fontChip;
            if (fontChip == null)
            {
                // Create a new font chip to store data
                fontChip = new FontChip();
                chips.chipManager.ActivateChip(fontChip.GetType().FullName, fontChip);
            }
//            this.autoImport = autoImport;
            this.name = name;
        }
Exemplo n.º 8
0
 public FontParser(ITexture2D tex, IEngineChips chips, string name = "Default", bool autoImport = true) : base(tex, chips)
 {
     fontChip = chips.fontChip;
     if (fontChip == null)
     {
         // Create a new font chip to store data
         fontChip = new FontChip();
         chips.chipManager.ActivateChip(fontChip.GetType().FullName, fontChip);
     }
     this.autoImport = autoImport;
     this.name       = name;
 }
Exemplo n.º 9
0
        public TilemapParser(ITexture2D tex, ITexture2D tileFlagTex, IEngineChips chips) : base(tex, chips)
        {
            //Debug.Log("Parse Tilemap");

            tilemapChip      = chips.tilemapChip;
            this.tileFlagTex = tileFlagTex;
            autoImport       = tilemapChip.autoImport;

            flagColorChip = chips.chipManager.GetChip(FlagColorParser.flagColorChipName, false) as ColorChip;


            clear = new ColorData {
                a = 0
            };
            maskColor = new ColorData(chips.colorChip.maskColor);
        }
Exemplo n.º 10
0
        public FlagColorExporter(string fileName, IEngineChips engineChips, ITextureFactory textureFactory)
        {
            fullFileName = fileName;

//            tilemapChip = engineChips.tilemapChip;

            totalFlags = engineChips.tilemapChip.totalFlags;

            gameChip = engineChips.gameChip;

            flagColorChip = engineChips.chipManager.GetChip(FlagColorParser.flagColorChipName, false) as ColorChip;

            tileSize = gameChip.SpriteSize();

            this.textureFactory = textureFactory;
        }
Exemplo n.º 11
0
 public SpriteDataParser(ITexture2D tex, IEngineChips chips, bool unique = true) : base(tex, chips, unique)
 {
 }
Exemplo n.º 12
0
 public SpriteDataParser(IImageParser imageParser, IEngineChips chips, bool unique = true) : base(imageParser, chips, unique)
 {
 }
Exemplo n.º 13
0
        public static void CovertSpritesToRawData(ref int[] pixelData, int[] spriteIDs, int width, IEngineChips chips)
        {
            var spriteChip = chips.spriteChip;

            var spriteWidth  = spriteChip.width;
            var spriteHeight = spriteChip.height;


            //TODO need to allow flipping and match the draw sprite API
            var realHeight = spriteHeight * MathUtil.CeilToInt(spriteIDs.Length / width);
            var realWidth  = spriteWidth * width;

            var data = new TextureData(realWidth, realHeight);

            //Debug.Log("Draw "+ids.Length + " sprites.");

            var total      = spriteIDs.Length;
            var spriteData = new int[8 * 8];

            for (var i = 0; i < total; i++)
            {
                var id = spriteIDs[i];
                if (id > -1)
                {
                    var newX = MathUtil.FloorToInt(i % width) * spriteWidth;
                    var newY = MathUtil.FloorToInt(i / width) * spriteWidth;
                    newY = realHeight - spriteHeight - newY;
                    spriteChip.ReadSpriteAt(id, spriteData);
                    data.SetPixels(newX, newY, spriteWidth, spriteHeight, spriteData);

                    //DrawSprite(id, newX, newY);
                }
            }

            data.CopyPixels(ref pixelData);

            //var pixelData = data.GetPixels();
            //return pixelData;
        }
Exemplo n.º 14
0
 public GifExporter(string fileName, IEngineChips engine) : base(fileName)
 {
     DisplayChip = engine.DisplayChip;
     bounds      = DisplayChip.VisibleBounds;
 }