LynnaLab.GfxViewer.draw C# (CSharp) Method

draw() private method

private draw ( int tile ) : void
tile int
return void
        void draw(int tile)
        {
            int offset = tile*16;

            if (!(offset >= offsetStart && offset < offsetEnd))
                return;

            int x = ((offset-offsetStart)/16)%Width;
            int y = ((offset-offsetStart)/16)/Width;

            int bank=0;
            if (offset >= 0x1800) {
                offset -= 0x1800;
                bank = 1;
            }
            byte[] data = new byte[16];
            Array.Copy(graphicsState.VramBuffer[bank], offset, data, 0, 16);
            Bitmap subImage = GbGraphics.TileToImage(data);
            Graphics g = Graphics.FromImage(image);
            g.DrawImage(subImage, x*8, y*8);

            QueueDraw();
        }