Skip to content

Commit c42b9ef

Browse files
committed
feat: nes emulator
1 parent 06241c6 commit c42b9ef

File tree

10 files changed

+7513
-0
lines changed

10 files changed

+7513
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
var Controller = function () {
2+
this.state = new Array(8);
3+
for (var i = 0; i < this.state.length; i++) {
4+
this.state[i] = 0x40;
5+
}
6+
};
7+
8+
Controller.BUTTON_A = 0;
9+
Controller.BUTTON_B = 1;
10+
Controller.BUTTON_SELECT = 2;
11+
Controller.BUTTON_START = 3;
12+
Controller.BUTTON_UP = 4;
13+
Controller.BUTTON_DOWN = 5;
14+
Controller.BUTTON_LEFT = 6;
15+
Controller.BUTTON_RIGHT = 7;
16+
17+
Controller.prototype = {
18+
buttonDown: function (key) {
19+
this.state[key] = 0x41;
20+
},
21+
22+
buttonUp: function (key) {
23+
this.state[key] = 0x40;
24+
}
25+
};

0 commit comments

Comments
 (0)