Skip to content

Commit

Permalink
Updated Renderer system, now much easier to expand and maintain.
Browse files Browse the repository at this point in the history
  • Loading branch information
photonstorm committed Aug 8, 2013
1 parent d720599 commit bc77c3f
Show file tree
Hide file tree
Showing 52 changed files with 3,752 additions and 2,563 deletions.
6 changes: 3 additions & 3 deletions Phaser/Game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/// <reference path="input/InputManager.ts" />
/// <reference path="renderers/IRenderer.ts" />
/// <reference path="renderers/HeadlessRenderer.ts" />
/// <reference path="renderers/CanvasRenderer.ts" />
/// <reference path="renderers/canvas/CanvasRenderer.ts" />
/// <reference path="utils/DebugUtils.ts" />
/// <reference path="core/PluginManager.ts" />

Expand Down Expand Up @@ -368,12 +368,12 @@ module Phaser {
switch (type)
{
case Phaser.Types.RENDERER_AUTO_DETECT:
this.renderer = new Phaser.HeadlessRenderer(this);
this.renderer = new Phaser.Renderer.Headless.HeadlessRenderer(this);
break;

case Phaser.Types.RENDERER_AUTO_DETECT:
case Phaser.Types.RENDERER_CANVAS:
this.renderer = new Phaser.CanvasRenderer(this);
this.renderer = new Phaser.Renderer.Canvas.CanvasRenderer(this);
break;

// WebGL coming soon :)
Expand Down
32 changes: 28 additions & 4 deletions Phaser/Phaser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@
</Content>
<TypeScriptCompile Include="utils\PointUtils.ts" />
<TypeScriptCompile Include="utils\CircleUtils.ts" />
<TypeScriptCompile Include="renderers\CanvasRenderer.ts" />
<TypeScriptCompile Include="Statics.ts" />
<TypeScriptCompile Include="renderers\HeadlessRenderer.ts" />
<TypeScriptCompile Include="math\QuadTree.ts" />
Expand Down Expand Up @@ -204,6 +203,34 @@
<Content Include="physics\Manager.js">
<DependentUpon>Manager.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="renderers\canvas\SpriteRenderer.ts" />
<TypeScriptCompile Include="renderers\canvas\CanvasRenderer.ts" />
<TypeScriptCompile Include="renderers\canvas\CameraRenderer.ts" />
<Content Include="renderers\canvas\CameraRenderer.js">
<DependentUpon>CameraRenderer.ts</DependentUpon>
</Content>
<Content Include="renderers\canvas\CanvasRenderer.js">
<DependentUpon>CanvasRenderer.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="renderers\canvas\GroupRenderer.ts" />
<TypeScriptCompile Include="renderers\canvas\GeometryRenderer.ts" />
<Content Include="renderers\canvas\GeometryRenderer.js">
<DependentUpon>GeometryRenderer.ts</DependentUpon>
</Content>
<Content Include="renderers\canvas\GroupRenderer.js">
<DependentUpon>GroupRenderer.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="renderers\canvas\ScrollZoneRenderer.ts" />
<Content Include="renderers\canvas\ScrollZoneRenderer.js">
<DependentUpon>ScrollZoneRenderer.ts</DependentUpon>
</Content>
<Content Include="renderers\canvas\SpriteRenderer.js">
<DependentUpon>SpriteRenderer.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="renderers\canvas\TilemapRenderer.ts" />
<Content Include="renderers\canvas\TilemapRenderer.js">
<DependentUpon>TilemapRenderer.ts</DependentUpon>
</Content>
<Content Include="renderers\HeadlessRenderer.js">
<DependentUpon>HeadlessRenderer.ts</DependentUpon>
</Content>
Expand All @@ -214,9 +241,6 @@
<Content Include="Statics.js">
<DependentUpon>Statics.ts</DependentUpon>
</Content>
<Content Include="renderers\CanvasRenderer.js">
<DependentUpon>CanvasRenderer.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="system\screens\OrientationScreen.ts" />
<Content Include="system\screens\OrientationScreen.js">
<DependentUpon>OrientationScreen.ts</DependentUpon>
Expand Down
2 changes: 2 additions & 0 deletions Phaser/Stage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ module Phaser {

this.scale.update();

this.context.setTransform(1, 0, 0, 1, 0, 0);

if (this.clear || (this._game.paused && this.disablePauseScreen == false))
{
if (this.patchAndroidClearRectBug)
Expand Down
29 changes: 28 additions & 1 deletion Phaser/Statics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,33 @@ module Phaser {
static RENDERER_CANVAS: number = 2;
static RENDERER_WEBGL: number = 3;

static CAMERA_TYPE_ORTHOGRAPHIC: number = 0;
static CAMERA_TYPE_ISOMETRIC: number = 1;

/**
* Camera "follow" style preset: camera has no deadzone, just tracks the focus object directly.
* @type {number}
*/
public static CAMERA_FOLLOW_LOCKON: number = 0;

/**
* Camera "follow" style preset: camera deadzone is narrow but tall.
* @type {number}
*/
public static CAMERA_FOLLOW_PLATFORMER: number = 1;

/**
* Camera "follow" style preset: camera deadzone is a medium-size square around the focus object.
* @type {number}
*/
public static CAMERA_FOLLOW_TOPDOWN: number = 2;

/**
* Camera "follow" style preset: camera deadzone is a small square around the focus object.
* @type {number}
*/
public static CAMERA_FOLLOW_TOPDOWN_TIGHT: number = 3;

static GROUP: number = 0;
static SPRITE: number = 1;
static GEOMSPRITE: number = 2;
Expand All @@ -21,7 +48,7 @@ module Phaser {

static GEOM_POINT: number = 0;
static GEOM_CIRCLE: number = 1;
static GEOM_Rectangle: number = 2;
static GEOM_RECTANGLE: number = 2;
static GEOM_LINE: number = 3;
static GEOM_POLYGON: number = 4;

Expand Down
Loading

0 comments on commit bc77c3f

Please sign in to comment.