Skip to content

Commit

Permalink
Added build, use interleave packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanoehlman committed Apr 10, 2012
1 parent 978f3a5 commit cd5ceea
Show file tree
Hide file tree
Showing 11 changed files with 432 additions and 13 deletions.
31 changes: 31 additions & 0 deletions Jakefile
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']);
12 changes: 12 additions & 0 deletions package.json
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": "*"
}
}
90 changes: 90 additions & 0 deletions pkg/amd/GamebaseTypes.js
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;
});
90 changes: 90 additions & 0 deletions pkg/cjs/GamebaseTypes.js
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;
93 changes: 93 additions & 0 deletions pkg/oldschool/GamebaseTypes.js
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);
Loading

0 comments on commit cd5ceea

Please sign in to comment.