[from now] 2013/03/05 09:04:23

diff --git a/src/animation.js b/src/animation.js
index 90eef90..a175681 100644
--- a/src/animation.js
+++ b/src/animation.js
@@ -362,6 +362,8 @@ define(["require", "exports"], function(require, exports) {
                     this.x = x;
                     this.y = y;
                     this.radius = radius;
+                    this.height = radius * 2;
+                    this.width = radius * 2;
                 }
                 return Data;
             })(BaseData);
@@ -399,6 +401,7 @@ define(["require", "exports"], function(require, exports) {
                     this.x = x;
                     this.y = y;
                     this.width = width;
+                    this.height = height;
                 }
                 return Data;
             })(BaseData);
@@ -414,7 +417,7 @@ define(["require", "exports"], function(require, exports) {
                     new Util.ContextWrapper(context, function (context) {
                         var ctx = context.context;
                         // グラディエーションが設定可能である場合は設定する
-                        if(!_this.data.gradient instanceof Gradation.NullGradient) {
+                        if(!(_this.data.gradient instanceof Gradation.NullGradient)) {
                             ctx.fillStyle = _this.data.gradient.raw();
                         } else {
                             ctx.fillStyle = _this.data.color.toFillStyle();
diff --git a/src/animation.ts b/src/animation.ts
index 445cd0f..f50ec25 100644
--- a/src/animation.ts
+++ b/src/animation.ts
@@ -363,6 +363,8 @@ export module Renderer {
         export class Data extends BaseData {
             constructor(public x: number, public y: number, public radius: number) {
                 super();
+                this.height = radius * 2;
+                this.width = radius * 2;
             }
         }

@@ -396,7 +398,8 @@ export module Renderer {

         // 矩形をレンダリングする際のデータ
         export class Data extends BaseData {
-            constructor(public x: number, public y: number, public width: number, height: number) {
+            constructor(public x: number, public y: number,
+                        public width: number, public height: number) {
                 super();
             }
         }
@@ -412,7 +415,7 @@ export module Renderer {

                     var ctx = context.context;
                     // グラディエーションが設定可能である場合は設定する
-                    if (!this.data.gradient instanceof Gradation.NullGradient) {
+                    if (!(this.data.gradient instanceof Gradation.NullGradient)) {
                         ctx.fillStyle = this.data.gradient.raw();
                     } else {
                         ctx.fillStyle = this.data.color.toFillStyle();
diff --git a/src/firework.js b/src/firework.js
index ebc7c06..33b91ab 100644
--- a/src/firework.js
+++ b/src/firework.js
@@ -148,7 +148,7 @@ define(["require", "exports", "util", "animation", "gameLib"], function(require,
                     s.width *= 2;
                     s.height *= 2;
                     this.data.color.a = 0.3;
-                    this.state.objectState = ObjectState.PrepareLaunch;
+                    this.state.objectState = ObjectState.Touched;
                 }
                 return true;
             };
@@ -170,11 +170,6 @@ define(["require", "exports", "util", "animation", "gameLib"], function(require,
                 contain.forEach(function (elem) {
                     scene.removeEntity(elem);
                 });
-                s.x -= this.data.radius;
-                s.y -= this.data.radius;
-                this.data.radius *= 2;
-                s.width *= 2;
-                s.height *= 2;
                 // ���̂̏������X�V�����B
                 s.body.SetType(Box2D.Dynamics.b2Body.b2_dynamicBody);
                 s.body.DestroyFixture(s.body.GetFixtureList());
@@ -217,16 +212,10 @@ define(["require", "exports", "util", "animation", "gameLib"], function(require,
                     I.binder("zIndex"),
                     I.binder("width"),
                     I.binder("height"),
-                    I.binder("visible")
+                    I.binder("visible"),
+                    I.binder("color")
                 ], this, this.data);
             }
-            Object.defineProperty(Star.prototype, "color", {
-                set: function (col) {
-                    this.data.color = col;
-                },
-                enumerable: true,
-                configurable: true
-            });
             Star.prototype.isValid = function () {
                 return true;
             };
@@ -302,7 +291,6 @@ define(["require", "exports", "util", "animation", "gameLib"], function(require,
                     I.binder("height"),
                     I.binder("visible")
                 ], this, this._data);
-                this._data.color = new animation.Common.Color();
             }
             Wall.prototype.render = function (context) {
                 this._renderer.render(context);
diff --git a/src/firework.ts b/src/firework.ts
index 7365d8f..e576c8f 100644
--- a/src/firework.ts
+++ b/src/firework.ts
@@ -130,7 +130,7 @@ export module GameObj {
                 s.width *= 2;
                 s.height *= 2;
                 this.data.color.a = 0.3;
-                this.state.objectState = ObjectState.PrepareLaunch;
+                this.state.objectState = ObjectState.Touched;
             }
             return true;
         }
@@ -138,6 +138,7 @@ export module GameObj {
         // ^b`µė£³ꂽƂ«A»̎_ł̗̈æɂ©©��Ă¢鐯ð
         // ��µāA©gðg傷éB
         ontouchend(scene: gl.Scene, e: Event): bool {
+
             if (this.state.objectState === ObjectState.PrepareLaunch) {
                 return false;
             }
@@ -148,15 +149,7 @@ export module GameObj {
                 return this.starShape.within(elem, distance);
             });

-            contain.forEach((elem) => {
-                scene.removeEntity(elem);
-            });
-
-            s.x -= this.data.radius;
-            s.y -= this.data.radius;
-            this.data.radius *= 2;
-            s.width *= 2;
-            s.height *= 2;
+            contain.forEach((elem) => {scene.removeEntity(elem);});

             // ̂̏îñðXV·éB
             s.body.SetType(Box2D.Dynamics.b2Body.b2_dynamicBody);
@@ -197,7 +190,7 @@ export module GameObj {
         body: B2Body;
         private data: animation.Renderer.Circle.Data;

-        set color(col: animation.Common.Color) { this.data.color = col; }
+        color:animation.Common.Color;

         constructor() {
             super();
@@ -209,7 +202,7 @@ export module GameObj {
             // oChµĂ¨­
             I.propBind([I.binder("x"), I.binder("y"), I.binder("zIndex"),
                         I.binder("width"), I.binder("height"),
-                        I.binder("visible")], this, this.data);
+                        I.binder("visible"), I.binder("color")], this, this.data);
         }

         isValid(): bool {
@@ -224,7 +217,6 @@ export module GameObj {
         // star����_O·éB_O©̂́AcircleÌrenderɔC¹éB
         render(context: animation.Context): void {

-
             var r = this.data.radius;
             var grad = new animation.Gradation.Radial(context);
             grad.from(this.x + r * 0.7, this.y + r * 0.5, 1).to(this.x + r, this.y + r, r);
@@ -289,8 +281,6 @@ export module GameObj {
             I.propBind([I.binder("x"), I.binder("y"), I.binder("zIndex"),
                         I.binder("width"), I.binder("height"),
                         I.binder("visible")], this, this._data);
-
-            this._data.color = new animation.Common.Color();
         }

         render(context:animation.Context) : void {
diff --git a/src/gameLib.js b/src/gameLib.js
index b4ddcb7..b1e3093 100644
--- a/src/gameLib.js
+++ b/src/gameLib.js
@@ -48,7 +48,7 @@ define(["require", "exports", "util", "animation"], function(require, exports, _
                 _super.call(this);
             // 各シーンに存在するオブジェクト
             this._correctedEntities = [];
-            this._noncorrectedEntities = [];
+            this._nonCorrectedEntities = [];
         }
         Object.defineProperty(SceneImpl.prototype, "entities", {
             get: function () {
@@ -61,11 +61,11 @@ define(["require", "exports", "util", "animation"], function(require, exports, _
         * 管理対象のentityを追加する
         */
         function (entity) {
-            if(entity && entity.enableCorrect) {
+            if(entity != null && entity.enableCorrect) {
                 entity.scene = this;
                 this._correctedEntities.push(entity);
             } else if(entity) {
-                this._noncorrectedEntities.push(entity);
+                this._nonCorrectedEntities.push(entity);
             }
         };
         SceneImpl.prototype.removeEntity = /**
@@ -76,7 +76,7 @@ define(["require", "exports", "util", "animation"], function(require, exports, _
                 util.remove(this._correctedEntities, entity);
                 entity.listener.fire(EventConstants.REMOVE, null);
             } else {
-                util.remove(this._noncorrectedEntities, entity);
+                util.remove(this._nonCorrectedEntities, entity);
                 entity.listener.fire(EventConstants.REMOVE, null);
             }
         };
@@ -86,7 +86,7 @@ define(["require", "exports", "util", "animation"], function(require, exports, _
             this._correctedEntities.forEach(function (elem) {
                 return elem.render(context);
             });
-            this._noncorrectedEntities.forEach(function (elem) {
+            this._nonCorrectedEntities.forEach(function (elem) {
                 return elem.render(context);
             });
         };
@@ -287,6 +287,9 @@ define(["require", "exports", "util", "animation"], function(require, exports, _
             elem.addEventListener("mouseup", function (e) {
                 _this.currentScene.fire(EventConstants.TOUCH_END, e);
             });
+            elem.addEventListener("touchend", function (e) {
+                _this.currentScene.fire(EventConstants.TOUCH_END, e);
+            });
             var canvas = elem;
             this._targetContext = new animation.Context(canvas);
             document.body.appendChild(elem);
@@ -397,7 +400,7 @@ define(["require", "exports", "util", "animation"], function(require, exports, _
             };
             World.prototype.remove = // 指定したtargetを持つadapterを削除する。
             function (target) {
-                if(target !== null) {
+                if(target != null) {
                     util.remove(this._binders, target);
                     this.removeBody(target.body);
                 }
diff --git a/src/gameLib.ts b/src/gameLib.ts
index 135c427..79bfeca 100644
--- a/src/gameLib.ts
+++ b/src/gameLib.ts
@@ -83,7 +83,7 @@ export class SceneImpl extends EventTargetImpl implements Scene {

     // 各シーンに存在するオブジェクト
     private _correctedEntities: Entity[] = [];
-    private _noncorrectedEntities: Entity[] = [];
+    private _nonCorrectedEntities: Entity[] = [];

     get entities(): Entity[] { return this._correctedEntities; }

@@ -93,11 +93,11 @@ export class SceneImpl extends EventTargetImpl implements Scene {
      * 管理対象のentityを追加する
      */
     addEntity(entity: Entity): void {
-        if (entity && entity.enableCorrect) {
+        if (entity != null && entity.enableCorrect) {
             entity.scene = this;
             this._correctedEntities.push(entity);
         } else if (entity) {
-            this._noncorrectedEntities.push(entity);
+            this._nonCorrectedEntities.push(entity);
         }
     }

@@ -109,7 +109,7 @@ export class SceneImpl extends EventTargetImpl implements Scene {
             util.remove(this._correctedEntities, entity);
             entity.listener.fire(EventConstants.REMOVE, null);
         } else {
-            util.remove(this._noncorrectedEntities, entity);
+            util.remove(this._nonCorrectedEntities, entity);
             entity.listener.fire(EventConstants.REMOVE, null);
         }
     }
@@ -118,7 +118,7 @@ export class SceneImpl extends EventTargetImpl implements Scene {
     render(context: animation.Context): void {
         context.clear();
         this._correctedEntities.forEach(elem => elem.render(context));
-        this._noncorrectedEntities.forEach(elem => elem.render(context));
+        this._nonCorrectedEntities.forEach(elem => elem.render(context));
     }
 }

@@ -308,6 +308,7 @@ export class Game {
         elem.addEventListener("touchstart", (e: MouseEvent) => {
             this.currentScene.fire(EventConstants.TOUCH_START, e);
         });
+
         elem.addEventListener("mousedown", (e: MouseEvent) => {
             this.currentScene.fire(EventConstants.TOUCH_START, e);
         });
@@ -316,6 +317,10 @@ export class Game {
             this.currentScene.fire(EventConstants.TOUCH_END, e);
         });

+        elem.addEventListener("touchend", (e:MouseEvent) => {
+            this.currentScene.fire(EventConstants.TOUCH_END, e);
+        });
+
         var canvas = <HTMLCanvasElement>elem;
         this._targetContext = new animation.Context(canvas);
         document.body.appendChild(elem);
@@ -407,7 +412,7 @@ export module Physics {

         // 指定したtargetを持つadapterを削除する。
         remove(target: BodyBinder): void {
-            if (target !== null) {
+            if (target != null) {
                 util.remove(this._binders, target);
                 this.removeBody(target.body);
             }
diff --git a/src/main.js b/src/main.js
index 76760b6..c93a7f4 100644
--- a/src/main.js
+++ b/src/main.js
@@ -37,10 +37,10 @@ define(["require", "exports", "gameLib", "firework", "animation"], function(requ
             if(++count == game.fps) {
                 count = 0;
                 var star = new Firework.GameObj.Star();
-                var body = new GL.Physics.BodyBinder(star, star.createFixture(world.worldScale));
                 star.color = rc();
                 star.x = 100;
                 star.y = 0;
+                var body = new GL.Physics.BodyBinder(star, star.createFixture(world.worldScale));
                 star.listener.on(GL.EventConstants.TOUCH_START, star.makeTouchStartHandler(game.currentScene));
                 star.listener.on(GL.EventConstants.TOUCH_END, star.makeTouchEndHandler(game.currentScene));
                 star.listener.on(GL.EventConstants.REMOVE, function (e) {
@@ -59,14 +59,30 @@ define(["require", "exports", "gameLib", "firework", "animation"], function(requ
             var vec = animation.Common.Vector;
             // �N���b�N�������W�ɐ������݂��邩�ǂ����𒲂ׂ��B
             entities = entities.filter(function (elem) {
+                console.log(elem);
                 var center = new vec.Vector2D(elem.x + elem.width / 2, elem.y + elem.height / 2);
                 var touched = new vec.Vector2D(event.clientX, event.clientY);
-                center.sub(touched).norm() < elem.width / 2;
+                return center.sub(touched).norm() < elem.width / 2;
             });
             entities.forEach(function (elem) {
                 elem.listener.fire(GL.EventConstants.TOUCH_END, event);
             });
         });
+        game.currentScene.on(GL.EventConstants.TOUCH_START, function (event) {
+            var entities = game.currentScene.entities;
+            var vec = animation.Common.Vector;
+            // �N���b�N�������W�ɐ������݂��邩�ǂ����𒲂ׂ��B
+            entities = entities.filter(function (elem) {
+                console.log(elem);
+                var center = new vec.Vector2D(elem.x + elem.width / 2, elem.y + elem.height / 2);
+                var touched = new vec.Vector2D(event.clientX, event.clientY);
+                console.log(center.x + ',' + center.y + ":" + touched.x + ',' + touched.y);
+                return center.sub(touched).norm() < elem.width / 2;
+            });
+            entities.forEach(function (elem) {
+                elem.listener.fire(GL.EventConstants.TOUCH_START, event);
+            });
+        });
         // 10�t���[�����ɐ��𐶐������B
         // game.rootScene.tl.then(() => {
         //     var star = new GL.Firework.Star(16, 16);
diff --git a/src/main.ts b/src/main.ts
index 57727db..ef8fcc5 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -50,11 +50,11 @@ game.onload = (g) => {
         if (++count == game.fps) {
             count = 0;
             var star = new Firework.GameObj.Star();
-            var body = new GL.Physics.BodyBinder(
-                star, star.createFixture(world.worldScale));
             star.color = rc();
             star.x = 100;
             star.y = 0;
+            var body = new GL.Physics.BodyBinder(
+                star, star.createFixture(world.worldScale));
             star.listener.on(GL.EventConstants.TOUCH_START, star.makeTouchStartHandler(game.currentScene));
             star.listener.on(GL.EventConstants.TOUCH_END, star.makeTouchEndHandler(game.currentScene));
             star.listener.on(GL.EventConstants.REMOVE, (e) => {
@@ -76,17 +76,38 @@ game.onload = (g) => {
         var vec = animation.Common.Vector;
         // NbNµ½��Wɐ¯ª¶݂·邩ǂ¤©𒲂ׂéB
         entities = entities.filter((elem) => {
+            console.log(elem);
             var center = new vec.Vector2D(elem.x + elem.width / 2,
             elem.y + elem.height / 2);
             var touched = new vec.Vector2D(event.clientX, event.clientY);

-            center.sub(touched).norm() < elem.width / 2;
+            return center.sub(touched).norm() < elem.width / 2;
         });
+
         entities.forEach((elem) => {
             elem.listener.fire(GL.EventConstants.TOUCH_END, event);
         });
     });

+    game.currentScene.on(GL.EventConstants.TOUCH_START, (event: MouseEvent) => {
+        var entities = game.currentScene.entities;
+        var vec = animation.Common.Vector;
+        // NbNµ½��Wɐ¯ª¶݂·邩ǂ¤©𒲂ׂéB
+        entities = entities.filter((elem) => {
+            console.log(elem);
+            var center = new vec.Vector2D(elem.x + elem.width / 2,
+            elem.y + elem.height / 2);
+            var touched = new vec.Vector2D(event.clientX, event.clientY);
+            console.log(center.x + ',' +  center.y + ":" + touched.x + ',' + touched.y);
+
+            return center.sub(touched).norm() < elem.width / 2;
+        });
+
+        entities.forEach((elem) => {
+            elem.listener.fire(GL.EventConstants.TOUCH_START, event);
+        });
+    });
+
     // 10t[ɐ¯𐶐¬·éB
     // game.rootScene.tl.then(() => {
     //     var star = new GL.Firework.Star(16, 16);
diff --git a/src/util.js b/src/util.js
index f1f7c06..b610116 100644
--- a/src/util.js
+++ b/src/util.js
@@ -72,6 +72,7 @@ define(["require", "exports"], function(require, exports) {
         Illiegals.binder = binder;
         // JavaScript���̋@�\�𗘗p���āA�N���X�ɓ��I��setter��getter�𐶐������B
         // Mixin���o�������s�v�ɂȂ��\���������B
+        // getter/setter���쐬���鑤�ɓ����̃v���p�e�B�����݂����K�v�͖����B
         // @param src any setter/getter�𐶐������I�u�W�F�N�g
         // @param dst any setter/getter�����l���擾/�ݒ肷���I�u�W�F�N�g
         function propBind(mappings, src, dst) {
@@ -79,7 +80,7 @@ define(["require", "exports"], function(require, exports) {
                 return;
             }
             mappings.forEach(function (mapping) {
-                if(src[mapping.name] !== undefined && dst[mapping.name] !== undefined) {
+                if(dst[mapping.name] !== undefined) {
                     if(!mapping.noGetterBind) {
                         Object.defineProperty(src, mapping.name, {
                             get: function () {
diff --git a/src/util.ts b/src/util.ts
index 00c4181..b51b4d4 100644
--- a/src/util.ts
+++ b/src/util.ts
@@ -82,6 +82,7 @@ export module Illiegals {

     // JavaScript¤̋@\𗘗pµāANXɓ®IÉsetterÆgetter𐶐¬·éB
     // Mixinªo½çsvɂȂé\«ª éB
+    // getter/setterð쐬·鑤ɓ¯¼̃vpeBª¶݂·éKv͖³¢B
     // @param src any setter/getter𐶐¬·éIuWFNg
     // @param dst any setter/getter©çlð擾/ݒ肷éIuWFNg
     export function propBind(mappings: PropertyMapping[], src: any, dst: any): void {
@@ -90,7 +91,7 @@ export module Illiegals {
         }

         mappings.forEach((mapping) => {
-            if (src[mapping.name] !== undefined && dst[mapping.name] !== undefined) {
+            if (dst[mapping.name] !== undefined) {

                 if (!mapping.noGetterBind) {
                     Object.defineProperty(