File tree Expand file tree Collapse file tree 3 files changed +56
-0
lines changed
Expand file tree Collapse file tree 3 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ export * from "./src/nes" ;
2+ export * from "./src/controller" ;
Original file line number Diff line number Diff line change 1+ export type ControllerKey = 1 | 2 ;
2+
3+ export type ButtonKey = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 ;
4+
5+ export class Controller {
6+ state : number [ ] ;
7+ buttonDown : ( key : ControllerKey ) => void ;
8+ buttonUp : ( key : ControllerKey ) => void ;
9+
10+ static readonly BUTTON_A = 0 ;
11+ static readonly BUTTON_B = 1 ;
12+ static readonly BUTTON_SELECT = 2 ;
13+ static readonly BUTTON_START = 3 ;
14+ static readonly BUTTON_UP = 4 ;
15+ static readonly BUTTON_DOWN = 5 ;
16+ static readonly BUTTON_LEFT = 6 ;
17+ static readonly BUTTON_RIGHT = 7 ;
18+ }
Original file line number Diff line number Diff line change 1+ import { ControllerKey , ButtonKey } from "./controller" ;
2+
3+ export interface EmulatorData {
4+ cpu : string ;
5+ mmap : string ;
6+ ppu : string ;
7+ papu : string ;
8+ }
9+
10+ export interface NESOptions {
11+ onFrame ?: ( buffer : Buffer ) => void ;
12+ onAudioSample ?: ( left : number , right : number ) => void ;
13+ onStatusUpdate ?: ( status : string ) => void ;
14+ onBatteryRamWrite ?: ( address : number , value : number ) => void ;
15+ preferredFrameRate ?: number ;
16+ emulateSound ?: boolean ;
17+ sampleRate ?: number ;
18+ }
19+
20+ export class NES {
21+ constructor ( opts : NESOptions ) ;
22+ stop : ( ) => void ;
23+ reset : ( ) => void ;
24+ frame : ( ) => void ;
25+ buttonDown : ( controller : ControllerKey , button : ButtonKey ) => void ;
26+ buttonUp : ( controller : ControllerKey , button : ButtonKey ) => void ;
27+ zapperMove : ( x : number , y : number ) => void ;
28+ zapperFireDown : ( ) => void ;
29+ zapperFireUp : ( ) => void ;
30+ getFPS : ( ) => number ;
31+ reloadROM : ( ) => void ;
32+ loadROM : ( data : string | Buffer ) => void ;
33+ setFramerate : ( rate : number ) => void ;
34+ toJSON : ( ) => EmulatorData ;
35+ fromJSON : ( data : EmulatorData ) => void ;
36+ }
You can’t perform that action at this time.
0 commit comments