/// <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(); } } }
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 }
public playfield() { InitializeComponent(); mgrid = new MemoryGrid(GameGrid); }