// Load all bts tiles. private void LoadBtsTiles() { BlitImage tiles = new BlitImage(GraphicsIO.LoadBitmap(BtsTilesFile)); BlitImage small = new BlitImage(GraphicsIO.LoadBitmap(BtsTilesSmallFile)); // Load 16x16 tiles; BtsTiles.Clear(); for (int y = 0; y > -tiles.Height; y -= 16) { for (int x = 0; x > -tiles.Width; x -= 16) { BlitImage newTile = new BlitImage(16, 16); newTile.Clear(); newTile.Blit(tiles, x, y, false, false); BtsTiles.Add(newTile); } } // Load 8x8 tiles. BtsTilesSmall.Clear(); for (int y = 0; y > -tiles.Height; y -= 8) { for (int x = 0; x > -tiles.Width; x -= 8) { BlitImage newTile = new BlitImage(8, 8); newTile.Clear(); newTile.Blit(small, x, y, false, false); BtsTilesSmall.Add(newTile); } } }
// Loads a 16x16 tile from a tileset into a bitmap image. private BlitImage Tile16ToImage(int tilesetIndex, int index) { if (TileSetIndex == IndexNone) { BlitImage img = new BlitImage(16, 16); img.Clear(); return(img); } TileSet t = (TileSet)TileSets [tilesetIndex]; byte [] data = t.RenderTile(index); return(new BlitImage(data, 16)); }