Exemplo n.º 1
0
        public Background(GameboyAdvance gba, int bgNumber, BgControlRegister cntRegister)
        {
            this.gba      = gba;
            this.BgNumber = bgNumber;
            CntRegister   = cntRegister;
            AffineMode    = false;
            TileMap       = new TileMap(gba.Memory.VRam, cntRegister, bgNumber);

            AffineMatrix = new BgAffineMatrix();
        }
Exemplo n.º 2
0
        public Background(GameboyAdvance gba, int bgNumber, BgControlRegister cntRegister, MemoryRegister16 scrollXReg, MemoryRegister16 scrollYReg)
        {
            this.gba      = gba;
            this.BgNumber = bgNumber;
            CntRegister   = cntRegister;
            AffineMode    = false;
            TileMap       = new TileMap(gba.Memory.VRam, cntRegister, bgNumber);

            BGXHOFS = scrollXReg;
            BGXVOFS = scrollYReg;

            // Only bg 2 & 3 can rotate and scale
            if (bgNumber == 2)
            {
                AffineMatrix     = new BgAffineMatrix(gba, 0x4000020);
                AffineScrollXReg = new AffineScrollRegister(gba.Memory, 0x4000028, false, true);
                AffineScrollYReg = new AffineScrollRegister(gba.Memory, 0x400002C, false, true);
            }
            else if (bgNumber == 3)
            {
                AffineMatrix     = new BgAffineMatrix(gba, 0x4000030);
                AffineScrollXReg = new AffineScrollRegister(gba.Memory, 0x4000038, false, true);
                AffineScrollYReg = new AffineScrollRegister(gba.Memory, 0x400003C, false, true);
            }

            ScanlineData = new int[LcdController.Screen_X_Resolution];



#if THREADED_SCANLINE
            Interlocked.Exchange(ref cacheScanline, 0);
            exitThread     = false;
            scanlineThread = new Thread(new ThreadStart(ScanlineThread));
            scanlineThread.Start();
#endif
        }