@@ -13,7 +13,7 @@ var Component = require('../components');
1313// var Camera = require('../camera/Camera');
1414var Settings = require ( './Settings' ) ;
1515var RTree = require ( '../structs/RTree' ) ;
16- var Transform = require ( '../components/experimental-Transform -2' )
16+ var Camera = require ( '../camera/Camera -2' )
1717
1818var Systems = function ( state , config )
1919{
@@ -39,7 +39,7 @@ var Systems = function (state, config)
3939 this . tree ;
4040
4141 // State properties
42- // this.camera;
42+ this . camera ;
4343 this . children ;
4444 this . color ;
4545 this . data ;
@@ -79,7 +79,7 @@ Systems.prototype = {
7979 this . color = new Component . Color ( this . state ) ;
8080 this . data = new Component . Data ( this . state ) ;
8181 this . transform = new Component . Transform ( this . state ) ;
82-
82+ this . camera = new Camera ( 0 , 0 , this . game . config . width , this . game . config . height ) ;
8383 this . inject ( ) ;
8484 } ,
8585
@@ -103,6 +103,8 @@ Systems.prototype = {
103103 this . state . state = this . game . state ;
104104 this . state . cache = this . game . cache ;
105105 this . state . textures = this . game . textures ;
106+
107+ this . camera . setState ( this . state ) ;
106108 } ,
107109
108110 // Called just once per frame, regardless of speed
@@ -129,9 +131,10 @@ Systems.prototype = {
129131 render : function ( interpolation , renderer )
130132 {
131133 var transform = this . transform ;
132- Transform . updateRoot ( transform ) ;
134+ this . camera . preRender ( ) ;
133135 renderer . render ( this . state , transform . flatRenderArray , interpolation ) ;
134136 this . state . render ( interpolation ) ;
137+ this . camera . postRender ( ) ;
135138 } ,
136139
137140 // Called just once per frame, regardless of speed
0 commit comments