예제 #1
0
파일: Level.cs 프로젝트: jrahhali/squirrely
 // Simply create a sand sprite...a bit hacky.  there's probably a better way
 public Level()
 {
     const int SandTilePos = 15;
     int spriteSheetY = (SandTilePos / SpriteSheetTileWidth) *
         TileHeight + (SandTilePos / SpriteSheetTileWidth);
     int spriteSheetX = (SandTilePos % SpriteSheetTileWidth) *
         TileWidth + (SandTilePos % SpriteSheetTileWidth);
     SandSprite =  new StaticSprite(GameTextures.TileMap, new System.Drawing.Rectangle(spriteSheetX, spriteSheetY, TileWidth, TileHeight));
     GrassSprite = new StaticSprite(GameTextures.SquirrelMap, new Rectangle(350, 109, 55, 55));
 }
예제 #2
0
파일: Game.cs 프로젝트: jrahhali/squirrely
 //
 // Hmmm...I don't like how these are taking a BitmapSprite
 // I think i will have to try and abstract the BitmapSprite
 // up to a Sprite
 //
 public abstract void TileSprite(BitmapSprite sprite);
예제 #3
0
파일: Game.cs 프로젝트: jrahhali/squirrely
 public abstract void RenderSprite(BitmapSprite sprite);
예제 #4
0
 public override void RenderSprite(BitmapSprite sprite)
 {
     if (sprite.RotateFlipType == RotateFlipType.RotateNoneFlipNone)
     {   graphics.DrawImage(
             sprite.MasterImage,
             sprite.GameRectangle,
             sprite.Crop,
             GraphicsUnit.Pixel);
     }
     else
     {   Bitmap tempImage = new Bitmap(sprite.Crop.Width, sprite.Crop.Height);
         Graphics tempGraphics = Graphics.FromImage(tempImage);
         tempGraphics.DrawImage(sprite.MasterImage,
             new Rectangle(0, 0, tempImage.Width, tempImage.Height),
             sprite.Crop,
             GraphicsUnit.Pixel);
         tempImage.RotateFlip(sprite.RotateFlipType);
         graphics.DrawImage(tempImage, sprite.GameRectangle);
         tempGraphics.Dispose();
     }
 }
예제 #5
0
 public override void TileSprite(BitmapSprite sprite)
 {
     Bitmap temp = new Bitmap(sprite.Crop.Width, sprite.Crop.Height);
     Graphics g = Graphics.FromImage(temp);
     g.DrawImage(
         sprite.MasterImage,
         new Rectangle(0, 0, temp.Width, temp.Height),
         sprite.Crop,
         GraphicsUnit.Pixel);
     TextureBrush tileBrush = new TextureBrush(temp, System.Drawing.Drawing2D.WrapMode.Tile);
     graphics.FillRectangle(tileBrush, form.ClientRectangle);
 }