diff --git a/frontends/web/nodemon.json b/frontends/web/nodemon.json index e656d91ccaecfc59a20da7ce9460f05f6cedda0a..f091de340caae37bf2e6d603846362069e2ac6d7 100644 --- a/frontends/web/nodemon.json +++ b/frontends/web/nodemon.json @@ -1,5 +1,5 @@ { - "ext": "js,ts,jsx,tsx,mjs,json", + "ext": "js,ts,jsx,tsx,mjs,css,json", "ignore": ["dist", ".parcel-cache"], "ignoreRoot": [".git"] } diff --git a/frontends/web/ts/gb.ts b/frontends/web/ts/gb.ts index 5ddc731f398502704f0e7baab9af0c5b7ea1c91a..79ceadd815cedb04882086a849cbd0ac363a0b7b 100644 --- a/frontends/web/ts/gb.ts +++ b/frontends/web/ts/gb.ts @@ -4,7 +4,8 @@ import { Entry, Feature, PixelFormat, - RomInfo + RomInfo, + Size } from "emukit"; import { PALETTES, PALETTES_MAP } from "./palettes"; @@ -25,6 +26,10 @@ const LOGIC_HZ = 4194304; const VISUAL_HZ = 59.7275; const IDLE_HZ = 10; +const DISPLAY_WIDTH = 160; +const DISPLAY_HEIGHT = 144; +const DISPLAY_SCALE = 2; + /** * The rate at which the local storage RAM state flush * operation is going to be performed, this value is the @@ -285,7 +290,9 @@ export class GameboyEmulator extends EmulatorBase implements Emulator { // in case a remote ROM loading operation has been // requested then loads it from the remote origin if (loadRom) { - ({ name: romName, data: romData } = await this.fetchRom(romPath)); + ({ name: romName, data: romData } = await GameboyEmulator.fetchRom( + romPath + )); } else if (romName === null || romData === null) { [romName, romData] = [this.romName, this.romData]; } @@ -397,6 +404,14 @@ export class GameboyEmulator extends EmulatorBase implements Emulator { return PixelFormat.RGB; } + get dimensions(): Size { + return { + width: DISPLAY_WIDTH, + height: DISPLAY_HEIGHT, + scale: DISPLAY_SCALE + }; + } + /** * Returns the array buffer that contains the complete set of * pixel data that is going to be drawn. @@ -559,7 +574,7 @@ export class GameboyEmulator extends EmulatorBase implements Emulator { this.gameBoy?.set_palette_colors_ws(palette.colors); } - private async fetchRom( + private static async fetchRom( romPath: string ): Promise<{ name: string; data: Uint8Array }> { // extracts the name of the ROM from the provided