Skip to content

Commit 34ee2b0

Browse files
committed
Fixed issue with CocoonJS detection in Device.
Fixed docs issue in Tilemap. Created landscape pointer test, confirmed working fine (issue phaserjs#276)
1 parent 43cd5e4 commit 34ee2b0

11 files changed

Lines changed: 218 additions & 107 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ Beyond version 2.2
362362
* Look at HiDPI Canvas settings.
363363
* Multiple Camera support.
364364
* DragonBones support.
365+
* Cache to localStorage using If-Modified-Since. [See github request](https://github.com/photonstorm/phaser/issues/495)
365366

366367

367368
Nadion

examples/wip/bmd.js

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

2-
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
2+
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update, render: render });
33

44
function preload() {
55

6-
game.load.image('pic', 'assets/pics/backscroll.png');
6+
game.load.image('pic', '../assets/pics/questar.png');
77

88
}
99

@@ -12,33 +12,26 @@ var bmd;
1212

1313
function create() {
1414

15-
bmd = game.add.bitmapData(800, 600);
16-
bmd.fillStyle('rgba(255,0,0,0.2)');
17-
// bmd.fillRect(0, 0, 300, 100);
18-
// bmd.fillRect(0, 200, 300, 100);
15+
game.add.image(0, 0, 'pic');
1916

20-
image = game.add.image(0, 0, bmd);
21-
// image.anchor.set(0.5);
17+
console.log('pic?');
2218

23-
game.input.onDown.add(tint, this);
19+
// bmd = game.add.bitmapData(800, 600);
20+
// bmd.context.fillStyle = 'rgba(255,0,0,0.2)';
21+
// bmd.context.fillRect(0, 0, 300, 100);
2422

25-
}
26-
27-
function tint() {
28-
29-
image.tint = Math.random() * 0xFFFFFF;
23+
// image = game.add.image(0, 0, bmd);
3024

3125
}
3226

3327
function update() {
3428

35-
bmd.fillStyle('rgba(255,0,0,0.2)');
36-
bmd.fillRect(game.input.x, game.input.y, 6, 6);
29+
// bmd.context.fillRect(game.input.x, game.input.y, 8, 8);
3730

3831
}
3932

4033
function render() {
4134

42-
game.debug.renderText(game.input.x, 32, 32);
35+
// game.debug.renderText(game.input.x, 32, 32);
4336

4437
}

examples/wip/cocoon.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8" />
5+
<title>phaser</title>
6+
<script src="../../dist/phaser.js" type="text/javascript"></script>
7+
<script src="bmd.js" type="text/javascript"></script>
8+
</head>
9+
<body>
10+
11+
</body>
12+
</html>

examples/wip/cocoon.php

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?php
2+
// Global
3+
$files = dirToArray(dirname(__FILE__));
4+
$total = 0;
5+
6+
foreach ($files as $key => $value)
7+
{
8+
if (is_array($value) && count($value) > 0)
9+
{
10+
$total += count($value);
11+
}
12+
}
13+
14+
function getFile() {
15+
16+
global $files, $dir, $filename, $title, $code;
17+
18+
if (isset($_GET['d']) && isset($_GET['f']))
19+
{
20+
$dir = urldecode($_GET['d']);
21+
$filename = urldecode($_GET['d']) . '/' . urldecode($_GET['f']);
22+
$title = urldecode($_GET['t']);
23+
24+
if (file_exists($filename))
25+
{
26+
$code = file_get_contents($filename);
27+
$files = dirToArray($dir);
28+
}
29+
}
30+
31+
}
32+
33+
function dirToArray($dir) {
34+
35+
$ignore = array('.', '..', '_site', 'assets', 'gfx', 'states', 'book', 'filters', 'misc');
36+
$result = array();
37+
$root = scandir($dir);
38+
$dirs = array_diff($root, $ignore);
39+
40+
foreach ($dirs as $key => $value)
41+
{
42+
if (is_dir($dir . DIRECTORY_SEPARATOR . $value))
43+
{
44+
$result[$value] = dirToArray($dir . DIRECTORY_SEPARATOR . $value);
45+
}
46+
else
47+
{
48+
if (substr($value, -3) == '.js')
49+
{
50+
$result[] = $value;
51+
}
52+
}
53+
}
54+
55+
return $result;
56+
}
57+
58+
function printJSLinks($dir, $files) {
59+
60+
$output = "";
61+
62+
foreach ($files as $key => $value)
63+
{
64+
$value2 = substr($value, 0, -3);
65+
$file = urlencode($value);
66+
67+
$output .= "<a href=\"wip/index.php?f=$file\">$value2</a><br />";
68+
}
69+
70+
return $output;
71+
72+
}
73+
?>
74+
<!doctype html>
75+
<html>
76+
<head>
77+
<meta charset="UTF-8" />
78+
<title>phaser</title>
79+
<?php
80+
if (isset($_GET['f']))
81+
{
82+
$f = $_GET['f'];
83+
?>
84+
<script src="../../dist/phaser.js" type="text/javascript"></script>
85+
<script src="<?php echo $f?>" type="text/javascript"></script>
86+
<?php
87+
}
88+
?>
89+
</head>
90+
<body>
91+
92+
<div id="phaser-example"></div>
93+
94+
</body>
95+
</html>

examples/wip/index-fs.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="initial-scale=1 maximum-scale=1 user-scalable=0 minimal-ui" />
6+
<title>phaser</title>
7+
<base href="../" />
8+
<?php
9+
require('../../build/config.php');
10+
11+
if (isset($_GET['f']))
12+
{
13+
$f = $_GET['f'];
14+
?>
15+
<script src="wip/<?php echo $f?>" type="text/javascript"></script>
16+
<?php
17+
}
18+
?>
19+
<style>
20+
body {
21+
margin: 0;
22+
padding: 0;
23+
}
24+
</style>
25+
</head>
26+
<body>
27+
28+
<div id="phaser-example"></div>
29+
30+
</body>
31+
</html>

examples/wip/index.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function printJSLinks($dir, $files) {
6464
$value2 = substr($value, 0, -3);
6565
$file = urlencode($value);
6666

67-
$output .= "<a href=\"wip/index.php?f=$file\">$value2</a><br />";
67+
$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>";
6868
}
6969

7070
return $output;
@@ -110,9 +110,11 @@ function printJSLinks($dir, $files) {
110110

111111
<h2>work in progress examples</h2>
112112

113+
<table>
113114
<?php
114115
echo printJSLinks('wip', $files);
115116
?>
117+
</table>
116118

117119
</div>
118120

examples/wip/index2.php

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,3 @@
1-
<?php
2-
// Global
3-
$files = dirToArray(dirname(__FILE__));
4-
$total = 0;
5-
6-
foreach ($files as $key => $value)
7-
{
8-
if (is_array($value) && count($value) > 0)
9-
{
10-
$total += count($value);
11-
}
12-
}
13-
14-
function getFile() {
15-
16-
global $files, $dir, $filename, $title, $code;
17-
18-
if (isset($_GET['d']) && isset($_GET['f']))
19-
{
20-
$dir = urldecode($_GET['d']);
21-
$filename = urldecode($_GET['d']) . '/' . urldecode($_GET['f']);
22-
$title = urldecode($_GET['t']);
23-
24-
if (file_exists($filename))
25-
{
26-
$code = file_get_contents($filename);
27-
$files = dirToArray($dir);
28-
}
29-
}
30-
31-
}
32-
33-
function dirToArray($dir) {
34-
35-
$ignore = array('.', '..', '_site', 'assets', 'gfx', 'states', 'book', 'filters', 'misc');
36-
$result = array();
37-
$root = scandir($dir);
38-
$dirs = array_diff($root, $ignore);
39-
40-
foreach ($dirs as $key => $value)
41-
{
42-
if (is_dir($dir . DIRECTORY_SEPARATOR . $value))
43-
{
44-
$result[$value] = dirToArray($dir . DIRECTORY_SEPARATOR . $value);
45-
}
46-
else
47-
{
48-
if (substr($value, -3) == '.js')
49-
{
50-
$result[] = $value;
51-
}
52-
}
53-
}
54-
55-
return $result;
56-
}
57-
58-
function printJSLinks($dir, $files) {
59-
60-
$output = "";
61-
62-
foreach ($files as $key => $value)
63-
{
64-
$value2 = substr($value, 0, -3);
65-
$file = urlencode($value);
66-
67-
$output .= "<a href=\"wip/index.php?f=$file\">$value2</a><br />";
68-
}
69-
70-
return $output;
71-
72-
}
73-
?>
741
<!doctype html>
752
<html>
763
<head>
@@ -93,27 +20,12 @@ function printJSLinks($dir, $files) {
9320
body {
9421
margin: 0;
9522
padding: 0;
96-
font-family: Arial;
97-
font-size: 14px;
9823
}
9924
</style>
10025
</head>
10126
<body>
10227

10328
<div id="phaser-example"></div>
10429

105-
<input type="button" id="step" value="step" />
106-
<input type="button" id="start" value="start" style="margin-left: 32px" />
107-
108-
<div style="padding: 32px">
109-
110-
<h2>work in progress examples</h2>
111-
112-
<?php
113-
echo printJSLinks('wip', $files);
114-
?>
115-
116-
</div>
117-
11830
</body>
11931
</html>

examples/wip/landscape-pointer.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
2+
var game = new Phaser.Game(1024, 672, Phaser.CANVAS, 'phaser-example', { init: init, preload: preload, create: create, update: update, render: render });
3+
4+
function init() {
5+
6+
game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
7+
game.scale.minWidth = 480;
8+
game.scale.minHeight = 260;
9+
game.scale.maxWidth = 1024;
10+
game.scale.maxHeight = 768;
11+
game.scale.forceOrientation(true, false);
12+
game.scale.enterIncorrectOrientation.add(enterIncorrectOrientation, game);
13+
game.scale.leaveIncorrectOrientation.add(leaveIncorrectOrientation, game);
14+
game.scale.setScreenSize(true);
15+
16+
game.stage.backgroundColor = 0x004400;
17+
18+
}
19+
20+
function preload() {
21+
22+
game.load.spritesheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18);
23+
24+
}
25+
26+
var mummy;
27+
var anim;
28+
29+
function create() {
30+
31+
mummy = game.add.sprite(300, 200, 'mummy', 5);
32+
33+
anim = mummy.animations.add('walk');
34+
35+
anim.play(20, true);
36+
37+
}
38+
39+
function enterIncorrectOrientation () {
40+
41+
game.stage.backgroundColor = 0xff0000;
42+
43+
}
44+
45+
function leaveIncorrectOrientation () {
46+
47+
game.stage.backgroundColor = 0x000033;
48+
49+
}
50+
51+
function update() {
52+
53+
}
54+
55+
function render() {
56+
57+
game.debug.renderPointer(game.input.activePointer);
58+
59+
}

0 commit comments

Comments
 (0)