Exemple #1
0
        static public Bitmap DrawScreen()
        {
            byte[,] bg  = SharpEmulator.DrawBackground();
            byte[,] win = SharpEmulator.DrawWindow();
            List <Sprite> sprites = SharpEmulator.GetSprites();

            if ((SharpEmulator.GetRegister((int)Register.LCDC) & 0x20) > 0)
            {
                for (int i = 0; i < win.GetUpperBound(0); i++)
                {
                    for (int j = 0; j < win.GetUpperBound(1); j++)
                    {
                        bg[160 - win.GetUpperBound(0) + i, 144 - win.GetUpperBound(1) + j] = win[i, j];
                    }
                }
            }


            for (int i = 0; i < sprites.Count; i++)
            {
                Sprite s = sprites[i];
                if (!s.isNull)
                {
                    for (int x = 0; x < 8; x++)
                    {
                        for (int y = 0; y < 8; y++)
                        {
                            int rX = x + s.X;
                            int rY = y + s.Y;
                            if (rX >= 168 || rX < 8)
                            {
                                continue;
                            }
                            if (rY >= 160 || rY < 16)
                            {
                                continue;
                            }

                            int xFliped = s.XFlip ? 7 - x : x;
                            int yFliped = s.YFlip ? 7 - y : y;

                            if (s.Tile[xFliped, yFliped] != 0)
                            {
                                bg[rX - 8, rY - 16] = s.Tile[xFliped, yFliped];
                            }
                        }
                    }
                }
            }


            return(MatrixToBitmap(bg, 160, 144));
        }
Exemple #2
0
 static public string GetRegister(Register register)
 {
     return(SharpEmulator.GetRegister((int)register).ToString("X4"));
 }