예제 #1
0
        /// <summary>
        /// Focuses on the values defined by SP and PC. It also jumps to that position
        /// </summary>
        private void SelectAndScrollValuesIntoView()
        {
            MemoryGrid.SelectedIndex = emulator.Chip8.Pc;
            MemoryGrid.ScrollIntoView(MemoryGrid.SelectedItem);

            StackGrid.SelectedIndex = emulator.Chip8.Sp;
            StackGrid.ScrollIntoView(StackGrid.SelectedIndex);

            //For the dissasembled code
            if (emulator.Debugger.Paused || emulator.Debugger.StepOver)
            {
                if (selectedInstruction != null)
                {
                    selectedInstruction.Background = Brushes.Transparent;
                }

                var pcValue = emulator.Chip8.Pc % 2 == 0 ? emulator.Chip8.Pc - 2 : emulator.Chip8.Pc - 1;
                if (dissasembledBlocks.TryGetValue(pcValue, out var instruction))
                {
                    //We do Pc-2 because on Pc will be the next instruction, not the one stopped at
                    selectedInstruction            = instruction;
                    selectedInstruction.Background = Brushes.Yellow;
                    selectedInstruction.BringIntoView();
                }
            }
        }
예제 #2
0
        public playfield()
        {
            InitializeComponent();
            mgrid = new MemoryGrid(GameGrid);

            //Developer: Marco Giessing
            //Aanmaken van de DispatcherTimer
            DispatcherTimer dt = new DispatcherTimer();

            dt.Interval = TimeSpan.FromSeconds(1); //Aantal seconden waar de timer 1 af telt (Bij 3zou het 3 seconden duren voor hij van 1 naar 2 gaat)
            dt.Tick    += dtClock;
            dt.Start();                            //Timer start wanneer je de game start
        }
예제 #3
0
 public playfield()
 {
     InitializeComponent();
     mgrid = new MemoryGrid(GameGrid);
 }