Skip to content
Snippets Groups Projects
Verified Commit 0fdef23e authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

reactor: better code layout

parent 890f0b3f
No related branches found
No related tags found
No related merge requests found
Pipeline #1743 passed
import { import {
BenchmarkResult,
Emulator, Emulator,
EmulatorBase, EmulatorBase,
Entry, Entry,
...@@ -488,10 +489,6 @@ export class GameboyEmulator extends EmulatorBase implements Emulator { ...@@ -488,10 +489,6 @@ export class GameboyEmulator extends EmulatorBase implements Emulator {
this.updatePalette(); this.updatePalette();
} }
getTile(index: number): Uint8Array {
return this.gameBoy?.get_tile_buffer(index) ?? new Uint8Array();
}
toggleRunning() { toggleRunning() {
if (this.paused) { if (this.paused) {
this.resume(); this.resume();
...@@ -525,14 +522,18 @@ export class GameboyEmulator extends EmulatorBase implements Emulator { ...@@ -525,14 +522,18 @@ export class GameboyEmulator extends EmulatorBase implements Emulator {
this.gameBoy?.key_lift(keyCode); this.gameBoy?.key_lift(keyCode);
} }
changePalette() { getTile(index: number): Uint8Array {
return this.gameBoy?.get_tile_buffer(index) ?? new Uint8Array();
}
changePalette(): string {
this.paletteIndex += 1; this.paletteIndex += 1;
this.paletteIndex %= PALETTES.length; this.paletteIndex %= PALETTES.length;
this.updatePalette(); this.updatePalette();
return PALETTES[this.paletteIndex].name; return PALETTES[this.paletteIndex].name;
} }
benchmark(count = 50000000) { benchmark(count = 50000000): BenchmarkResult {
let cycles = 0; let cycles = 0;
this.pause(); this.pause();
try { try {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment