Exemple #1
0
        /// <summary>
        /// converts Tiles from Memory to Bitmap. With ID, BankID and  Backgrount Tile Select.
        /// </summary>
        /// <param name="spriteID">ID of Sprite  </param>
        /// <returns></returns>
        public static Picture Tile(ushort spriteID, int pallete, int bankID)
        {
            int           startAdress  = spriteID * 16;
            NES_PPU_Color color        = NES_PPU_Palette.getSpriteColorPalette(pallete);
            var           PatternTable = NES_PPU_Memory.PatternTableN[bankID];
            int           ID           = GetTileID(startAdress, pallete, PatternTable);

            return(CreateTileBitmap(startAdress, color, PatternTable, ID));
        }
Exemple #2
0
        /// <summary>
        /// converts Tiles from Memory to Bitmap.
        /// </summary>
        /// <param name="startAdress"></param>
        /// <returns></returns>
        public static Picture Tile_StartAdress(int startAdress, int pallete)
        {
            byte[,] pattern = new byte[8, 8];
            NES_PPU_Color color        = NES_PPU_Palette.getPalette(pallete);
            var           PatternTable = NES_PPU_Memory.Memory;
            int           ID           = GetTileID(startAdress, pallete, PatternTable);

            return(CreateTileBitmap(startAdress, color, PatternTable, ID));
        }
Exemple #3
0
        public static Picture PaletteTable()
        {
            Picture bitmap = new Picture(TempPaletteTable);

            if (NES_PPU_Register.PPUCTRL.V)
            {
                bitmap.FillRectangle(NES_PPU_Palette.UniversalBackgroundColor(), 0, 0, bitmap.Size.Width, bitmap.Size.Height);
                int k = 0;
                for (ushort i = 0; i < 2; i++)
                {
                    int o = 0;
                    for (ushort j = 0; j < 4; j++)
                    {
                        var color = NES_PPU_Palette.getPalette(k++);
                        for (int h = 0; h < 4; h++)
                        {
                            if (color.color[h] == Color.Transparent)
                            {
                                bitmap.FillRectangle(NES_PPU_Palette.UniversalBackgroundColor(), o * 20, i * 20, ++o * 20, (i + 1) * 20);
                            }
                            else
                            {
                                bitmap.FillRectangle(color.color[h], o * 20, i * 20, ++o * 20, (i + 1) * 20);
                            }
                        }
                    }
                }
                for (ushort i = 0; i < 2; i++)
                {
                    int o = 0;
                    for (ushort j = 0; j < 4; j++)
                    {
                        for (int h = 0; h < 4; h++)
                        {
                            bitmap.DrawInfoRectangle(Color.Black, o * 20, i * 20, ++o * 20, (i + 1) * 20);
                        }
                    }
                }
                TempPaletteTable = bitmap;
            }
            return(bitmap);
        }
Exemple #4
0
        /// <summary>
        /// converts Tiles from Memory to Bitmap. With ID and  Backgrount Tile Select.
        /// </summary>
        /// <param name="spriteID">ID of Sprite  </param>
        /// <returns></returns>
        public static Picture Tile(ushort spriteID, int pallete)
        {
            System.TimeSpan t1 = new System.TimeSpan(0);
            System.TimeSpan t2 = new System.TimeSpan(0);
            Stopwatch       t  = new Stopwatch();

            t.Start();
            int startAdress = spriteID * 16;

            byte[,] pattern = new byte[8, 8];
            NES_PPU_Color color        = NES_PPU_Palette.getPalette(pallete);
            var           PatternTable = NES_PPU_Memory.PatternTableN[NES_PPU_Register.PPUCTRL.B ? 1 : 0];
            int           ID           = GetTileID(startAdress, pallete, PatternTable);

            t1 = t.Elapsed;
            var temp = CreateTileBitmap(startAdress, color, PatternTable, ID);

            t2 = t.Elapsed;
            t.Stop();
            t2 -= t1;
            return(temp);
        }
Exemple #5
0
        public static Picture Display()
        {
            TimeSpan t1 = new TimeSpan(0);
            TimeSpan t2 = new TimeSpan(0);
            TimeSpan t3 = new TimeSpan(0);
            TimeSpan t4 = new TimeSpan(0);

            if (NES_PPU_Register.PPUCTRL.V)
            {
                NES_PPU_Register.PPUCTRL.V = false;
                Interrupt.NMI = true;

                Stopwatch t = new Stopwatch();
                t.Start();


                Draw = true;
                Picture Display = new Picture(TempDisplay.Size.Width, TempDisplay.Size.Height);

                t1 = t.Elapsed;
                Display.DrawImage(InsertObect(true), 0, 0);
                t2 = t.Elapsed;
                DrawBackground(Display, NameTabele());
                t3 = t.Elapsed;
                Display.DrawImage(InsertObect(false), 0, 0);
                t.Stop();
                t4  = t.Elapsed;
                t4 -= t3;
                t3 -= t2;
                t2 -= t1;
                NES_PPU_Palette.setAllPaletesAsOld();
                TempDisplay = Display;
                Draw        = false;
                NES_PPU_Register.PPUSTATUS.V = true;
            }

            return(TempDisplay);
        }
Exemple #6
0
 public static Color getUniversalBackgroundColor()
 {
     return(NES_PPU_Palette.UniversalBackgroundColor());
 }