mirror of
https://github.com/photonstorm/phaser
synced 2025-02-17 06:28:30 +00:00
Implemented my own LinkedList class to make the new Input Handler easier to work with. And also just generally useful to have too.
This commit is contained in:
parent
fe6664eac7
commit
78598ae54a
9 changed files with 360 additions and 587 deletions
|
@ -523,40 +523,7 @@
|
|||
"file": "src/core/Group.js",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 17183,
|
||||
"line_ending": "Windows",
|
||||
"name": "Phaser.Group = function () {"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "examples/anchor1.php",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 721,
|
||||
"line_ending": "Windows"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "src/gameobjects/GameObjectFactory.js",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 2737,
|
||||
"line_ending": "Windows"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "src/physics/arcade/Body.js",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 5298,
|
||||
"line_ending": "Windows"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "src/gameobjects/Sprite.js",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 12810,
|
||||
"buffer_size": 17255,
|
||||
"line_ending": "Windows"
|
||||
}
|
||||
}
|
||||
|
@ -589,19 +556,27 @@
|
|||
},
|
||||
"file_history":
|
||||
[
|
||||
"/D/wamp/www/phaser/src/utils/Debug.js",
|
||||
"/D/wamp/www/phaser/src/tween/Tween.js",
|
||||
"/D/wamp/www/phaser/src/core/World.js",
|
||||
"/D/wamp/www/phaser/src/physics/arcade/Body.js",
|
||||
"/D/wamp/www/phaser/src/gameobjects/Sprite.js",
|
||||
"/D/wamp/www/phaser/src/physics/arcade/Body.js",
|
||||
"/D/wamp/www/phaser/src/core/World.js",
|
||||
"/D/wamp/www/phaser/src/core/Game.js",
|
||||
"/D/wamp/www/phaser/examples/quadtree2.php",
|
||||
"/D/wamp/www/phaser/examples/body3.php",
|
||||
"/D/wamp/www/phaser/examples/body2.php",
|
||||
"/D/wamp/www/phaser/src/math/QuadTree.js",
|
||||
"/D/wamp/www/phaser/examples/invaders.php",
|
||||
"/D/wamp/www/phaser/examples/anchor1.php",
|
||||
"/D/wamp/www/phaser/src/physics/arcade/ArcadePhysics.js",
|
||||
"/D/wamp/www/phaser/src/geom/Rectangle.js",
|
||||
"/D/wamp/www/phaser/src/utils/Debug.js",
|
||||
"/D/wamp/www/phaser/src/gameobjects/GameObjectFactory.js",
|
||||
"/D/wamp/www/phaser/src/core/Group.js",
|
||||
"/D/wamp/www/phaser/src/tween/Tween.js",
|
||||
"/D/wamp/www/phaser/TS Source/core/Group.ts",
|
||||
"/D/wamp/www/phaser/TS Source/core/Group.js",
|
||||
"/D/wamp/www/phaser/src/pixi/display/DisplayObjectContainer.js",
|
||||
"/D/wamp/www/phaser/src/core/Game.js",
|
||||
"/D/wamp/www/phaser/src/gameobjects/GameObjectFactory.js",
|
||||
"/D/wamp/www/phaser/examples/consoleBanner3.php",
|
||||
"/D/wamp/www/consoledemo/index.html",
|
||||
"/D/wamp/www/phaser/src/physics/arcade/ArcadePhysics.js",
|
||||
"/D/wamp/www/phaser/src/core/Stage.js",
|
||||
"/D/wamp/www/phaser/examples/js.php",
|
||||
"/D/wamp/www/phaser/src/system/Canvas.js",
|
||||
|
@ -621,9 +596,7 @@
|
|||
"/D/wamp/www/phaser/TS Source/input/InputHandler.js",
|
||||
"/D/wamp/www/phaser/src/input/Input.js",
|
||||
"/D/wamp/www/phaser/src/input/Pointer.js",
|
||||
"/D/wamp/www/phaser/src/math/QuadTree.js",
|
||||
"/D/wamp/www/phaser/examples/motion1.php",
|
||||
"/D/wamp/www/phaser/src/geom/Rectangle.js",
|
||||
"/D/wamp/www/phaser/todo/phaser clean up/Collision.js",
|
||||
"/D/wamp/www/phaser/todo/physics/Collision.js",
|
||||
"/D/wamp/www/phaser/src/time/Time.js",
|
||||
|
@ -710,13 +683,7 @@
|
|||
"/D/wamp/www/phaser/TS Source/math/Vec2Utils.js",
|
||||
"/D/wamp/www/phaser/TS Source/input/InputManager.js",
|
||||
"/D/wamp/www/phaser/TS Source/input/Keyboard.ts",
|
||||
"/D/wamp/www/phaser/TS Source/input/Keyboard.js",
|
||||
"/D/wamp/www/phaser/src/pixi/primitives/Graphics.js",
|
||||
"/D/wamp/www/pixi.js/examples/example 11 - RenderTexture/index.html",
|
||||
"/D/wamp/www/phaser/src/pixi/textures/RenderTexture.js",
|
||||
"/D/wamp/www/phaser/examples/assets/fonts/desyrel.json",
|
||||
"/D/wamp/www/phaser/src/math/RandomDataGenerator.js",
|
||||
"/D/wamp/www/phaser/src/system/Device.js"
|
||||
"/D/wamp/www/phaser/TS Source/input/Keyboard.js"
|
||||
],
|
||||
"find":
|
||||
{
|
||||
|
@ -754,6 +721,10 @@
|
|||
"case_sensitive": true,
|
||||
"find_history":
|
||||
[
|
||||
"bounds",
|
||||
"body.bounds",
|
||||
"right",
|
||||
"x",
|
||||
"_iPrev",
|
||||
"first",
|
||||
"child1",
|
||||
|
@ -877,11 +848,7 @@
|
|||
"4",
|
||||
"256",
|
||||
"Phaser.Sprite",
|
||||
"\n});\n",
|
||||
"Phaser.Sprite",
|
||||
"tilingSprite",
|
||||
"()",
|
||||
"this."
|
||||
"\n});\n"
|
||||
],
|
||||
"highlight": true,
|
||||
"in_selection": false,
|
||||
|
@ -889,6 +856,7 @@
|
|||
"regex": false,
|
||||
"replace_history":
|
||||
[
|
||||
"body",
|
||||
"_stage",
|
||||
")',",
|
||||
"'),",
|
||||
|
@ -983,7 +951,7 @@
|
|||
"groups":
|
||||
[
|
||||
{
|
||||
"selected": 3,
|
||||
"selected": 0,
|
||||
"sheets":
|
||||
[
|
||||
{
|
||||
|
@ -991,20 +959,19 @@
|
|||
"file": "src/core/Group.js",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 17183,
|
||||
"buffer_size": 17255,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
310,
|
||||
310
|
||||
4441,
|
||||
4441
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"auto_name": "Phaser.Group = function () {",
|
||||
"codeintel": true,
|
||||
"codeintel_config":
|
||||
{
|
||||
|
@ -1112,528 +1079,7 @@
|
|||
"translate_tabs_to_spaces": false
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 0.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 1,
|
||||
"file": "examples/anchor1.php",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 721,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
674,
|
||||
670
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"codeintel": true,
|
||||
"codeintel_config":
|
||||
{
|
||||
"JavaScript":
|
||||
{
|
||||
"codeintel_max_recursive_dir_depth": 2,
|
||||
"codeintel_scan_files_in_project": false,
|
||||
"javascriptExtraPaths":
|
||||
[
|
||||
]
|
||||
},
|
||||
"PHP":
|
||||
{
|
||||
"codeintel_max_recursive_dir_depth": 5,
|
||||
"codeintel_scan_files_in_project": false,
|
||||
"phpExtraPaths":
|
||||
[
|
||||
]
|
||||
},
|
||||
"Python":
|
||||
{
|
||||
"env":
|
||||
{
|
||||
}
|
||||
}
|
||||
},
|
||||
"codeintel_enabled_languages":
|
||||
[
|
||||
"JavaScript",
|
||||
"Mason",
|
||||
"XBL",
|
||||
"XUL",
|
||||
"RHTML",
|
||||
"SCSS",
|
||||
"Python",
|
||||
"HTML",
|
||||
"Ruby",
|
||||
"Python3",
|
||||
"XML",
|
||||
"Sass",
|
||||
"XSLT",
|
||||
"Django",
|
||||
"HTML5",
|
||||
"Perl",
|
||||
"CSS",
|
||||
"Twig",
|
||||
"Less",
|
||||
"Smarty",
|
||||
"Node.js",
|
||||
"Tcl",
|
||||
"TemplateToolkit",
|
||||
"PHP"
|
||||
],
|
||||
"codeintel_live": true,
|
||||
"codeintel_live_enabled_languages":
|
||||
[
|
||||
"JavaScript",
|
||||
"Mason",
|
||||
"XBL",
|
||||
"XUL",
|
||||
"RHTML",
|
||||
"SCSS",
|
||||
"Python",
|
||||
"HTML",
|
||||
"Ruby",
|
||||
"Python3",
|
||||
"XML",
|
||||
"Sass",
|
||||
"XSLT",
|
||||
"Django",
|
||||
"HTML5",
|
||||
"Perl",
|
||||
"CSS",
|
||||
"Twig",
|
||||
"Less",
|
||||
"Smarty",
|
||||
"Node.js",
|
||||
"Tcl",
|
||||
"TemplateToolkit",
|
||||
"PHP"
|
||||
],
|
||||
"codeintel_max_recursive_dir_depth": 10,
|
||||
"codeintel_scan_exclude_dir":
|
||||
{
|
||||
"JavaScript":
|
||||
[
|
||||
"/build/",
|
||||
"/min/"
|
||||
]
|
||||
},
|
||||
"codeintel_scan_files_in_project": true,
|
||||
"codeintel_selected_catalogs":
|
||||
[
|
||||
"PyWin32",
|
||||
"jQuery",
|
||||
"Rails"
|
||||
],
|
||||
"codeintel_snippets": true,
|
||||
"codeintel_syntax_map":
|
||||
{
|
||||
"Python Django": "Python"
|
||||
},
|
||||
"sublime_auto_complete": true,
|
||||
"syntax": "Packages/PHP/PHP.tmLanguage",
|
||||
"translate_tabs_to_spaces": false
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 0.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 2,
|
||||
"file": "src/gameobjects/GameObjectFactory.js",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 2737,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
2254,
|
||||
2254
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"codeintel": true,
|
||||
"codeintel_config":
|
||||
{
|
||||
"JavaScript":
|
||||
{
|
||||
"codeintel_max_recursive_dir_depth": 2,
|
||||
"codeintel_scan_files_in_project": false,
|
||||
"javascriptExtraPaths":
|
||||
[
|
||||
]
|
||||
},
|
||||
"PHP":
|
||||
{
|
||||
"codeintel_max_recursive_dir_depth": 5,
|
||||
"codeintel_scan_files_in_project": false,
|
||||
"phpExtraPaths":
|
||||
[
|
||||
]
|
||||
},
|
||||
"Python":
|
||||
{
|
||||
"env":
|
||||
{
|
||||
}
|
||||
}
|
||||
},
|
||||
"codeintel_enabled_languages":
|
||||
[
|
||||
"JavaScript",
|
||||
"Mason",
|
||||
"XBL",
|
||||
"XUL",
|
||||
"RHTML",
|
||||
"SCSS",
|
||||
"Python",
|
||||
"HTML",
|
||||
"Ruby",
|
||||
"Python3",
|
||||
"XML",
|
||||
"Sass",
|
||||
"XSLT",
|
||||
"Django",
|
||||
"HTML5",
|
||||
"Perl",
|
||||
"CSS",
|
||||
"Twig",
|
||||
"Less",
|
||||
"Smarty",
|
||||
"Node.js",
|
||||
"Tcl",
|
||||
"TemplateToolkit",
|
||||
"PHP"
|
||||
],
|
||||
"codeintel_live": true,
|
||||
"codeintel_live_enabled_languages":
|
||||
[
|
||||
"JavaScript",
|
||||
"Mason",
|
||||
"XBL",
|
||||
"XUL",
|
||||
"RHTML",
|
||||
"SCSS",
|
||||
"Python",
|
||||
"HTML",
|
||||
"Ruby",
|
||||
"Python3",
|
||||
"XML",
|
||||
"Sass",
|
||||
"XSLT",
|
||||
"Django",
|
||||
"HTML5",
|
||||
"Perl",
|
||||
"CSS",
|
||||
"Twig",
|
||||
"Less",
|
||||
"Smarty",
|
||||
"Node.js",
|
||||
"Tcl",
|
||||
"TemplateToolkit",
|
||||
"PHP"
|
||||
],
|
||||
"codeintel_max_recursive_dir_depth": 10,
|
||||
"codeintel_scan_exclude_dir":
|
||||
{
|
||||
"JavaScript":
|
||||
[
|
||||
"/build/",
|
||||
"/min/"
|
||||
]
|
||||
},
|
||||
"codeintel_scan_files_in_project": true,
|
||||
"codeintel_selected_catalogs":
|
||||
[
|
||||
"PyWin32",
|
||||
"jQuery",
|
||||
"Rails"
|
||||
],
|
||||
"codeintel_snippets": true,
|
||||
"codeintel_syntax_map":
|
||||
{
|
||||
"Python Django": "Python"
|
||||
},
|
||||
"sublime_auto_complete": true,
|
||||
"syntax": "Packages/JavaScript/JavaScript.tmLanguage",
|
||||
"tab_size": 4,
|
||||
"translate_tabs_to_spaces": true
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 668.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 3,
|
||||
"file": "src/physics/arcade/Body.js",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 5298,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
3665,
|
||||
3665
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"codeintel": true,
|
||||
"codeintel_config":
|
||||
{
|
||||
"JavaScript":
|
||||
{
|
||||
"codeintel_max_recursive_dir_depth": 2,
|
||||
"codeintel_scan_files_in_project": false,
|
||||
"javascriptExtraPaths":
|
||||
[
|
||||
]
|
||||
},
|
||||
"PHP":
|
||||
{
|
||||
"codeintel_max_recursive_dir_depth": 5,
|
||||
"codeintel_scan_files_in_project": false,
|
||||
"phpExtraPaths":
|
||||
[
|
||||
]
|
||||
},
|
||||
"Python":
|
||||
{
|
||||
"env":
|
||||
{
|
||||
}
|
||||
}
|
||||
},
|
||||
"codeintel_enabled_languages":
|
||||
[
|
||||
"JavaScript",
|
||||
"Mason",
|
||||
"XBL",
|
||||
"XUL",
|
||||
"RHTML",
|
||||
"SCSS",
|
||||
"Python",
|
||||
"HTML",
|
||||
"Ruby",
|
||||
"Python3",
|
||||
"XML",
|
||||
"Sass",
|
||||
"XSLT",
|
||||
"Django",
|
||||
"HTML5",
|
||||
"Perl",
|
||||
"CSS",
|
||||
"Twig",
|
||||
"Less",
|
||||
"Smarty",
|
||||
"Node.js",
|
||||
"Tcl",
|
||||
"TemplateToolkit",
|
||||
"PHP"
|
||||
],
|
||||
"codeintel_live": true,
|
||||
"codeintel_live_enabled_languages":
|
||||
[
|
||||
"JavaScript",
|
||||
"Mason",
|
||||
"XBL",
|
||||
"XUL",
|
||||
"RHTML",
|
||||
"SCSS",
|
||||
"Python",
|
||||
"HTML",
|
||||
"Ruby",
|
||||
"Python3",
|
||||
"XML",
|
||||
"Sass",
|
||||
"XSLT",
|
||||
"Django",
|
||||
"HTML5",
|
||||
"Perl",
|
||||
"CSS",
|
||||
"Twig",
|
||||
"Less",
|
||||
"Smarty",
|
||||
"Node.js",
|
||||
"Tcl",
|
||||
"TemplateToolkit",
|
||||
"PHP"
|
||||
],
|
||||
"codeintel_max_recursive_dir_depth": 10,
|
||||
"codeintel_scan_exclude_dir":
|
||||
{
|
||||
"JavaScript":
|
||||
[
|
||||
"/build/",
|
||||
"/min/"
|
||||
]
|
||||
},
|
||||
"codeintel_scan_files_in_project": true,
|
||||
"codeintel_selected_catalogs":
|
||||
[
|
||||
"PyWin32",
|
||||
"jQuery",
|
||||
"Rails"
|
||||
],
|
||||
"codeintel_snippets": true,
|
||||
"codeintel_syntax_map":
|
||||
{
|
||||
"Python Django": "Python"
|
||||
},
|
||||
"sublime_auto_complete": true,
|
||||
"syntax": "Packages/JavaScript/JavaScript.tmLanguage"
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 1602.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 4,
|
||||
"file": "src/gameobjects/Sprite.js",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 12810,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
9001,
|
||||
9001
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"codeintel": true,
|
||||
"codeintel_config":
|
||||
{
|
||||
"JavaScript":
|
||||
{
|
||||
"codeintel_max_recursive_dir_depth": 2,
|
||||
"codeintel_scan_files_in_project": false,
|
||||
"javascriptExtraPaths":
|
||||
[
|
||||
]
|
||||
},
|
||||
"PHP":
|
||||
{
|
||||
"codeintel_max_recursive_dir_depth": 5,
|
||||
"codeintel_scan_files_in_project": false,
|
||||
"phpExtraPaths":
|
||||
[
|
||||
]
|
||||
},
|
||||
"Python":
|
||||
{
|
||||
"env":
|
||||
{
|
||||
}
|
||||
}
|
||||
},
|
||||
"codeintel_enabled_languages":
|
||||
[
|
||||
"JavaScript",
|
||||
"Mason",
|
||||
"XBL",
|
||||
"XUL",
|
||||
"RHTML",
|
||||
"SCSS",
|
||||
"Python",
|
||||
"HTML",
|
||||
"Ruby",
|
||||
"Python3",
|
||||
"XML",
|
||||
"Sass",
|
||||
"XSLT",
|
||||
"Django",
|
||||
"HTML5",
|
||||
"Perl",
|
||||
"CSS",
|
||||
"Twig",
|
||||
"Less",
|
||||
"Smarty",
|
||||
"Node.js",
|
||||
"Tcl",
|
||||
"TemplateToolkit",
|
||||
"PHP"
|
||||
],
|
||||
"codeintel_live": true,
|
||||
"codeintel_live_enabled_languages":
|
||||
[
|
||||
"JavaScript",
|
||||
"Mason",
|
||||
"XBL",
|
||||
"XUL",
|
||||
"RHTML",
|
||||
"SCSS",
|
||||
"Python",
|
||||
"HTML",
|
||||
"Ruby",
|
||||
"Python3",
|
||||
"XML",
|
||||
"Sass",
|
||||
"XSLT",
|
||||
"Django",
|
||||
"HTML5",
|
||||
"Perl",
|
||||
"CSS",
|
||||
"Twig",
|
||||
"Less",
|
||||
"Smarty",
|
||||
"Node.js",
|
||||
"Tcl",
|
||||
"TemplateToolkit",
|
||||
"PHP"
|
||||
],
|
||||
"codeintel_max_recursive_dir_depth": 10,
|
||||
"codeintel_scan_exclude_dir":
|
||||
{
|
||||
"JavaScript":
|
||||
[
|
||||
"/build/",
|
||||
"/min/"
|
||||
]
|
||||
},
|
||||
"codeintel_scan_files_in_project": true,
|
||||
"codeintel_selected_catalogs":
|
||||
[
|
||||
"PyWin32",
|
||||
"jQuery",
|
||||
"Rails"
|
||||
],
|
||||
"codeintel_snippets": true,
|
||||
"codeintel_syntax_map":
|
||||
{
|
||||
"Python Django": "Python"
|
||||
},
|
||||
"sublime_auto_complete": true,
|
||||
"syntax": "Packages/JavaScript/JavaScript.tmLanguage",
|
||||
"tab_size": 4,
|
||||
"translate_tabs_to_spaces": true
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 4132.0,
|
||||
"translation.y": 3550.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"type": "text"
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
<script src="../src/core/Camera.js"></script>
|
||||
<script src="../src/core/State.js"></script>
|
||||
<script src="../src/core/StateManager.js"></script>
|
||||
<script src="../src/core/LinkedList.js"></script>
|
||||
<script src="../src/core/Signal.js"></script>
|
||||
<script src="../src/core/SignalBinding.js"></script>
|
||||
<script src="../src/core/Plugin.js"></script>
|
||||
|
@ -59,6 +60,7 @@
|
|||
<script src="../src/input/MSPointer.js"></script>
|
||||
<script src="../src/input/Pointer.js"></script>
|
||||
<script src="../src/input/Touch.js"></script>
|
||||
<script src="../src/input/InputHandler.js"></script>
|
||||
<script src="../src/system/Canvas.js"></script>
|
||||
<script src="../src/gameobjects/GameObjectFactory.js"></script>
|
||||
<script src="../src/gameobjects/Sprite.js"></script>
|
||||
|
|
74
examples/linkedlist1.php
Normal file
74
examples/linkedlist1.php
Normal file
|
@ -0,0 +1,74 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>phaser.js - a new beginning</title>
|
||||
<?php
|
||||
require('js.php');
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
(function () {
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
game.load.image('alien', 'assets/sprites/space-baddie.png');
|
||||
game.load.image('ship', 'assets/sprites/shmup-ship.png');
|
||||
}
|
||||
|
||||
var a;
|
||||
var b;
|
||||
var c;
|
||||
var d;
|
||||
var e;
|
||||
var f;
|
||||
|
||||
var list;
|
||||
|
||||
function create() {
|
||||
|
||||
a = game.add.sprite(game.world.randomX, game.world.randomY, 'ship');
|
||||
a.name = 's1';
|
||||
b = game.add.sprite(game.world.randomX, game.world.randomY, 'ship');
|
||||
b.name = 's2';
|
||||
c = game.add.sprite(game.world.randomX, game.world.randomY, 'ship');
|
||||
c.name = 's3';
|
||||
d = game.add.sprite(game.world.randomX, game.world.randomY, 'alien');
|
||||
d.name = 'a1';
|
||||
e = game.add.sprite(game.world.randomX, game.world.randomY, 'alien');
|
||||
e.name = 'a2';
|
||||
f = game.add.sprite(game.world.randomX, game.world.randomY, 'alien');
|
||||
f.name = 'a3';
|
||||
|
||||
list = new Phaser.LinkedList();
|
||||
|
||||
list.add(a.input);
|
||||
list.add(b.input);
|
||||
list.add(c.input);
|
||||
list.add(d.input);
|
||||
list.add(e.input);
|
||||
list.add(f.input);
|
||||
|
||||
list.dump();
|
||||
|
||||
list.remove(d.input);
|
||||
|
||||
list.dump();
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
}
|
||||
|
||||
function render() {
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -205,6 +205,9 @@ Phaser.Group.prototype = {
|
|||
* @param {string} index The <code>string</code> name of the member variable you want to sort on. Default value is "z".
|
||||
* @param {number} order A <code>Group</code> constant that defines the sort order. Possible values are <code>Group.ASCENDING</code> and <code>Group.DESCENDING</code>. Default value is <code>Group.ASCENDING</code>.
|
||||
*/
|
||||
|
||||
// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.c
|
||||
|
||||
sort: function (index, order) {
|
||||
// if (typeof index === "undefined") { index = 'z'; }
|
||||
// if (typeof order === "undefined") { order = Phaser.Types.SORT_ASCENDING; }
|
||||
|
|
179
src/core/LinkedList.js
Normal file
179
src/core/LinkedList.js
Normal file
|
@ -0,0 +1,179 @@
|
|||
Phaser.LinkedList = function () {
|
||||
};
|
||||
|
||||
Phaser.LinkedList.prototype = {
|
||||
|
||||
_iNext: null,
|
||||
_iPrev: null,
|
||||
first: null,
|
||||
last: null,
|
||||
sprite: { name: 'HD' },
|
||||
|
||||
add: function (child) {
|
||||
|
||||
// If the list is empty
|
||||
if (this.first == null && this.last == null)
|
||||
{
|
||||
this.first = child;
|
||||
this.last = child;
|
||||
this._iNext = child;
|
||||
child._iPrev = this;
|
||||
return;
|
||||
}
|
||||
|
||||
// Get gets appended to the end of the list, regardless of anything, and it won't have any children of its own (non-nested list)
|
||||
this.last._iNext = child;
|
||||
|
||||
child._iPrev = this.last;
|
||||
|
||||
this.last = child;
|
||||
|
||||
},
|
||||
|
||||
remove: function (child) {
|
||||
|
||||
// If the list is empty
|
||||
if (this.first == null && this.last == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// The only node?
|
||||
if (this.first == child && this.last == child)
|
||||
{
|
||||
this.first = null;
|
||||
this.last = null;
|
||||
this._iNext = null;
|
||||
child._iNext = null;
|
||||
child._iPrev = null;
|
||||
return;
|
||||
}
|
||||
|
||||
var childPrev = child._iPrev;
|
||||
|
||||
// Tail node?
|
||||
if (child._iNext)
|
||||
{
|
||||
// Has another node after it?
|
||||
child._iNext._iPrev = child._iPrev;
|
||||
}
|
||||
|
||||
childPrev._iNext = child._iNext;
|
||||
|
||||
},
|
||||
|
||||
dump: function () {
|
||||
|
||||
console.log("\nNode\t\t|\t\tNext\t\t|\t\tPrev\t\t|\t\tFirst\t\t|\t\tLast");
|
||||
console.log("\t\t\t|\t\t\t\t\t|\t\t\t\t\t|\t\t\t\t\t|");
|
||||
|
||||
var nameNext = '-';
|
||||
var namePrev = '-';
|
||||
var nameFirst = '-';
|
||||
var nameLast = '-';
|
||||
|
||||
if (this._iNext)
|
||||
{
|
||||
nameNext = this._iNext.sprite.name;
|
||||
}
|
||||
|
||||
if (this._iPrev)
|
||||
{
|
||||
namePrev = this._iPrev.sprite.name;
|
||||
}
|
||||
|
||||
if (this.first)
|
||||
{
|
||||
nameFirst = this.first.sprite.name;
|
||||
}
|
||||
|
||||
if (this.last)
|
||||
{
|
||||
nameLast = this.last.sprite.name;
|
||||
}
|
||||
|
||||
if (typeof nameNext === 'undefined')
|
||||
{
|
||||
nameNext = '-';
|
||||
}
|
||||
|
||||
if (typeof namePrev === 'undefined')
|
||||
{
|
||||
namePrev = '-';
|
||||
}
|
||||
|
||||
if (typeof nameFirst === 'undefined')
|
||||
{
|
||||
nameFirst = '-';
|
||||
}
|
||||
|
||||
if (typeof nameLast === 'undefined')
|
||||
{
|
||||
nameLast = '-';
|
||||
}
|
||||
|
||||
console.log('HD' + '\t\t\t|\t\t' + nameNext + '\t\t\t|\t\t' + namePrev + '\t\t\t|\t\t' + nameFirst + '\t\t\t|\t\t' + nameLast);
|
||||
|
||||
var entity = this;
|
||||
|
||||
var testObject = entity.last._iNext;
|
||||
entity = entity.first;
|
||||
|
||||
do
|
||||
{
|
||||
var name = entity.sprite.name || '*';
|
||||
var nameNext = '-';
|
||||
var namePrev = '-';
|
||||
var nameFirst = '-';
|
||||
var nameLast = '-';
|
||||
|
||||
if (entity._iNext)
|
||||
{
|
||||
nameNext = entity._iNext.sprite.name;
|
||||
}
|
||||
|
||||
if (entity._iPrev)
|
||||
{
|
||||
namePrev = entity._iPrev.sprite.name;
|
||||
}
|
||||
|
||||
if (entity.first)
|
||||
{
|
||||
nameFirst = entity.first.sprite.name;
|
||||
}
|
||||
|
||||
if (entity.last)
|
||||
{
|
||||
nameLast = entity.last.sprite.name;
|
||||
}
|
||||
|
||||
if (typeof nameNext === 'undefined')
|
||||
{
|
||||
nameNext = '-';
|
||||
}
|
||||
|
||||
if (typeof namePrev === 'undefined')
|
||||
{
|
||||
namePrev = '-';
|
||||
}
|
||||
|
||||
if (typeof nameFirst === 'undefined')
|
||||
{
|
||||
nameFirst = '-';
|
||||
}
|
||||
|
||||
if (typeof nameLast === 'undefined')
|
||||
{
|
||||
nameLast = '-';
|
||||
}
|
||||
|
||||
console.log(name + '\t\t\t|\t\t' + nameNext + '\t\t\t|\t\t' + namePrev + '\t\t\t|\t\t' + nameFirst + '\t\t\t|\t\t' + nameLast);
|
||||
|
||||
entity = entity._iNext;
|
||||
|
||||
}
|
||||
while(entity != testObject)
|
||||
|
||||
}
|
||||
|
||||
};
|
|
@ -10,9 +10,6 @@ Phaser.Sprite = function (game, x, y, key, frame) {
|
|||
// If exists = false then the Sprite isn't updated by the core game loop or physics subsystem at all
|
||||
this.exists = true;
|
||||
|
||||
// An "invisible" sprite isn't rendered at all
|
||||
this.visible = true;
|
||||
|
||||
// This is a handy little var your game can use to determine if a sprite is alive or not, it doesn't effect rendering
|
||||
this.alive = true;
|
||||
|
||||
|
@ -58,6 +55,8 @@ Phaser.Sprite = function (game, x, y, key, frame) {
|
|||
this.currentFrame = this.game.cache.getFrame(key);
|
||||
}
|
||||
|
||||
this.input = new Phaser.InputHandler(this);
|
||||
|
||||
/**
|
||||
* The anchor sets the origin point of the texture.
|
||||
* The default is 0,0 this means the textures origin is the top left
|
||||
|
|
|
@ -253,6 +253,9 @@ Phaser.Input.prototype = {
|
|||
onTap: null,
|
||||
onHold: null,
|
||||
|
||||
// A linked list of interactive objects
|
||||
interactiveItems: new Phaser.LinkedList(),
|
||||
|
||||
/**
|
||||
* Starts the Input Manager running
|
||||
* @method start
|
||||
|
|
69
src/input/InputHandler.js
Normal file
69
src/input/InputHandler.js
Normal file
|
@ -0,0 +1,69 @@
|
|||
Phaser.InputHandler = function (sprite) {
|
||||
|
||||
this.game = sprite.game;
|
||||
this.sprite = sprite;
|
||||
|
||||
this.enabled = false;
|
||||
|
||||
// Linked list references
|
||||
this.last = this;
|
||||
this.first = this;
|
||||
|
||||
/**
|
||||
* The PriorityID controls which Sprite receives an Input event first if they should overlap.
|
||||
*/
|
||||
this.priorityID = 0;
|
||||
|
||||
this.isDragged = false;
|
||||
this.dragPixelPerfect = false;
|
||||
this.allowHorizontalDrag = true;
|
||||
this.allowVerticalDrag = true;
|
||||
this.bringToTop = false;
|
||||
this.snapOnDrag = false;
|
||||
this.snapOnRelease = false;
|
||||
this.snapX = 0;
|
||||
this.snapY = 0;
|
||||
|
||||
/**
|
||||
* Is this sprite allowed to be dragged by the mouse? true = yes, false = no
|
||||
* @default false
|
||||
*/
|
||||
this.draggable = false;
|
||||
|
||||
/**
|
||||
* A region of the game world within which the sprite is restricted during drag
|
||||
* @default null
|
||||
*/
|
||||
this.boundsRect = null;
|
||||
|
||||
/**
|
||||
* An Sprite the bounds of which this sprite is restricted during drag
|
||||
* @default null
|
||||
*/
|
||||
this.boundsSprite = null;
|
||||
|
||||
/**
|
||||
* If this object is set to consume the pointer event then it will stop all propogation from this object on.
|
||||
* For example if you had a stack of 6 sprites with the same priority IDs and one consumed the event, none of the others would receive it.
|
||||
* @type {bool}
|
||||
*/
|
||||
this.consumePointerEvent = false;
|
||||
|
||||
};
|
||||
|
||||
Phaser.InputHandler.prototype = {
|
||||
|
||||
game: null,
|
||||
sprite: null,
|
||||
|
||||
// Linked list references
|
||||
parent: null,
|
||||
_iNext: null,
|
||||
_iPrev: null,
|
||||
first: null,
|
||||
last: null,
|
||||
|
||||
enable: function () {
|
||||
},
|
||||
|
||||
};
|
|
@ -122,7 +122,6 @@ Phaser.Physics.Arcade.Body.prototype = {
|
|||
|
||||
},
|
||||
|
||||
/*
|
||||
postUpdate: function () {
|
||||
|
||||
this.sprite.x = this.x - this.offset.x + (this.sprite.anchor.x * this.width);
|
||||
|
@ -134,7 +133,6 @@ Phaser.Physics.Arcade.Body.prototype = {
|
|||
}
|
||||
|
||||
},
|
||||
*/
|
||||
|
||||
checkWorldBounds: function () {
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue