Fixed issue where Phaser.Canvas.create would always make a screencanvas for CocoonJS, but that should only happen once. New parameter toggles it.

This commit is contained in:
photonstorm
2014-02-28 03:55:06 +00:00
parent 34ee2b0b20
commit 09d4a35b7f
14 changed files with 688 additions and 273 deletions
+9 -10
View File
@@ -1,9 +1,8 @@
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update, render: render });
function preload() {
game.load.image('pic', '../assets/pics/questar.png');
game.load.image('pic', '/phaser/examples/assets/pics/1984-nocooper-space.png');
}
@@ -12,26 +11,26 @@ var bmd;
function create() {
game.add.image(0, 0, 'pic');
console.log('pic box 11');
console.log('pic?');
game.add.sprite(0, 0, 'pic');
// bmd = game.add.bitmapData(800, 600);
// bmd.context.fillStyle = 'rgba(255,0,0,0.2)';
// bmd.context.fillRect(0, 0, 300, 100);
bmd = game.add.bitmapData(800, 600);
bmd.context.fillStyle = 'rgba(255,0,0,1)';
bmd.context.fillRect(0, 0, 300, 100);
// image = game.add.image(0, 0, bmd);
image = game.add.image(0, 100, bmd);
}
function update() {
// bmd.context.fillRect(game.input.x, game.input.y, 8, 8);
bmd.context.fillRect(game.input.x, game.input.y, 8, 8);
}
function render() {
// game.debug.renderText(game.input.x, 32, 32);
game.debug.renderText(game.input.x, 32, 32);
}
-12
View File
@@ -1,12 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>phaser</title>
<script src="../../dist/phaser.js" type="text/javascript"></script>
<script src="bmd.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>
+4 -75
View File
@@ -1,88 +1,17 @@
<?php
// Global
$files = dirToArray(dirname(__FILE__));
$total = 0;
foreach ($files as $key => $value)
{
if (is_array($value) && count($value) > 0)
{
$total += count($value);
}
}
function getFile() {
global $files, $dir, $filename, $title, $code;
if (isset($_GET['d']) && isset($_GET['f']))
{
$dir = urldecode($_GET['d']);
$filename = urldecode($_GET['d']) . '/' . urldecode($_GET['f']);
$title = urldecode($_GET['t']);
if (file_exists($filename))
{
$code = file_get_contents($filename);
$files = dirToArray($dir);
}
}
}
function dirToArray($dir) {
$ignore = array('.', '..', '_site', 'assets', 'gfx', 'states', 'book', 'filters', 'misc');
$result = array();
$root = scandir($dir);
$dirs = array_diff($root, $ignore);
foreach ($dirs as $key => $value)
{
if (is_dir($dir . DIRECTORY_SEPARATOR . $value))
{
$result[$value] = dirToArray($dir . DIRECTORY_SEPARATOR . $value);
}
else
{
if (substr($value, -3) == '.js')
{
$result[] = $value;
}
}
}
return $result;
}
function printJSLinks($dir, $files) {
$output = "";
foreach ($files as $key => $value)
{
$value2 = substr($value, 0, -3);
$file = urlencode($value);
$output .= "<a href=\"wip/index.php?f=$file\">$value2</a><br />";
}
return $output;
}
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>phaser</title>
<base href="../" />
<?php
require('../../build/config.php');
if (isset($_GET['f']))
{
$f = $_GET['f'];
?>
<script src="../../dist/phaser.js" type="text/javascript"></script>
<script src="<?php echo $f?>" type="text/javascript"></script>
<script src="wip/<?php echo $f?>" type="text/javascript"></script>
<?php
}
?>
+136
View File
@@ -0,0 +1,136 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>phaser</title>
<script src="/phaser/build/p2.js"></script>
<script src="/phaser/src/Intro.js"></script>
<script src="/phaser/src/pixi/Pixi.js"></script>
<script src="/phaser/src/Phaser.js"></script>
<script src="/phaser/src/utils/Utils.js"></script>
<script src="/phaser/src/geom/Circle.js"></script>
<script src="/phaser/src/geom/Point.js"></script>
<script src="/phaser/src/geom/Rectangle.js"></script>
<script src="/phaser/src/geom/Line.js"></script>
<script src="/phaser/src/geom/Ellipse.js"></script>
<script src="/phaser/src/geom/Polygon.js"></script>
<script src="/phaser/src/pixi/core/Matrix.js"></script>
<script src="/phaser/src/pixi/display/DisplayObject.js"></script>
<script src="/phaser/src/pixi/display/DisplayObjectContainer.js"></script>
<script src="/phaser/src/pixi/display/Sprite.js"></script>
<script src="/phaser/src/pixi/display/SpriteBatch.js"></script>
<script src="/phaser/src/pixi/filters/FilterBlock.js"></script>
<script src="/phaser/src/pixi/text/Text.js"></script>
<script src="/phaser/src/pixi/text/BitmapText.js"></script>
<script src="/phaser/src/pixi/display/Stage.js"></script>
<script src="/phaser/src/pixi/utils/EventTarget.js"></script>
<script src="/phaser/src/pixi/utils/Polyk.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLShaderUtils.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/shaders/PixiShader.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/shaders/PixiFastShader.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/shaders/StripShader.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/shaders/PrimitiveShader.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLGraphics.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/WebGLRenderer.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLMaskManager.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLShaderManager.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLFastSpriteBatch.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLFilterManager.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/FilterTexture.js"></script>
<script src="/phaser/src/pixi/renderers/canvas/utils/CanvasMaskManager.js"></script>
<script src="/phaser/src/pixi/renderers/canvas/utils/CanvasTinter.js"></script>
<script src="/phaser/src/pixi/renderers/canvas/CanvasRenderer.js"></script>
<script src="/phaser/src/pixi/renderers/canvas/CanvasGraphics.js"></script>
<script src="/phaser/src/pixi/primitives/Graphics.js"></script>
<script src="/phaser/src/pixi/extras/TilingSprite.js"></script>
<script src="/phaser/src/pixi/textures/BaseTexture.js"></script>
<script src="/phaser/src/pixi/textures/Texture.js"></script>
<script src="/phaser/src/pixi/textures/RenderTexture.js"></script>
<script src="/phaser/src/core/Camera.js"></script>
<script src="/phaser/src/core/State.js"></script>
<script src="/phaser/src/core/StateManager.js"></script>
<script src="/phaser/src/core/LinkedList.js"></script>
<script src="/phaser/src/core/Signal.js"></script>
<script src="/phaser/src/core/SignalBinding.js"></script>
<script src="/phaser/src/core/Filter.js"></script>
<script src="/phaser/src/core/Plugin.js"></script>
<script src="/phaser/src/core/PluginManager.js"></script>
<script src="/phaser/src/core/Stage.js"></script>
<script src="/phaser/src/core/Group.js"></script>
<script src="/phaser/src/core/World.js"></script>
<script src="/phaser/src/core/Game.js"></script>
<script src="/phaser/src/core/ScaleManager.js"></script>
<script src="/phaser/src/input/Input.js"></script>
<script src="/phaser/src/input/Key.js"></script>
<script src="/phaser/src/input/Keyboard.js"></script>
<script src="/phaser/src/input/Mouse.js"></script>
<script src="/phaser/src/input/MSPointer.js"></script>
<script src="/phaser/src/input/Pointer.js"></script>
<script src="/phaser/src/input/Touch.js"></script>
<script src="/phaser/src/input/Gamepad.js"></script>
<script src="/phaser/src/input/SinglePad.js"></script>
<script src="/phaser/src/input/GamepadButton.js"></script>
<script src="/phaser/src/input/InputHandler.js"></script>
<script src="/phaser/src/gameobjects/Events.js"></script>
<script src="/phaser/src/gameobjects/GameObjectCreator.js"></script>
<script src="/phaser/src/gameobjects/GameObjectFactory.js"></script>
<script src="/phaser/src/gameobjects/BitmapData.js"></script>
<script src="/phaser/src/gameobjects/Sprite.js"></script>
<script src="/phaser/src/gameobjects/Image.js"></script>
<script src="/phaser/src/gameobjects/TileSprite.js"></script>
<script src="/phaser/src/gameobjects/Text.js"></script>
<script src="/phaser/src/gameobjects/BitmapText.js"></script>
<script src="/phaser/src/gameobjects/Button.js"></script>
<script src="/phaser/src/gameobjects/Graphics.js"></script>
<script src="/phaser/src/gameobjects/RenderTexture.js"></script>
<script src="/phaser/src/gameobjects/SpriteBatch.js"></script>
<script src="/phaser/src/gameobjects/BitmapFont.js"></script>
<script src="/phaser/src/system/Canvas.js"></script>
<script src="/phaser/src/system/Device.js"></script>
<script src="/phaser/src/system/RequestAnimationFrame.js"></script>
<script src="/phaser/src/math/Math.js"></script>
<script src="/phaser/src/math/RandomDataGenerator.js"></script>
<script src="/phaser/src/net/Net.js"></script>
<script src="/phaser/src/tween/TweenManager.js"></script>
<script src="/phaser/src/tween/Tween.js"></script>
<script src="/phaser/src/tween/Easing.js"></script>
<script src="/phaser/src/time/Time.js"></script>
<script src="/phaser/src/time/Timer.js"></script>
<script src="/phaser/src/time/TimerEvent.js"></script>
<script src="/phaser/src/animation/AnimationManager.js"></script>
<script src="/phaser/src/animation/Animation.js"></script>
<script src="/phaser/src/animation/Frame.js"></script>
<script src="/phaser/src/animation/FrameData.js"></script>
<script src="/phaser/src/animation/AnimationParser.js"></script>
<script src="/phaser/src/loader/Cache.js"></script>
<script src="/phaser/src/loader/Loader.js"></script>
<script src="/phaser/src/loader/LoaderParser.js"></script>
<script src="/phaser/src/sound/Sound.js"></script>
<script src="/phaser/src/sound/SoundManager.js"></script>
<script src="/phaser/src/utils/Debug.js"></script>
<script src="/phaser/src/utils/Color.js"></script>
<script src="/phaser/src/physics/World.js"></script>
<script src="/phaser/src/physics/PointProxy.js"></script>
<script src="/phaser/src/physics/InversePointProxy.js"></script>
<script src="/phaser/src/physics/Body.js"></script>
<script src="/phaser/src/physics/Spring.js"></script>
<script src="/phaser/src/physics/Material.js"></script>
<script src="/phaser/src/physics/ContactMaterial.js"></script>
<script src="/phaser/src/physics/CollisionGroup.js"></script>
<script src="/phaser/src/particles/Particles.js"></script>
<script src="/phaser/src/particles/arcade/ArcadeParticles.js"></script>
<script src="/phaser/src/particles/arcade/Emitter.js"></script>
<script src="/phaser/src/tilemap/Tile.js"></script>
<script src="/phaser/src/tilemap/Tilemap.js"></script>
<script src="/phaser/src/tilemap/TilemapLayer.js"></script>
<script src="/phaser/src/tilemap/TilemapParser.js"></script>
<script src="/phaser/src/tilemap/Tileset.js"></script>
<script src="/phaser/examples/wip/bmd.js" type="text/javascript"></script>
</head>
<body>
<div id="phaser-example"></div>
</body>
</html>
+136
View File
@@ -0,0 +1,136 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>phaser</title>
<script src="/phaser/build/p2.js"></script>
<script src="/phaser/src/Intro.js"></script>
<script src="/phaser/src/pixi/Pixi.js"></script>
<script src="/phaser/src/Phaser.js"></script>
<script src="/phaser/src/utils/Utils.js"></script>
<script src="/phaser/src/geom/Circle.js"></script>
<script src="/phaser/src/geom/Point.js"></script>
<script src="/phaser/src/geom/Rectangle.js"></script>
<script src="/phaser/src/geom/Line.js"></script>
<script src="/phaser/src/geom/Ellipse.js"></script>
<script src="/phaser/src/geom/Polygon.js"></script>
<script src="/phaser/src/pixi/core/Matrix.js"></script>
<script src="/phaser/src/pixi/display/DisplayObject.js"></script>
<script src="/phaser/src/pixi/display/DisplayObjectContainer.js"></script>
<script src="/phaser/src/pixi/display/Sprite.js"></script>
<script src="/phaser/src/pixi/display/SpriteBatch.js"></script>
<script src="/phaser/src/pixi/filters/FilterBlock.js"></script>
<script src="/phaser/src/pixi/text/Text.js"></script>
<script src="/phaser/src/pixi/text/BitmapText.js"></script>
<script src="/phaser/src/pixi/display/Stage.js"></script>
<script src="/phaser/src/pixi/utils/EventTarget.js"></script>
<script src="/phaser/src/pixi/utils/Polyk.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLShaderUtils.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/shaders/PixiShader.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/shaders/PixiFastShader.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/shaders/StripShader.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/shaders/PrimitiveShader.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLGraphics.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/WebGLRenderer.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLMaskManager.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLShaderManager.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLFastSpriteBatch.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLFilterManager.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/FilterTexture.js"></script>
<script src="/phaser/src/pixi/renderers/canvas/utils/CanvasMaskManager.js"></script>
<script src="/phaser/src/pixi/renderers/canvas/utils/CanvasTinter.js"></script>
<script src="/phaser/src/pixi/renderers/canvas/CanvasRenderer.js"></script>
<script src="/phaser/src/pixi/renderers/canvas/CanvasGraphics.js"></script>
<script src="/phaser/src/pixi/primitives/Graphics.js"></script>
<script src="/phaser/src/pixi/extras/TilingSprite.js"></script>
<script src="/phaser/src/pixi/textures/BaseTexture.js"></script>
<script src="/phaser/src/pixi/textures/Texture.js"></script>
<script src="/phaser/src/pixi/textures/RenderTexture.js"></script>
<script src="/phaser/src/core/Camera.js"></script>
<script src="/phaser/src/core/State.js"></script>
<script src="/phaser/src/core/StateManager.js"></script>
<script src="/phaser/src/core/LinkedList.js"></script>
<script src="/phaser/src/core/Signal.js"></script>
<script src="/phaser/src/core/SignalBinding.js"></script>
<script src="/phaser/src/core/Filter.js"></script>
<script src="/phaser/src/core/Plugin.js"></script>
<script src="/phaser/src/core/PluginManager.js"></script>
<script src="/phaser/src/core/Stage.js"></script>
<script src="/phaser/src/core/Group.js"></script>
<script src="/phaser/src/core/World.js"></script>
<script src="/phaser/src/core/Game.js"></script>
<script src="/phaser/src/core/ScaleManager.js"></script>
<script src="/phaser/src/input/Input.js"></script>
<script src="/phaser/src/input/Key.js"></script>
<script src="/phaser/src/input/Keyboard.js"></script>
<script src="/phaser/src/input/Mouse.js"></script>
<script src="/phaser/src/input/MSPointer.js"></script>
<script src="/phaser/src/input/Pointer.js"></script>
<script src="/phaser/src/input/Touch.js"></script>
<script src="/phaser/src/input/Gamepad.js"></script>
<script src="/phaser/src/input/SinglePad.js"></script>
<script src="/phaser/src/input/GamepadButton.js"></script>
<script src="/phaser/src/input/InputHandler.js"></script>
<script src="/phaser/src/gameobjects/Events.js"></script>
<script src="/phaser/src/gameobjects/GameObjectCreator.js"></script>
<script src="/phaser/src/gameobjects/GameObjectFactory.js"></script>
<script src="/phaser/src/gameobjects/BitmapData.js"></script>
<script src="/phaser/src/gameobjects/Sprite.js"></script>
<script src="/phaser/src/gameobjects/Image.js"></script>
<script src="/phaser/src/gameobjects/TileSprite.js"></script>
<script src="/phaser/src/gameobjects/Text.js"></script>
<script src="/phaser/src/gameobjects/BitmapText.js"></script>
<script src="/phaser/src/gameobjects/Button.js"></script>
<script src="/phaser/src/gameobjects/Graphics.js"></script>
<script src="/phaser/src/gameobjects/RenderTexture.js"></script>
<script src="/phaser/src/gameobjects/SpriteBatch.js"></script>
<script src="/phaser/src/gameobjects/BitmapFont.js"></script>
<script src="/phaser/src/system/Canvas.js"></script>
<script src="/phaser/src/system/Device.js"></script>
<script src="/phaser/src/system/RequestAnimationFrame.js"></script>
<script src="/phaser/src/math/Math.js"></script>
<script src="/phaser/src/math/RandomDataGenerator.js"></script>
<script src="/phaser/src/net/Net.js"></script>
<script src="/phaser/src/tween/TweenManager.js"></script>
<script src="/phaser/src/tween/Tween.js"></script>
<script src="/phaser/src/tween/Easing.js"></script>
<script src="/phaser/src/time/Time.js"></script>
<script src="/phaser/src/time/Timer.js"></script>
<script src="/phaser/src/time/TimerEvent.js"></script>
<script src="/phaser/src/animation/AnimationManager.js"></script>
<script src="/phaser/src/animation/Animation.js"></script>
<script src="/phaser/src/animation/Frame.js"></script>
<script src="/phaser/src/animation/FrameData.js"></script>
<script src="/phaser/src/animation/AnimationParser.js"></script>
<script src="/phaser/src/loader/Cache.js"></script>
<script src="/phaser/src/loader/Loader.js"></script>
<script src="/phaser/src/loader/LoaderParser.js"></script>
<script src="/phaser/src/sound/Sound.js"></script>
<script src="/phaser/src/sound/SoundManager.js"></script>
<script src="/phaser/src/utils/Debug.js"></script>
<script src="/phaser/src/utils/Color.js"></script>
<script src="/phaser/src/physics/World.js"></script>
<script src="/phaser/src/physics/PointProxy.js"></script>
<script src="/phaser/src/physics/InversePointProxy.js"></script>
<script src="/phaser/src/physics/Body.js"></script>
<script src="/phaser/src/physics/Spring.js"></script>
<script src="/phaser/src/physics/Material.js"></script>
<script src="/phaser/src/physics/ContactMaterial.js"></script>
<script src="/phaser/src/physics/CollisionGroup.js"></script>
<script src="/phaser/src/particles/Particles.js"></script>
<script src="/phaser/src/particles/arcade/ArcadeParticles.js"></script>
<script src="/phaser/src/particles/arcade/Emitter.js"></script>
<script src="/phaser/src/tilemap/Tile.js"></script>
<script src="/phaser/src/tilemap/Tilemap.js"></script>
<script src="/phaser/src/tilemap/TilemapLayer.js"></script>
<script src="/phaser/src/tilemap/TilemapParser.js"></script>
<script src="/phaser/src/tilemap/Tileset.js"></script>
<script src="/phaser/examples/wip/bmd.js" type="text/javascript"></script>
</head>
<body>
<div id="phaser-example"></div>
</body>
</html>
+1 -1
View File
@@ -64,7 +64,7 @@
$value2 = substr($value, 0, -3);
$file = urlencode($value);
$output .= "<tr><td><a href=\"wip/index.php?f=$file\">$value2</a></td><td><a href=\"wip/index-fs.php?f=$file\">(full screen)</a></td><td><a href=\"wip/cocoon.php?f=$file\">(cocoon)</a></td></tr>";
$output .= "<tr><td><a href=\"wip/index.php?f=$file\">$value2</a></td><td><a href=\"wip/index-fs.php?f=$file\">(full screen)</a></td><td><a href=\"wip/index-cocoon.php?f=$file\">(cocoon)</a></td></tr>";
}
return $output;