Exemplo n.º 1
0
        //constructor
        public TileMap(ref TextureAtlas atlas, int numColumns, int numRows, int tileWidth, int tileHeight)
        {
            if (atlas == null)
            {
                throw new ArgumentNullException("atlas");
            }
            if (numRows <= 0)
            {
                throw new Exception("numRows cannot be less than or equal to zero.");
            }
            if (numColumns <= 0)
            {
                throw new Exception("numColumns cannot be less than or equal to zero.");
            }
            if (tileWidth <= 0)
            {
                throw new Exception("tileWidth cannot be less than or equal to zero.");
            }
            if (tileHeight <= 0)
            {
                throw new Exception("tileHeight cannot be less than or equal to zero.");
            }

            this.atlas      = atlas;
            bitmaps         = new Bitmap[numColumns, numRows];
            bitmapNames     = new string[numColumns, numRows];
            this.numRows    = numRows;
            this.numColumns = numColumns;
            this.tileWidth  = tileWidth;
            this.tileHeight = tileHeight;

            using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(currentBitmap)) {
                g.Clear(System.Drawing.Color.Transparent);
            }
            Texture = TextureUtil.FromBitmap(currentBitmap);
        }
Exemplo n.º 2
0
 //constructor
 public MovieClip(ref TextureAtlas atlas, double frameTime)
 {
     this.atlas = atlas;
     _frameTime = frameTime;
 }