-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
51 lines (43 loc) · 1.17 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var gulp = require('gulp')
var child_process = require('child_process')
var nestmx = require('nes-tmx')
var paths = {
graphics: 'gfx/tiles.png',
tilemap: 'gfx/*.tmx',
src: 'src/**/*'
}
gulp.task('spriteBuild', createTiles)
gulp.task('nameTables', nameTables)
gulp.task('build', make)
gulp.task('dev', function() {
gulp.watch(paths.graphics, ['spriteBuild']);
gulp.watch(paths.tilemap, ['nameTables']);
gulp.watch(paths.src, ['build']);
})
function createTiles () {
console.log('Making a tileset')
var spritetiles = child_process.spawn(
'./tools/pilbmp2nes.py', ['-i', 'gfx/tiles.png', '-o', 'src/tiles.chr'])
spritetiles.stdout.on('data', function (d) {
console.log('' + d)
})
spritetiles.stderr.on('data', function (d) {
console.error('' + d)
})
return spritetiles
}
function nameTables () {
nestmx('gfx/title.tmx', 'src/title.h')
nestmx('gfx/level.tmx', 'src/level.h')
}
function make () {
var make = child_process.spawn('make', {cwd: 'src'})
make.stdout.on('data', function (d) {
console.log('' + d)
})
make.stderr.on('data', function (d) {
console.error('' + d)
})
return make;
}
gulp.task('default', ['build'])