Skip to content

Commit

Permalink
Added grunt file and npm package for OSX debs
Browse files Browse the repository at this point in the history
  • Loading branch information
photonstorm committed Apr 20, 2013
1 parent 1217bf4 commit 364492d
Show file tree
Hide file tree
Showing 7 changed files with 5,751 additions and 13,388 deletions.
31 changes: 31 additions & 0 deletions GruntFile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-typescript');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
typescript: {
base: {
src: ['Phaser/**/*.ts'],
dest: 'build/phaser.js',
options: {
target: 'ES5'
}
}
},
copy: {
main: {
files: [
{src: 'build/phaser.js', dest: 'Tests/phaser.js'}
]}
},
watch: {
files: '**/*.ts',
tasks: ['typescript', 'copy']
}
});

grunt.registerTask('default', ['watch']);

}
8 changes: 8 additions & 0 deletions Phaser/gameobjects/GameObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,14 @@ module Phaser {
this._angle = this._game.math.wrap(value, 360, 0);
}

public set width(value:number) {
this.bounds.width = value;
}

public set height(value:number) {
this.bounds.height = value;
}

public get width(): number {
return this.bounds.width;
}
Expand Down
15 changes: 10 additions & 5 deletions Phaser/gameobjects/Sprite.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/// <reference path="../Game.ts" />
/// <reference path="../AnimationManager.ts" />
/// <reference path="GameObject.ts" />
/// <reference path="../system/Camera.ts" />

/**
* Phaser - Sprite
Expand Down Expand Up @@ -125,15 +126,15 @@ module Phaser {

}

public set frame(value?: number) {
public set frame(value: number) {
this.animations.frame = value;
}

public get frame(): number {
return this.animations.frame;
}

public set frameName(value?: string) {
public set frameName(value: string) {
this.animations.frameName = value;
}

Expand Down Expand Up @@ -228,7 +229,7 @@ module Phaser {
this._dy -= (camera.worldView.y * this.scrollFactor.y);
}

// Rotation
// Rotation - needs to be set from origin
if (this.angle !== 0)
{
this._game.stage.context.save();
Expand Down Expand Up @@ -287,7 +288,7 @@ module Phaser {

if (this.renderDebug)
{
this.renderBounds();
this.renderBounds(camera, cameraOffsetX, cameraOffsetY);
}

//if (this.flip === true || this.rotation !== 0)
Expand All @@ -306,7 +307,11 @@ module Phaser {

}

private renderBounds() {
// Renders the bounding box around this Sprite and the contact points. Useful for visually debugging.
private renderBounds(camera:Camera, cameraOffsetX:number, cameraOffsetY:number) {

this._dx = cameraOffsetX + (this.bounds.topLeft.x - camera.worldView.x);
this._dy = cameraOffsetY + (this.bounds.topLeft.y - camera.worldView.y);

this._game.stage.context.fillStyle = this.renderDebugColor;
this._game.stage.context.fillRect(this._dx, this._dy, this._dw, this._dh);
Expand Down
23 changes: 4 additions & 19 deletions Phaser/phaser.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
/**
* Phaser
*
* v0.9.1 - April 19th 2013
*
* A small and feature-packed 2D canvas game framework born from the firey pits of Flixel and Kiwi.
*
* Richard Davey (@photonstorm)
*
* Many thanks to Adam Saltsman (@ADAMATOMIC) for the original Flixel AS3 code on which Phaser is based.
*
* "If you want your children to be intelligent, read them fairy tales."
* "If you want them to be more intelligent, read them more fairy tales."
* -- Albert Einstein
*/
var Phaser;
(function (Phaser) {
Phaser.VERSION = 'Phaser version 0.9.1';
})(Phaser || (Phaser = {}));
var Phaser;
(function (Phaser) {
Phaser.VERSION = 'Phaser version 0.9.1';
})(Phaser || (Phaser = {}));
Loading

0 comments on commit 364492d

Please sign in to comment.