Updated so it no longer always tries to run in fullscreen unless you tell it to.

This commit is contained in:
Richard Davey 2013-04-13 20:17:51 +01:00
parent 5f130324c9
commit 0541e93db4
7 changed files with 17446 additions and 4 deletions

110
Phaser/Phaser.csproj Normal file
View file

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<ProjectGuid>{A90BE60F-CAEA-4747-904A-CDB097BA2459}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<OutputPath>bin</OutputPath>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
</PropertyGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<PropertyGroup>
<RootNamespace>Phaser</RootNamespace>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>0</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:51891/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<TypeScriptTarget>ES5</TypeScriptTarget>
<TypeScriptIncludeComments>true</TypeScriptIncludeComments>
<TypeScriptSourceMap>false</TypeScriptSourceMap>
<TypeScriptOutFile>phaser.js</TypeScriptOutFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<TypeScriptTarget>ES5</TypeScriptTarget>
<TypeScriptIncludeComments>false</TypeScriptIncludeComments>
<TypeScriptSourceMap>true</TypeScriptSourceMap>
<TypeScriptOutFile>phaser.js</TypeScriptOutFile>
</PropertyGroup>
<ItemGroup>
<TypeScriptCompile Include="Animations.ts" />
<TypeScriptCompile Include="Basic.ts" />
<TypeScriptCompile Include="Cache.ts" />
<TypeScriptCompile Include="Cameras.ts" />
<TypeScriptCompile Include="Emitter.ts" />
<TypeScriptCompile Include="Game.ts" />
<TypeScriptCompile Include="GameMath.ts" />
<TypeScriptCompile Include="GameObject.ts" />
<TypeScriptCompile Include="Group.ts" />
<TypeScriptCompile Include="Loader.ts" />
<TypeScriptCompile Include="Particle.ts" />
<TypeScriptCompile Include="geom\Point.ts" />
<TypeScriptCompile Include="geom\Rectangle.ts" />
<TypeScriptCompile Include="Sound.ts" />
<TypeScriptCompile Include="Sprite.ts" />
<TypeScriptCompile Include="Stage.ts" />
<TypeScriptCompile Include="State.ts" />
<TypeScriptCompile Include="system\animation\Animation.ts" />
<TypeScriptCompile Include="system\animation\AnimationLoader.ts" />
<TypeScriptCompile Include="system\animation\Frame.ts" />
<TypeScriptCompile Include="system\animation\FrameData.ts" />
<TypeScriptCompile Include="system\Camera.ts" />
<TypeScriptCompile Include="system\input\Input.ts" />
<TypeScriptCompile Include="system\input\Keyboard.ts" />
<TypeScriptCompile Include="system\input\Mouse.ts" />
<TypeScriptCompile Include="system\LinkedList.ts" />
<TypeScriptCompile Include="system\QuadTree.ts" />
<TypeScriptCompile Include="system\RequestAnimationFrame.ts" />
<TypeScriptCompile Include="system\Tile.ts" />
<TypeScriptCompile Include="system\TilemapBuffer.ts" />
<TypeScriptCompile Include="Tilemap.ts" />
<TypeScriptCompile Include="Time.ts" />
<TypeScriptCompile Include="World.ts" />
</ItemGroup>
<ItemGroup>
<Content Include="geom\Circle.ts" />
<Content Include="Signal.ts" />
<Content Include="SignalBinding.ts" />
<Content Include="system\Device.ts" />
<Content Include="system\FullScreen.js">
<DependentUpon>FullScreen.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="system\FullScreen.ts" />
<Content Include="system\input\Finger.ts" />
<Content Include="system\input\Touch.ts" />
<Content Include="system\RandomDataGenerator.ts" />
</ItemGroup>
<Import Project="$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets" />
<PropertyGroup>
<PostBuildEvent>cd $(ProjectDir)
copy $(ProjectDir)phaser.js ..\Tests\</PostBuildEvent>
</PropertyGroup>
</Project>

View file

@ -27,7 +27,8 @@ class Stage {
this.offset = this.getOffset(this.canvas);
this.bounds = new Rectangle(this.offset.x, this.offset.y, width, height);
this.aspectRatio = width / height;
this.scaleMode = Stage.SCALE_FIXED;
this.fullscreen = new FullScreen(this._game);
//document.addEventListener('visibilitychange', (event) => this.visibilityChange(event), false);
@ -40,15 +41,21 @@ class Stage {
private _game: Game;
private _bgColor: string;
public static SCALE_FIXED:number = 0;
public static SCALE_PROPORTIONAL:number = 1;
public static SCALE_FULL:number = 2;
public static ORIENTATION_LANDSCAPE:number = 0;
public static ORIENTATION_PORTRAIT:number = 1;
public bounds: Rectangle;
public aspectRatio: number;
public clear: bool = true;
public canvas: HTMLCanvasElement;
public context: CanvasRenderingContext2D;
public offset: Point;
public fullscreen: FullScreen;
public scaleMode: number;
public update() {

8660
Phaser/phaser.js Normal file

File diff suppressed because it is too large Load diff

View file

@ -42,7 +42,7 @@ class FullScreen {
public update() {
if (window.innerWidth !== this.width || window.innerHeight !== this.height)
if (this._game.stage.scaleMode !== Stage.SCALE_FIXED && (window.innerWidth !== this.width || window.innerHeight !== this.height))
{
this.refresh();
}

View file

@ -4098,7 +4098,7 @@ var FullScreen = (function () {
this.refresh();
};
FullScreen.prototype.update = function () {
if(window.innerWidth !== this.width || window.innerHeight !== this.height) {
if(this._game.stage.scaleMode !== Stage.SCALE_FIXED && (window.innerWidth !== this.width || window.innerHeight !== this.height)) {
this.refresh();
}
};
@ -4176,6 +4176,8 @@ var Stage = (function () {
this.context = this.canvas.getContext('2d');
this.offset = this.getOffset(this.canvas);
this.bounds = new Rectangle(this.offset.x, this.offset.y, width, height);
this.aspectRatio = width / height;
this.scaleMode = Stage.SCALE_FIXED;
this.fullscreen = new FullScreen(this._game);
//document.addEventListener('visibilitychange', (event) => this.visibilityChange(event), false);
//document.addEventListener('webkitvisibilitychange', (event) => this.visibilityChange(event), false);
@ -4186,6 +4188,9 @@ var Stage = (function () {
return _this.visibilityChange(event);
};
}
Stage.SCALE_FIXED = 0;
Stage.SCALE_PROPORTIONAL = 1;
Stage.SCALE_FULL = 2;
Stage.ORIENTATION_LANDSCAPE = 0;
Stage.ORIENTATION_PORTRAIT = 1;
Stage.prototype.update = function () {

8660
build/phaser-06.js Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long