Skip to content

Commit 15c9a32

Browse files
committed
Update build and scaffold npx scripts
1 parent a77c528 commit 15c9a32

File tree

5 files changed

+40
-9
lines changed

5 files changed

+40
-9
lines changed

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
"bin": {
2929
"ascii-scaffold": "cp node_modules/ascii/src/scaffold/index.html ./index.html",
3030
"ascii-build": "tsc main.ts --outDir build; browserify build/main.js > build/bundle.js",
31-
"ascii-build-shell": "./scripts/ascii-build-shell.sh",
32-
"ascii-scaffold-shell": "./scripts/ascii-scaffold.sh",
33-
"ascii-test": "echo bartle"
31+
"ascii-build-shell": "./scripts/ascii-build.sh",
32+
"ascii-scaffold-shell": "./scripts/ascii-scaffold.sh"
3433
}
3534
}

scaffold/main.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { Game, Renderer, IO } from 'ascii';
2+
3+
class game extends Game {
4+
5+
renderer: Renderer;
6+
7+
load() {
8+
9+
// load things at the start of the program
10+
this.renderer = new Renderer();
11+
12+
}
13+
14+
update(key: string) {
15+
16+
// update code, executed every keypress
17+
18+
}
19+
20+
draw() {
21+
22+
// drawing code to be executed after every update
23+
24+
}
25+
}
26+
27+
let g = new game();
28+
g.load();
29+
IO.genericKeyBinding(function(key: string) {
30+
g.update(key);
31+
g.draw();
32+
})

scripts/ascii-build-shell.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

scripts/ascii-build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
tsc main.ts
4+
browserify main.js > bundle.js

scripts/ascii-scaffold.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#!/bin/bash
22

3-
cp node_modules/ascii/src/scaffold/index.html ./index.html
3+
cp ./node_modules/ascii/scaffold/index.html ./index.html
4+
cp ./node_modules/ascii/scaffold/main.ts ./main.ts

0 commit comments

Comments
 (0)