-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added build, use interleave packaging
- Loading branch information
1 parent
978f3a5
commit cd5ceea
Showing
11 changed files
with
432 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var interleave = require('interleave'); | ||
|
||
|
||
desc('build the client files'); | ||
task('dev', function() { | ||
interleave(['mobileservices.dev.js'], { | ||
multi: 'pass', | ||
path: 'app/js', | ||
aliases: aliases | ||
}); | ||
}); | ||
|
||
task('dev.deps', function() { | ||
interleave(['mobileservices.deps.js'], { | ||
multi: 'pass', | ||
path: 'app/js', | ||
aliases: aliases | ||
}); | ||
}); | ||
|
||
task('build', function() { | ||
interleave(['mobileservices.js'], { | ||
after: ['uglify'], | ||
multi: 'pass', | ||
path: 'app/js', | ||
aliases: aliases | ||
}); | ||
}); | ||
|
||
|
||
task('default', ['dev']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "gamebase-types", | ||
"description": "Gamebase Common Types for both browser and server usage", | ||
"version": "0.1.0", | ||
"dependencies": { | ||
"underscore": "*" | ||
}, | ||
"devDependencies": { | ||
"interleave": "*", | ||
"uglify-js": "*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
define('GamebaseTypes', ['underscore'], function(underscore) { | ||
|
||
/** | ||
The 2dMap contains all the information related to a 2d map | ||
**/ | ||
function Map2D(opts) { | ||
|
||
opts = opts || {}; | ||
this.size = opts.size || {width: 300, height: 300}; | ||
|
||
this.initialise(); | ||
} | ||
|
||
Map2D.prototype.initialise = function() { | ||
|
||
this.tiles = new Array(this.size.width); | ||
for (var i = 0; i < this.size.width; i++) { | ||
this.tiles[i] = new Array(this.size.height); | ||
} | ||
} | ||
|
||
/** | ||
Gets the tile at the given coordinates | ||
**/ | ||
Map2D.prototype.getTile = function(x, y) { | ||
return this.tiles[x][y] = tile; | ||
} | ||
|
||
/** | ||
Sets the tile at the given coordinates | ||
**/ | ||
Map2D.prototype.setTile = function(x, y, tile) { | ||
this.tiles[x][y] = tile; | ||
} | ||
|
||
Map2D.prototype.toJSON = function() { | ||
var results = {world: {size: this.size}, tiles: []}; | ||
|
||
for (var i = 0; i < this.tiles.length; i++) { | ||
var column = this.tiles[i]; | ||
for (var j = 0; j < column.length; j++) { | ||
results.tiles.push(column[j]); | ||
} | ||
} | ||
return results; | ||
} | ||
|
||
function Tile(opts) { | ||
|
||
opts = opts || {}; | ||
this.update(opts); | ||
} | ||
|
||
Tile.prototype.update = function(opts) { | ||
if (!opts) return; | ||
if (opts.elevation) this.el = opts.elevation; | ||
if (opts.terrain) this.tn = opts.terrain; | ||
} | ||
|
||
/** | ||
Sets the height of the tile | ||
**/ | ||
Tile.prototype.setElevation = function(elevation) { | ||
this.el = elevation; | ||
} | ||
|
||
/** | ||
Sets the terrain of the tile | ||
**/ | ||
Tile.prototype.setTerrain = function(terrain) { | ||
this.tn = terrain; | ||
} | ||
|
||
function randomInRange(min, max) { | ||
return Math.round(min+ (Math.random() * (max - min))); | ||
} | ||
|
||
|
||
|
||
|
||
function GamebaseTypes() { | ||
|
||
} | ||
|
||
GamebaseTypes.Map2D = Map2D; | ||
GamebaseTypes.Tile = Tile; | ||
GamebaseTypes.randomInRange = randomInRange; | ||
|
||
return GamebaseTypes; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
var underscore = require('underscore'); | ||
|
||
|
||
/** | ||
The 2dMap contains all the information related to a 2d map | ||
**/ | ||
function Map2D(opts) { | ||
|
||
opts = opts || {}; | ||
this.size = opts.size || {width: 300, height: 300}; | ||
|
||
this.initialise(); | ||
} | ||
|
||
Map2D.prototype.initialise = function() { | ||
|
||
this.tiles = new Array(this.size.width); | ||
for (var i = 0; i < this.size.width; i++) { | ||
this.tiles[i] = new Array(this.size.height); | ||
} | ||
} | ||
|
||
/** | ||
Gets the tile at the given coordinates | ||
**/ | ||
Map2D.prototype.getTile = function(x, y) { | ||
return this.tiles[x][y] = tile; | ||
} | ||
|
||
/** | ||
Sets the tile at the given coordinates | ||
**/ | ||
Map2D.prototype.setTile = function(x, y, tile) { | ||
this.tiles[x][y] = tile; | ||
} | ||
|
||
Map2D.prototype.toJSON = function() { | ||
var results = {world: {size: this.size}, tiles: []}; | ||
|
||
for (var i = 0; i < this.tiles.length; i++) { | ||
var column = this.tiles[i]; | ||
for (var j = 0; j < column.length; j++) { | ||
results.tiles.push(column[j]); | ||
} | ||
} | ||
return results; | ||
} | ||
|
||
function Tile(opts) { | ||
|
||
opts = opts || {}; | ||
this.update(opts); | ||
} | ||
|
||
Tile.prototype.update = function(opts) { | ||
if (!opts) return; | ||
if (opts.elevation) this.el = opts.elevation; | ||
if (opts.terrain) this.tn = opts.terrain; | ||
} | ||
|
||
/** | ||
Sets the height of the tile | ||
**/ | ||
Tile.prototype.setElevation = function(elevation) { | ||
this.el = elevation; | ||
} | ||
|
||
/** | ||
Sets the terrain of the tile | ||
**/ | ||
Tile.prototype.setTerrain = function(terrain) { | ||
this.tn = terrain; | ||
} | ||
|
||
function randomInRange(min, max) { | ||
return Math.round(min+ (Math.random() * (max - min))); | ||
} | ||
|
||
|
||
|
||
|
||
function GamebaseTypes() { | ||
|
||
} | ||
|
||
GamebaseTypes.Map2D = Map2D; | ||
GamebaseTypes.Tile = Tile; | ||
GamebaseTypes.randomInRange = randomInRange; | ||
|
||
module.exports = GamebaseTypes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// dep: underscore | ||
|
||
(function (glob) { | ||
|
||
/** | ||
The 2dMap contains all the information related to a 2d map | ||
**/ | ||
function Map2D(opts) { | ||
|
||
opts = opts || {}; | ||
this.size = opts.size || {width: 300, height: 300}; | ||
|
||
this.initialise(); | ||
} | ||
|
||
Map2D.prototype.initialise = function() { | ||
|
||
this.tiles = new Array(this.size.width); | ||
for (var i = 0; i < this.size.width; i++) { | ||
this.tiles[i] = new Array(this.size.height); | ||
} | ||
} | ||
|
||
/** | ||
Gets the tile at the given coordinates | ||
**/ | ||
Map2D.prototype.getTile = function(x, y) { | ||
return this.tiles[x][y] = tile; | ||
} | ||
|
||
/** | ||
Sets the tile at the given coordinates | ||
**/ | ||
Map2D.prototype.setTile = function(x, y, tile) { | ||
this.tiles[x][y] = tile; | ||
} | ||
|
||
Map2D.prototype.toJSON = function() { | ||
var results = {world: {size: this.size}, tiles: []}; | ||
|
||
for (var i = 0; i < this.tiles.length; i++) { | ||
var column = this.tiles[i]; | ||
for (var j = 0; j < column.length; j++) { | ||
results.tiles.push(column[j]); | ||
} | ||
} | ||
return results; | ||
} | ||
|
||
function Tile(opts) { | ||
|
||
opts = opts || {}; | ||
this.update(opts); | ||
} | ||
|
||
Tile.prototype.update = function(opts) { | ||
if (!opts) return; | ||
if (opts.elevation) this.el = opts.elevation; | ||
if (opts.terrain) this.tn = opts.terrain; | ||
} | ||
|
||
/** | ||
Sets the height of the tile | ||
**/ | ||
Tile.prototype.setElevation = function(elevation) { | ||
this.el = elevation; | ||
} | ||
|
||
/** | ||
Sets the terrain of the tile | ||
**/ | ||
Tile.prototype.setTerrain = function(terrain) { | ||
this.tn = terrain; | ||
} | ||
|
||
function randomInRange(min, max) { | ||
return Math.round(min+ (Math.random() * (max - min))); | ||
} | ||
|
||
|
||
|
||
|
||
function GamebaseTypes() { | ||
|
||
} | ||
|
||
GamebaseTypes.Map2D = Map2D; | ||
GamebaseTypes.Tile = Tile; | ||
GamebaseTypes.randomInRange = randomInRange; | ||
|
||
glob.GamebaseTypes = GamebaseTypes; | ||
|
||
})(this); |
Oops, something went wrong.