diff --git a/Phaser.sublime-workspace b/Phaser.sublime-workspace index 837faaa9..2864a0c6 100644 --- a/Phaser.sublime-workspace +++ b/Phaser.sublime-workspace @@ -3,6 +3,34 @@ { "selected_items": [ + [ + "curr", + "currentY" + ], + [ + "line", + "lineHeight" + ], + [ + "_ontouche", + "_onTouchEnter" + ], + [ + "_ontou", + "_onTouchEnd" + ], + [ + "_ont", + "_onTouchMove" + ], + [ + "_onk", + "_onKeyUp" + ], + [ + "world", + "worldView" + ], [ "re", "releaseMummy" @@ -15,10 +43,6 @@ "for", "for for (…) {…}" ], - [ - "curr", - "currentFrame" - ], [ "fra", "frameHeight" @@ -490,30 +514,6 @@ [ "hit", "hitContext" - ], - [ - "ol", - "oldY" - ], - [ - "old", - "oldX" - ], - [ - "rot", - "rotation" - ], - [ - "ro", - "rotation" - ], - [ - "l", - "leaves" - ], - [ - "pi", - "piplin2" ] ] }, @@ -523,15 +523,7 @@ "file": "src/core/Game.js", "settings": { - "buffer_size": 8628, - "line_ending": "Windows" - } - }, - { - "file": "examples/sprite3.php", - "settings": - { - "buffer_size": 1406, + "buffer_size": 9194, "line_ending": "Windows" } }, @@ -539,40 +531,87 @@ "file": "src/gameobjects/Sprite.js", "settings": { - "buffer_size": 3926, - "line_ending": "Windows", - "name": "Phaser.Sprite = function () {" - } - }, - { - "file": "src/core/World.js", - "settings": - { - "buffer_size": 2705, + "buffer_size": 4297, "line_ending": "Windows" } }, { - "file": "src/pixi/textures/RenderTexture.js", + "file": "examples/camera2.php", "settings": { - "buffer_size": 6640, + "buffer_size": 3999, "line_ending": "Windows" } }, { - "file": "/D/wamp/www/pixi.js/examples/example 11 - RenderTexture/index.html", + "file": "src/core/Camera.js", "settings": { - "buffer_size": 2951, + "buffer_size": 6523, "line_ending": "Windows" } }, { - "file": "src/pixi/primitives/Graphics.js", + "file": "src/utils/Debug.js", "settings": { - "buffer_size": 6432, + "buffer_size": 12950, + "line_ending": "Windows" + } + }, + { + "file": "src/pixi/InteractionManager.js", + "settings": + { + "buffer_size": 15862, + "line_ending": "Windows" + } + }, + { + "file": "TS Source/utils/SpriteUtils.js", + "settings": + { + "buffer_size": 14653, + "line_ending": "Windows" + } + }, + { + "file": "TS Source/utils/SpriteUtils.ts", + "settings": + { + "buffer_size": 15421, + "line_ending": "Windows" + } + }, + { + "file": "TS Source/gameobjects/TransformManager.ts", + "settings": + { + "buffer_size": 13922, + "line_ending": "Windows" + } + }, + { + "file": "/D/wamp/www/pixi.js/examples/example 6 - Interactivity/index.html", + "settings": + { + "buffer_size": 3593, + "line_ending": "Windows" + } + }, + { + "file": "src/input/Input.js", + "settings": + { + "buffer_size": 18350, + "line_ending": "Windows" + } + }, + { + "file": "src/geom/Point.js", + "settings": + { + "buffer_size": 10965, "line_ending": "Windows" } } @@ -605,19 +644,49 @@ }, "file_history": [ + "/D/wamp/www/phaser/src/pixi/renderers/canvas/CanvasRenderer.js", + "/D/wamp/www/phaser/src/input/MSPointer.js", + "/D/wamp/www/phaser/src/input/Input.js", + "/D/wamp/www/phaser/src/core/StateManager.js", "/D/wamp/www/phaser/src/pixi/display/Sprite.js", - "/D/wamp/www/phaser/src/pixi/display/DisplayObject.js", + "/D/wamp/www/phaser/TS Source/utils/DebugUtils.js", + "/D/wamp/www/phaser/examples/js.php", + "/D/wamp/www/phaser/TS Source/renderers/canvas/SpriteRenderer.ts", + "/D/wamp/www/phaser/src/core/World.js", + "/D/wamp/www/phaser/examples/input1.php", + "/D/wamp/www/phaser/src/input/Pointer.js", + "/D/wamp/www/phaser/src/input/Mouse.js", + "/D/wamp/www/phaser/src/input/Touch.js", + "/D/wamp/www/phaser/src/input/Keyboard.js", + "/D/wamp/www/phaser/TS Source/gameobjects/Sprite.ts", + "/D/wamp/www/phaser/src/core/Stage.js", + "/D/wamp/www/phaser/src/loader/Loader.js", + "/D/wamp/www/phaser/TS Source/input/Pointer.js", + "/D/wamp/www/phaser/TS Source/input/Touch.js", + "/D/wamp/www/phaser/TS Source/input/MSPointer.js", + "/D/wamp/www/phaser/src/gameobjects/Sprite.js", + "/D/wamp/www/phaser/src/core/Camera.js", + "/D/wamp/www/phaser/TS Source/cameras/Camera.js", + "/D/wamp/www/phaser/examples/camera1.php", + "/D/wamp/www/phaser/TS Source/input/Mouse.js", + "/D/wamp/www/phaser/TS Source/math/Vec2Utils.js", + "/D/wamp/www/phaser/TS Source/input/InputManager.js", + "/D/wamp/www/phaser/src/geom/Point.js", + "/D/wamp/www/phaser/TS Source/input/Keyboard.ts", + "/D/wamp/www/phaser/TS Source/input/Keyboard.js", + "/D/wamp/www/phaser/examples/sprite3.php", + "/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/src/pixi/display/DisplayObject.js", "/D/wamp/www/pixi.js/examples/example 10 - Text/index.html", "/D/wamp/www/phaser/examples/assets/fonts/desyrel.json", - "/D/wamp/www/phaser/src/core/StateManager.js", "/D/wamp/www/phaser/src/math/Math.js", "/D/wamp/www/phaser/src/math/RandomDataGenerator.js", "/D/wamp/www/phaser/src/system/Device.js", "/D/wamp/www/phaser/TS Source/system/Device.js", "/D/wamp/www/phaser/src/core/State.js", "/D/wamp/www/bbc-wolfblood/game.js", - "/D/wamp/www/phaser/examples/js.php", "/D/wamp/www/phaser/TS Source/gameobjects/GameObjectFactory.js", "/D/wamp/www/phaser/src/gameobjects/GameObjectFactory.js", "/D/wamp/www/phaser/src/tween/Tween.js", @@ -628,14 +697,11 @@ "/C/Users/rich/Desktop/game.js", "/D/wamp/www/phaser/src/animation/AnimationManager.js", "/D/wamp/www/phaser/src/animation/Animation.js", - "/D/wamp/www/phaser/TS Source/gameobjects/Sprite.ts", "/D/wamp/www/phaser/TS Source/animation/Animation.js", "/D/wamp/www/phaser/TS Source/animation/AnimationManager.js", - "/D/wamp/www/phaser/src/pixi/renderers/canvas/CanvasRenderer.js", "/D/wamp/www/phaser/src/animation/Parser.js", "/D/wamp/www/phaser/src/loader/Cache.js", "/D/wamp/www/phaser/TS Source/gameobjects/Sprite.js", - "/D/wamp/www/phaser/src/loader/Loader.js", "/D/wamp/www/phaser/src/system/RequestAnimationFrame.js", "/D/wamp/www/phaser/src/pixi/textures/Texture.js", "/D/wamp/www/phaser/src/pixi/textures/BaseTexture.js", @@ -648,11 +714,9 @@ "/D/wamp/www/pixi.js/examples/example 2 - SpriteSheet/index.html", "/D/wamp/www/pixi.js/examples/example 3 - MovieClip/index.html", "/D/wamp/www/pixi.js/examples/example 3 - MovieClip/SpriteSheet.json", - "/D/wamp/www/phaser/src/core/World.js", "/D/wamp/www/phaser/examples/assets/sprites/pixi_monsters.json", "/D/wamp/www/phaser/examples/assets/sprites/invaderpig.json", "/D/wamp/www/pixi.js/examples/example 2 - SpriteSheet/SpriteSheet.json", - "/D/wamp/www/phaser/src/core/Stage.js", "/D/wamp/www/phaser/TS Source/World.js", "/D/wamp/www/phaser/src/Game.js", "/D/wamp/www/phaser/src/Stage.js", @@ -663,7 +727,6 @@ "/D/wamp/www/phaser/src/Phaser.js", "/D/wamp/www/phaser/TS Source/Stage.js", "/D/wamp/www/phaser/examples/rect1.php", - "/D/wamp/www/phaser/src/geom/Point.js", "/D/wamp/www/phaser/src/geom/Rectangle.js", "/D/wamp/www/phaser/src/pixi/utils/Detector.js", "/D/wamp/www/phaser/TS Source/Stage.ts", @@ -673,7 +736,6 @@ "/D/wamp/www/phaser/examples/flow2.php", "/D/wamp/www/phaser/examples/flow3.php", "/D/wamp/www/phaser/examples/flow4.php", - "/D/wamp/www/phaser/TS Source/cameras/Camera.js", "/D/wamp/www/phaser/examples/test.php", "/D/wamp/www/phaser/TS Tests/tilemaps/csv tilemap.js", "/D/wamp/www/phaser/TS Source/system/RequestAnimationFrame.js", @@ -709,30 +771,7 @@ "/D/wamp/www/phaser/TS Source/utils/CircleUtils.js", "/D/wamp/www/phaser/TS Source/geom/Circle.js", "/D/wamp/www/phaser/src/net/Net.js", - "/D/wamp/www/phaser/examples/net.html", - "/D/wamp/www/phaser/TS Source/net/Net.js", - "/D/wamp/www/phaser/examples/loader audio.html", - "/D/wamp/www/phaser/examples/loader spritesheet.html", - "/D/wamp/www/phaser/examples/loader atlas xml.html", - "/D/wamp/www/phaser/examples/loader atlas json.html", - "/D/wamp/www/phaser/examples/assets/sprites/shoebot.xml", - "/D/wamp/www/phaser/TS Source/loader/AnimationLoader.js", - "/D/wamp/www/phaser/TS Source/loader/AnimationLoader.ts", - "/D/wamp/www/phaser/src/loader/AnimationLoader.js", - "/D/wamp/www/phaser/TS Source/animation/FrameData.ts", - "/D/wamp/www/phaser/TS Source/animation/FrameData.js", - "/D/wamp/www/phaser/TS Source/animation/Frame.ts", - "/D/wamp/www/phaser/TS Source/animation/Frame.js", - "/D/wamp/www/phaser/TS Source/loader/Loader.js", - "/D/wamp/www/phaser/TS Source/loader/Cache.js", - "/D/wamp/www/phaser/TS Source/loader/Cache.ts", - "/D/wamp/www/phaser/TS Source/loader/Loader.ts", - "/D/wamp/www/phaser/src/core/SignalBinding.js", - "/D/wamp/www/phaser/src/core/Signal.js", - "/D/wamp/www/phaser/examples/signals.html", - "/D/wamp/www/phaser/examples/rnd.html", - "/D/wamp/www/phaser/TS Source/core/Signal.js", - "/D/wamp/www/js-signals/src/Signal.js" + "/D/wamp/www/phaser/examples/net.html" ], "find": { @@ -743,6 +782,8 @@ "height": 90.0, "where_history": [ + "D:\\wamp\\www\\phaser\\src\\pixi", + "D:\\wamp\\www\\phaser\\src\\input", "D:\\wamp\\www\\phaser\\TS Source", "D:\\wamp\\www\\phaser\\src\\pixi", "D:\\wamp\\www\\phaser\\Tests\\tilemap", @@ -766,6 +807,56 @@ "case_sensitive": false, "find_history": [ + "x", + "getLocalPosition", + "this.global", + "target.view", + "_width", + "key", + "worldView", + "DebugUtils.", + "Phaser.DebugUtils", + "DebugUtils.", + "Phaser.DebugUtils", + "Phaser.DebugUtils.", + "Phaser.DebugUtils", + "Phaser.Input.MSPointer", + "Phaser.Input.Pointer", + "Phaser.Input.Touch", + "Phaser.Input.Mouse", + "Phaser.Input.Keyboard", + "Phaser.Input.", + "Phaser.Mouse", + "Phaser.Pointer", + "InputManager.prototype", + "this.game.stage.canvas", + "Phaser.InputManager", + "Pointer.prototype.", + "Vec2", + " =", + ";", + " =", + "this.", + "Touch.prototype.", + "MSPointer.prototype.", + ", false", + "add", + "Mouse", + "Mouse.prototype.", + ";", + " =", + "this.", + "InputManager.prototype.", + "InputManager", + "Keyboard", + "Keyboard.prototype.", + "_target", + "worldView", + "this.worldBounds", + "Types", + "screenView", + "Camera.prototype", + "screenView", "webg", "loadComplete", "loadFrameData", @@ -843,57 +934,7 @@ "source", "(Circle.prototype", "defineProperty", - "getter", - "public ", - "Net.prototype.", - "this.TEXTURE", - "Phaser", - "FrameData.prototype.", - "number;", - "public ", - "pop", - "_queueSize", - "nextFile", - "Cache.prototype.", - "public ", - "{bool}", - " if (this._fileList[key]) {\n return true;\n } else {\n return false;\n }\n", - "_queueSize", - "Phaser.Signal", - ";", - "private ", - "public ", - "validateListener", - " : function", - "SignalBinding", - " : function", - " : ", - "validateListener", - "Nonsense.prototype.", - " = ", - ";", - " = null", - "this.", - "Maze", - "Include=\"", - "=", - "Fixed", - "wolfblood", - "index.php", - "unrated", - "UNRATED", - "setAll", - "Game.Sound", - "unlock", - "pause", - ".value", - ".pause", - "noteOn", - "refreshBuffer", - ".src", - "line", - "onAlpha", - "bunny" + "getter" ], "highlight": true, "in_selection": false, @@ -901,6 +942,24 @@ "regex": false, "replace_history": [ + "Phaser.MSPointer", + "Phaser.Pointer", + "Phaser.Touch", + "Phaser.Mouse", + "Phaser.Keyboard", + "Phaser.Input.Mouse", + "Phaser.Input.Pointer", + "Phaser.Input.prototype", + "Phaser.Input", + ":", + ",", + ":", + "", + ",", + ":", + "", + "target", + "view", "this._parent", "this.state", "elapsed", @@ -944,7 +1003,7 @@ "groups": [ { - "selected": 5, + "selected": 2, "sheets": [ { @@ -952,15 +1011,15 @@ "file": "src/core/Game.js", "settings": { - "buffer_size": 8628, + "buffer_size": 9194, "regions": { }, "selection": [ [ - 7268, - 7268 + 8796, + 8796 ] ], "settings": @@ -1071,25 +1130,156 @@ "syntax": "Packages/JavaScript/JavaScript.tmLanguage" }, "translation.x": 0.0, - "translation.y": 5134.0, + "translation.y": 6569.0, "zoom_level": 1.0 }, "type": "text" }, { "buffer": 1, - "file": "examples/sprite3.php", + "file": "src/gameobjects/Sprite.js", "settings": { - "buffer_size": 1406, + "buffer_size": 4297, "regions": { }, "selection": [ [ - 328, - 328 + 1061, + 1061 + ] + ], + "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": 180.0, + "zoom_level": 1.0 + }, + "type": "text" + }, + { + "buffer": 2, + "file": "examples/camera2.php", + "settings": + { + "buffer_size": 3999, + "regions": + { + }, + "selection": + [ + [ + 647, + 647 ] ], "settings": @@ -1201,30 +1391,29 @@ "translate_tabs_to_spaces": false }, "translation.x": 0.0, - "translation.y": 246.0, + "translation.y": 233.0, "zoom_level": 1.0 }, "type": "text" }, { - "buffer": 2, - "file": "src/gameobjects/Sprite.js", + "buffer": 3, + "file": "src/core/Camera.js", "settings": { - "buffer_size": 3926, + "buffer_size": 6523, "regions": { }, "selection": [ [ - 2813, - 2813 + 5501, + 5501 ] ], "settings": { - "auto_name": "Phaser.Sprite = function () {", "codeintel": true, "codeintel_config": { @@ -1333,25 +1522,25 @@ "translate_tabs_to_spaces": true }, "translation.x": 0.0, - "translation.y": 3201.0, + "translation.y": 3528.0, "zoom_level": 1.0 }, "type": "text" }, { - "buffer": 3, - "file": "src/core/World.js", + "buffer": 4, + "file": "src/utils/Debug.js", "settings": { - "buffer_size": 2705, + "buffer_size": 12950, "regions": { }, "selection": [ [ - 820, - 820 + 12066, + 12066 ] ], "settings": @@ -1459,28 +1648,30 @@ "Python Django": "Python" }, "sublime_auto_complete": true, - "syntax": "Packages/JavaScript/JavaScript.tmLanguage" + "syntax": "Packages/JavaScript/JavaScript.tmLanguage", + "tab_size": 4, + "translate_tabs_to_spaces": true }, "translation.x": 0.0, - "translation.y": 66.0, + "translation.y": 5991.0, "zoom_level": 1.0 }, "type": "text" }, { - "buffer": 4, - "file": "src/pixi/textures/RenderTexture.js", + "buffer": 5, + "file": "src/pixi/InteractionManager.js", "settings": { - "buffer_size": 6640, + "buffer_size": 15862, "regions": { }, "selection": [ [ - 6640, - 6640 + 15182, + 15198 ] ], "settings": @@ -1592,17 +1783,17 @@ "translate_tabs_to_spaces": false }, "translation.x": 0.0, - "translation.y": 0.0, + "translation.y": 9556.0, "zoom_level": 1.0 }, "type": "text" }, { - "buffer": 5, - "file": "/D/wamp/www/pixi.js/examples/example 11 - RenderTexture/index.html", + "buffer": 6, + "file": "TS Source/utils/SpriteUtils.js", "settings": { - "buffer_size": 2951, + "buffer_size": 14653, "regions": { }, @@ -1718,21 +1909,414 @@ "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": 0.0, + "zoom_level": 1.0 + }, + "type": "text" + }, + { + "buffer": 7, + "file": "TS Source/utils/SpriteUtils.ts", + "settings": + { + "buffer_size": 15421, + "regions": + { + }, + "selection": + [ + [ + 0, + 0 + ] + ], + "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/Text/Plain text.tmLanguage", + "tab_size": 4, + "translate_tabs_to_spaces": true + }, + "translation.x": 0.0, + "translation.y": 865.0, + "zoom_level": 1.0 + }, + "type": "text" + }, + { + "buffer": 8, + "file": "TS Source/gameobjects/TransformManager.ts", + "settings": + { + "buffer_size": 13922, + "regions": + { + }, + "selection": + [ + [ + 6441, + 6979 + ] + ], + "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/Text/Plain text.tmLanguage", + "tab_size": 4, + "translate_tabs_to_spaces": true + }, + "translation.x": 0.0, + "translation.y": 3554.0, + "zoom_level": 1.0 + }, + "type": "text" + }, + { + "buffer": 9, + "file": "/D/wamp/www/pixi.js/examples/example 6 - Interactivity/index.html", + "settings": + { + "buffer_size": 3593, + "regions": + { + }, + "selection": + [ + [ + 1443, + 1443 + ] + ], + "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/HTML/HTML.tmLanguage", "translate_tabs_to_spaces": false }, "translation.x": 0.0, - "translation.y": 0.0, + "translation.y": 818.0, "zoom_level": 1.0 }, "type": "text" }, { - "buffer": 6, - "file": "src/pixi/primitives/Graphics.js", + "buffer": 10, + "file": "src/input/Input.js", "settings": { - "buffer_size": 6432, + "buffer_size": 18350, "regions": { }, @@ -1848,10 +2432,143 @@ "Python Django": "Python" }, "sublime_auto_complete": true, - "syntax": "Packages/JavaScript/JavaScript.tmLanguage" + "syntax": "Packages/JavaScript/JavaScript.tmLanguage", + "tab_size": 4, + "translate_tabs_to_spaces": true }, "translation.x": 0.0, - "translation.y": 3693.0, + "translation.y": 0.0, + "zoom_level": 1.0 + }, + "type": "text" + }, + { + "buffer": 11, + "file": "src/geom/Point.js", + "settings": + { + "buffer_size": 10965, + "regions": + { + }, + "selection": + [ + [ + 6073, + 6131 + ] + ], + "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": 3274.0, "zoom_level": 1.0 }, "type": "text" diff --git a/examples/camera1.php b/examples/camera1.php index 6c4e7753..254a027a 100644 --- a/examples/camera1.php +++ b/examples/camera1.php @@ -20,13 +20,48 @@ function create() { - game.add.sprite(0, 0, 'mushroom'); - game.add.sprite(400, 0, 'mushroom'); - game.add.sprite(800, 0, 'mushroom'); + // Make our game world 2000x2000 pixels in size (the default is to match the game size) + game.world.setSize(2000, 2000); + + for (var i = 0; i < 50; i++) + { + var s = game.add.sprite(game.world.randomX, game.world.randomY, 'mushroom'); + s.scrollFactor.setTo(0.5, 0.5); + } + + for (var i = 0; i < 50; i++) + { + game.add.sprite(game.world.randomX, game.world.randomY, 'mushroom'); + } + + for (var i = 0; i < 50; i++) + { + var s = game.add.sprite(game.world.randomX, game.world.randomY, 'mushroom'); + s.scrollFactor.setTo(2, 2); + } } function update() { + + if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) + { + game.camera.x -= 4; + } + else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) + { + game.camera.x += 4; + } + + if (game.input.keyboard.isDown(Phaser.Keyboard.UP)) + { + game.camera.y -= 4; + } + else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) + { + game.camera.y += 4; + } + } })(); diff --git a/examples/camera2.php b/examples/camera2.php new file mode 100644 index 00000000..cd7fe0ab --- /dev/null +++ b/examples/camera2.php @@ -0,0 +1,167 @@ + + + + phaser.js - a new beginning + + + + + + + + \ No newline at end of file diff --git a/examples/js.php b/examples/js.php index aeeecab4..dfab7fa2 100644 --- a/examples/js.php +++ b/examples/js.php @@ -91,3 +91,7 @@ + + + + diff --git a/src/core/Game.js b/src/core/Game.js index 3f3bcab9..9f8b9fdb 100644 --- a/src/core/Game.js +++ b/src/core/Game.js @@ -231,6 +231,30 @@ Phaser.Game.prototype = { */ device: null, + /** + * A handy reference to world.camera + * @type {Phaser.Camera} + */ + camera: null, + + /** + * A handy reference to renderer.view + * @type {HTMLCanvasElement} + */ + canvas: null, + + /** + * A handy reference to renderer.context (only set for CANVAS games) + * @type {Context} + */ + context: null, + + /** + * A set of useful debug utilities + * @type {Phaser.Utils.Debug} + */ + debug: null, + /** * Initialize engine sub modules and start the game. * @param parent {string} ID of parent Dom element. @@ -275,12 +299,12 @@ Phaser.Game.prototype = { // this.physics = new Phaser.Physics.PhysicsManager(this); this.plugins = new Phaser.PluginManager(this, this); this.net = new Phaser.Net(this); + this.debug = new Phaser.Utils.Debug(this); this.load.onLoadComplete.add(this.loadComplete, this); this.world.boot(); this.state.boot(); - // this.stage.boot(); this.input.boot(); if (this.renderType == Phaser.CANVAS) @@ -311,6 +335,8 @@ Phaser.Game.prototype = { this.renderType = Phaser.CANVAS; this.renderer = new PIXI.CanvasRenderer(this.width, this.height, null, this.transparent); Phaser.Canvas.setSmoothingEnabled(this.renderer.context, this.antialias); + this.canvas = this.renderer.view; + this.context = this.renderer.context; } else { @@ -321,6 +347,8 @@ Phaser.Game.prototype = { { // They must have requested WebGL and their browser supports it this.renderer = new PIXI.WebGLRenderer(this.width, this.height, null, this.transparent, this.antialias); + this.canvas = this.renderer.view; + this.context = null; } Phaser.Canvas.addToDOM(this.renderer.view, this.parent, true); @@ -358,6 +386,7 @@ Phaser.Game.prototype = { this.plugins.update(); this.renderer.render(this.world._stage); + this.state.render(); this.plugins.postRender(); diff --git a/src/core/StateManager.js b/src/core/StateManager.js index fae9fef9..c7a61391 100644 --- a/src/core/StateManager.js +++ b/src/core/StateManager.js @@ -365,15 +365,6 @@ Phaser.StateManager.prototype = { }, - loadRender: function () { - - if (this.onLoadRenderCallback) - { - this.onLoadRenderCallback.call(this.callbackContext); - } - - }, - update: function () { if (this._created && this.onUpdateCallback) @@ -401,9 +392,16 @@ Phaser.StateManager.prototype = { render: function () { - if (this.onRenderCallback) - { - this.onRenderCallback.call(this.callbackContext); + if (this._created && this.onRenderCallback) + { + this.onRenderCallback.call(this.callbackContext); + } + else + { + if (this.onLoadRenderCallback) + { + this.onLoadRenderCallback.call(this.callbackContext); + } } }, diff --git a/src/core/World.js b/src/core/World.js index ad314366..98d490c5 100644 --- a/src/core/World.js +++ b/src/core/World.js @@ -24,6 +24,7 @@ Phaser.World.prototype = { boot: function () { this.camera = new Phaser.Camera(this.game, 0, 0, 0, this.game.width, this.game.height); + this.game.camera = this.camera; }, diff --git a/src/gameobjects/Sprite.js b/src/gameobjects/Sprite.js index 8b702838..84b13fdb 100644 --- a/src/gameobjects/Sprite.js +++ b/src/gameobjects/Sprite.js @@ -1,11 +1,10 @@ Phaser.Sprite = function (game, x, y, key, frame) { - if (typeof x === "undefined") { x = 0; } - if (typeof y === "undefined") { y = 0; } - - // if null we ought to set to the phaser logo or something :) - if (typeof key === "undefined") { key = null; } - if (typeof frame === "undefined") { frame = null; } + x = x || 0; + y = y || 0; + // if null we ought to set to the phaser logo or something :) + key = key || null; + frame = frame || null; this.game = game; @@ -37,7 +36,25 @@ Phaser.Sprite = function (game, x, y, key, frame) { * @property anchor * @type Point */ - this.anchor = new PIXI.Point(); + this.anchor = new Phaser.Point(); + + /** + * The width of the sprite (this is initially set by the texture) + * + * @property _width + * @type Number + * @private + */ + // this._width = 0; + + /** + * The height of the sprite (this is initially set by the texture) + * + * @property _height + * @type Number + * @private + */ + // this._height = 0; /** * The texture that the sprite is using @@ -73,23 +90,8 @@ Phaser.Sprite = function (game, x, y, key, frame) { */ this.blendMode = PIXI.blendModes.NORMAL; - /** - * The width of the sprite (this is initially set by the texture) - * - * @property _width - * @type Number - * @private - */ - this._width = 0; - - /** - * The height of the sprite (this is initially set by the texture) - * - * @property _height - * @type Number - * @private - */ - this._height = 0; + this._x = x; + this._y = y; this.updateFrame = true; this.renderable = true; @@ -100,6 +102,10 @@ Phaser.Sprite = function (game, x, y, key, frame) { // Replaces the PIXI.Point with a slightly more flexible one this.scale = new Phaser.Point(1, 1); + this.scrollFactor = new Phaser.Point(1, 1); + + this.worldView = new Phaser.Rectangle(x, y, this.width, this.height); + }; Phaser.Sprite.prototype = Object.create(PIXI.Sprite.prototype); @@ -111,6 +117,12 @@ Phaser.Sprite.prototype.constructor = Phaser.Sprite; Phaser.Sprite.prototype.update = function() { this.animations.update(); + + this.worldView.setTo(this._x, this._y, this.width, this.height); + + this.position.x = this._x - (this.game.world.camera.x * this.scrollFactor.x); + this.position.y = this._y - (this.game.world.camera.y * this.scrollFactor.y); + // this.checkBounds(); } @@ -130,11 +142,12 @@ Object.defineProperty(Phaser.Sprite.prototype, 'angle', { Object.defineProperty(Phaser.Sprite.prototype, 'x', { get: function() { - return this.position.x; + return this._x; }, set: function(value) { - this.position.x = value; + this.worldView.x = value; + this._x = value; } }); @@ -142,11 +155,12 @@ Object.defineProperty(Phaser.Sprite.prototype, 'x', { Object.defineProperty(Phaser.Sprite.prototype, 'y', { get: function() { - return this.position.y; + return this._y; }, set: function(value) { - this.position.y = value; + this.worldView.y = value; + this._y = value; } }); diff --git a/src/geom/Point.js b/src/geom/Point.js index 32e5e812..b9e513fa 100644 --- a/src/geom/Point.js +++ b/src/geom/Point.js @@ -347,18 +347,22 @@ Phaser.Point.distance = function (a, b, round) { */ Phaser.Point.rotate = function (a, x, y, angle, asDegrees, distance) { - if (typeof asDegrees === "undefined") { asDegrees = false; } - if (typeof distance === "undefined") { distance = null; } + asDegrees = asDegrees || false; + distance = distance || null; - if (asDegrees) { + if (asDegrees) + { angle = Phaser.Math.radToDeg(angle); } // Get distance from origin (cx/cy) to this point - if (distance === null) { + if (distance === null) + { distance = Math.sqrt(((x - a.x) * (x - a.x)) + ((y - a.y) * (y - a.y))); } return a.setTo(x + distance * Math.cos(angle), y + distance * Math.sin(angle)); }; + + diff --git a/src/input/Input.js b/src/input/Input.js index 83b11f40..33718433 100644 --- a/src/input/Input.js +++ b/src/input/Input.js @@ -13,9 +13,9 @@ Phaser.Input = function (game) { }; -Phaser.Input.MOUSE_OVERRIDES_TOUCH = 0; -Phaser.Input.TOUCH_OVERRIDES_MOUSE = 1; -Phaser.Input.MOUSE_TOUCH_COMBINE = 2; +Phaser.Mouse_OVERRIDES_TOUCH = 0; +Phaser.Touch_OVERRIDES_MOUSE = 1; +Phaser.Mouse_TOUCH_COMBINE = 2; Phaser.Input.prototype = { @@ -60,7 +60,7 @@ Phaser.Input.prototype = { /** * Controls the expected behaviour when using a mouse and touch together on a multi-input device */ - multiInputOverride: Phaser.Input.MOUSE_TOUCH_COMBINE, + multiInputOverride: Phaser.Mouse_TOUCH_COMBINE, /** * A vector object representing the current position of the Pointer. @@ -259,14 +259,14 @@ Phaser.Input.prototype = { **/ boot: function () { - this.mousePointer = new Phaser.Input.Pointer(this.game, 0); - this.pointer1 = new Phaser.Input.Pointer(this.game, 1); - this.pointer2 = new Phaser.Input.Pointer(this.game, 2); + this.mousePointer = new Phaser.Pointer(this.game, 0); + this.pointer1 = new Phaser.Pointer(this.game, 1); + this.pointer2 = new Phaser.Pointer(this.game, 2); - this.mouse = new Phaser.Input.Mouse(this.game); - this.keyboard = new Phaser.Input.Keyboard(this.game); - this.touch = new Phaser.Input.Touch(this.game); - this.mspointer = new Phaser.Input.MSPointer(this.game); + this.mouse = new Phaser.Mouse(this.game); + this.keyboard = new Phaser.Keyboard(this.game); + this.touch = new Phaser.Touch(this.game); + this.mspointer = new Phaser.MSPointer(this.game); this.onDown = new Phaser.Signal(); this.onUp = new Phaser.Signal(); @@ -321,7 +321,7 @@ Phaser.Input.prototype = { } else { - this['pointer' + next] = new Phaser.Input.Pointer(this.game, next); + this['pointer' + next] = new Phaser.Pointer(this.game, next); return this['pointer' + next]; } @@ -700,7 +700,7 @@ Object.defineProperty(Phaser.Input.prototype, "totalActivePointers", { Object.defineProperty(Phaser.Input.prototype, "worldX", { get: function () { - return this.camera.worldView.x + this.x; + return this.game.camera.view.x + this.x; }, enumerable: true, @@ -710,7 +710,7 @@ Object.defineProperty(Phaser.Input.prototype, "worldX", { Object.defineProperty(Phaser.Input.prototype, "worldY", { get: function () { - return this.camera.worldView.x + this.x; + return this.game.camera.view.y + this.y; }, enumerable: true, diff --git a/src/input/Keyboard.js b/src/input/Keyboard.js index 1bb31aab..1096a9a1 100644 --- a/src/input/Keyboard.js +++ b/src/input/Keyboard.js @@ -1,4 +1,4 @@ -Phaser.Input.Keyboard = function (game) { +Phaser.Keyboard = function (game) { this.game = game; this._keys = {}; @@ -6,7 +6,7 @@ Phaser.Input.Keyboard = function (game) { }; -Phaser.Input.Keyboard.prototype = { +Phaser.Keyboard.prototype = { game: null, @@ -206,101 +206,101 @@ Phaser.Input.Keyboard.prototype = { // Statics -Phaser.Input.Keyboard.A = "A".charCodeAt(0); -Phaser.Input.Keyboard.B = "B".charCodeAt(0); -Phaser.Input.Keyboard.C = "C".charCodeAt(0); -Phaser.Input.Keyboard.D = "D".charCodeAt(0); -Phaser.Input.Keyboard.E = "E".charCodeAt(0); -Phaser.Input.Keyboard.F = "F".charCodeAt(0); -Phaser.Input.Keyboard.G = "G".charCodeAt(0); -Phaser.Input.Keyboard.H = "H".charCodeAt(0); -Phaser.Input.Keyboard.I = "I".charCodeAt(0); -Phaser.Input.Keyboard.J = "J".charCodeAt(0); -Phaser.Input.Keyboard.K = "K".charCodeAt(0); -Phaser.Input.Keyboard.L = "L".charCodeAt(0); -Phaser.Input.Keyboard.M = "M".charCodeAt(0); -Phaser.Input.Keyboard.N = "N".charCodeAt(0); -Phaser.Input.Keyboard.O = "O".charCodeAt(0); -Phaser.Input.Keyboard.P = "P".charCodeAt(0); -Phaser.Input.Keyboard.Q = "Q".charCodeAt(0); -Phaser.Input.Keyboard.R = "R".charCodeAt(0); -Phaser.Input.Keyboard.S = "S".charCodeAt(0); -Phaser.Input.Keyboard.T = "T".charCodeAt(0); -Phaser.Input.Keyboard.U = "U".charCodeAt(0); -Phaser.Input.Keyboard.V = "V".charCodeAt(0); -Phaser.Input.Keyboard.W = "W".charCodeAt(0); -Phaser.Input.Keyboard.X = "X".charCodeAt(0); -Phaser.Input.Keyboard.Y = "Y".charCodeAt(0); -Phaser.Input.Keyboard.Z = "Z".charCodeAt(0); -Phaser.Input.Keyboard.ZERO = "0".charCodeAt(0); -Phaser.Input.Keyboard.ONE = "1".charCodeAt(0); -Phaser.Input.Keyboard.TWO = "2".charCodeAt(0); -Phaser.Input.Keyboard.THREE = "3".charCodeAt(0); -Phaser.Input.Keyboard.FOUR = "4".charCodeAt(0); -Phaser.Input.Keyboard.FIVE = "5".charCodeAt(0); -Phaser.Input.Keyboard.SIX = "6".charCodeAt(0); -Phaser.Input.Keyboard.SEVEN = "7".charCodeAt(0); -Phaser.Input.Keyboard.EIGHT = "8".charCodeAt(0); -Phaser.Input.Keyboard.NINE = "9".charCodeAt(0); -Phaser.Input.Keyboard.NUMPAD_0 = 96; -Phaser.Input.Keyboard.NUMPAD_1 = 97; -Phaser.Input.Keyboard.NUMPAD_2 = 98; -Phaser.Input.Keyboard.NUMPAD_3 = 99; -Phaser.Input.Keyboard.NUMPAD_4 = 100; -Phaser.Input.Keyboard.NUMPAD_5 = 101; -Phaser.Input.Keyboard.NUMPAD_6 = 102; -Phaser.Input.Keyboard.NUMPAD_7 = 103; -Phaser.Input.Keyboard.NUMPAD_8 = 104; -Phaser.Input.Keyboard.NUMPAD_9 = 105; -Phaser.Input.Keyboard.NUMPAD_MULTIPLY = 106; -Phaser.Input.Keyboard.NUMPAD_ADD = 107; -Phaser.Input.Keyboard.NUMPAD_ENTER = 108; -Phaser.Input.Keyboard.NUMPAD_SUBTRACT = 109; -Phaser.Input.Keyboard.NUMPAD_DECIMAL = 110; -Phaser.Input.Keyboard.NUMPAD_DIVIDE = 111; -Phaser.Input.Keyboard.F1 = 112; -Phaser.Input.Keyboard.F2 = 113; -Phaser.Input.Keyboard.F3 = 114; -Phaser.Input.Keyboard.F4 = 115; -Phaser.Input.Keyboard.F5 = 116; -Phaser.Input.Keyboard.F6 = 117; -Phaser.Input.Keyboard.F7 = 118; -Phaser.Input.Keyboard.F8 = 119; -Phaser.Input.Keyboard.F9 = 120; -Phaser.Input.Keyboard.F10 = 121; -Phaser.Input.Keyboard.F11 = 122; -Phaser.Input.Keyboard.F12 = 123; -Phaser.Input.Keyboard.F13 = 124; -Phaser.Input.Keyboard.F14 = 125; -Phaser.Input.Keyboard.F15 = 126; -Phaser.Input.Keyboard.COLON = 186; -Phaser.Input.Keyboard.EQUALS = 187; -Phaser.Input.Keyboard.UNDERSCORE = 189; -Phaser.Input.Keyboard.QUESTION_MARK = 191; -Phaser.Input.Keyboard.TILDE = 192; -Phaser.Input.Keyboard.OPEN_BRACKET = 219; -Phaser.Input.Keyboard.BACKWARD_SLASH = 220; -Phaser.Input.Keyboard.CLOSED_BRACKET = 221; -Phaser.Input.Keyboard.QUOTES = 222; -Phaser.Input.Keyboard.BACKSPACE = 8; -Phaser.Input.Keyboard.TAB = 9; -Phaser.Input.Keyboard.CLEAR = 12; -Phaser.Input.Keyboard.ENTER = 13; -Phaser.Input.Keyboard.SHIFT = 16; -Phaser.Input.Keyboard.CONTROL = 17; -Phaser.Input.Keyboard.ALT = 18; -Phaser.Input.Keyboard.CAPS_LOCK = 20; -Phaser.Input.Keyboard.ESC = 27; -Phaser.Input.Keyboard.SPACEBAR = 32; -Phaser.Input.Keyboard.PAGE_UP = 33; -Phaser.Input.Keyboard.PAGE_DOWN = 34; -Phaser.Input.Keyboard.END = 35; -Phaser.Input.Keyboard.HOME = 36; -Phaser.Input.Keyboard.LEFT = 37; -Phaser.Input.Keyboard.UP = 38; -Phaser.Input.Keyboard.RIGHT = 39; -Phaser.Input.Keyboard.DOWN = 40; -Phaser.Input.Keyboard.INSERT = 45; -Phaser.Input.Keyboard.DELETE = 46; -Phaser.Input.Keyboard.HELP = 47; -Phaser.Input.Keyboard.NUM_LOCK = 144; +Phaser.Keyboard.A = "A".charCodeAt(0); +Phaser.Keyboard.B = "B".charCodeAt(0); +Phaser.Keyboard.C = "C".charCodeAt(0); +Phaser.Keyboard.D = "D".charCodeAt(0); +Phaser.Keyboard.E = "E".charCodeAt(0); +Phaser.Keyboard.F = "F".charCodeAt(0); +Phaser.Keyboard.G = "G".charCodeAt(0); +Phaser.Keyboard.H = "H".charCodeAt(0); +Phaser.Keyboard.I = "I".charCodeAt(0); +Phaser.Keyboard.J = "J".charCodeAt(0); +Phaser.Keyboard.K = "K".charCodeAt(0); +Phaser.Keyboard.L = "L".charCodeAt(0); +Phaser.Keyboard.M = "M".charCodeAt(0); +Phaser.Keyboard.N = "N".charCodeAt(0); +Phaser.Keyboard.O = "O".charCodeAt(0); +Phaser.Keyboard.P = "P".charCodeAt(0); +Phaser.Keyboard.Q = "Q".charCodeAt(0); +Phaser.Keyboard.R = "R".charCodeAt(0); +Phaser.Keyboard.S = "S".charCodeAt(0); +Phaser.Keyboard.T = "T".charCodeAt(0); +Phaser.Keyboard.U = "U".charCodeAt(0); +Phaser.Keyboard.V = "V".charCodeAt(0); +Phaser.Keyboard.W = "W".charCodeAt(0); +Phaser.Keyboard.X = "X".charCodeAt(0); +Phaser.Keyboard.Y = "Y".charCodeAt(0); +Phaser.Keyboard.Z = "Z".charCodeAt(0); +Phaser.Keyboard.ZERO = "0".charCodeAt(0); +Phaser.Keyboard.ONE = "1".charCodeAt(0); +Phaser.Keyboard.TWO = "2".charCodeAt(0); +Phaser.Keyboard.THREE = "3".charCodeAt(0); +Phaser.Keyboard.FOUR = "4".charCodeAt(0); +Phaser.Keyboard.FIVE = "5".charCodeAt(0); +Phaser.Keyboard.SIX = "6".charCodeAt(0); +Phaser.Keyboard.SEVEN = "7".charCodeAt(0); +Phaser.Keyboard.EIGHT = "8".charCodeAt(0); +Phaser.Keyboard.NINE = "9".charCodeAt(0); +Phaser.Keyboard.NUMPAD_0 = 96; +Phaser.Keyboard.NUMPAD_1 = 97; +Phaser.Keyboard.NUMPAD_2 = 98; +Phaser.Keyboard.NUMPAD_3 = 99; +Phaser.Keyboard.NUMPAD_4 = 100; +Phaser.Keyboard.NUMPAD_5 = 101; +Phaser.Keyboard.NUMPAD_6 = 102; +Phaser.Keyboard.NUMPAD_7 = 103; +Phaser.Keyboard.NUMPAD_8 = 104; +Phaser.Keyboard.NUMPAD_9 = 105; +Phaser.Keyboard.NUMPAD_MULTIPLY = 106; +Phaser.Keyboard.NUMPAD_ADD = 107; +Phaser.Keyboard.NUMPAD_ENTER = 108; +Phaser.Keyboard.NUMPAD_SUBTRACT = 109; +Phaser.Keyboard.NUMPAD_DECIMAL = 110; +Phaser.Keyboard.NUMPAD_DIVIDE = 111; +Phaser.Keyboard.F1 = 112; +Phaser.Keyboard.F2 = 113; +Phaser.Keyboard.F3 = 114; +Phaser.Keyboard.F4 = 115; +Phaser.Keyboard.F5 = 116; +Phaser.Keyboard.F6 = 117; +Phaser.Keyboard.F7 = 118; +Phaser.Keyboard.F8 = 119; +Phaser.Keyboard.F9 = 120; +Phaser.Keyboard.F10 = 121; +Phaser.Keyboard.F11 = 122; +Phaser.Keyboard.F12 = 123; +Phaser.Keyboard.F13 = 124; +Phaser.Keyboard.F14 = 125; +Phaser.Keyboard.F15 = 126; +Phaser.Keyboard.COLON = 186; +Phaser.Keyboard.EQUALS = 187; +Phaser.Keyboard.UNDERSCORE = 189; +Phaser.Keyboard.QUESTION_MARK = 191; +Phaser.Keyboard.TILDE = 192; +Phaser.Keyboard.OPEN_BRACKET = 219; +Phaser.Keyboard.BACKWARD_SLASH = 220; +Phaser.Keyboard.CLOSED_BRACKET = 221; +Phaser.Keyboard.QUOTES = 222; +Phaser.Keyboard.BACKSPACE = 8; +Phaser.Keyboard.TAB = 9; +Phaser.Keyboard.CLEAR = 12; +Phaser.Keyboard.ENTER = 13; +Phaser.Keyboard.SHIFT = 16; +Phaser.Keyboard.CONTROL = 17; +Phaser.Keyboard.ALT = 18; +Phaser.Keyboard.CAPS_LOCK = 20; +Phaser.Keyboard.ESC = 27; +Phaser.Keyboard.SPACEBAR = 32; +Phaser.Keyboard.PAGE_UP = 33; +Phaser.Keyboard.PAGE_DOWN = 34; +Phaser.Keyboard.END = 35; +Phaser.Keyboard.HOME = 36; +Phaser.Keyboard.LEFT = 37; +Phaser.Keyboard.UP = 38; +Phaser.Keyboard.RIGHT = 39; +Phaser.Keyboard.DOWN = 40; +Phaser.Keyboard.INSERT = 45; +Phaser.Keyboard.DELETE = 46; +Phaser.Keyboard.HELP = 47; +Phaser.Keyboard.NUM_LOCK = 144; diff --git a/src/input/MSPointer.js b/src/input/MSPointer.js index af15d0f3..3b0ce222 100644 --- a/src/input/MSPointer.js +++ b/src/input/MSPointer.js @@ -1,11 +1,11 @@ /** -* Phaser.Input.MSPointer +* Phaser.MSPointer * * The MSPointer class handles touch interactions with the game and the resulting Pointer objects. * It will work only in Internet Explorer 10 and Windows Store or Windows Phone 8 apps using JavaScript. * http://msdn.microsoft.com/en-us/library/ie/hh673557(v=vs.85).aspx */ -Phaser.Input.MSPointer = function (game) { +Phaser.MSPointer = function (game) { this.game = game; this.callbackContext = this.game; @@ -16,7 +16,7 @@ Phaser.Input.MSPointer = function (game) { }; -Phaser.Input.MSPointer.prototype = { +Phaser.MSPointer.prototype = { game: null, @@ -55,6 +55,10 @@ Phaser.Input.MSPointer.prototype = { this.game.stage.canvas.addEventListener('MSPointerDown', this._onMSPointerDown, false); this.game.stage.canvas.addEventListener('MSPointerMove', this._onMSPointerMove, false); this.game.stage.canvas.addEventListener('MSPointerUp', this._onMSPointerUp, false); + + this.game.stage.canvas.style['-ms-content-zooming'] = 'none'; + this.game.stage.canvas.style['-ms-touch-action'] = 'none'; + } }, diff --git a/src/input/Mouse.js b/src/input/Mouse.js index 0050d0f2..6b82e0a4 100644 --- a/src/input/Mouse.js +++ b/src/input/Mouse.js @@ -1,4 +1,4 @@ -Phaser.Input.Mouse = function (game) { +Phaser.Mouse = function (game) { this.game = game; this.callbackContext = this.game; @@ -9,11 +9,11 @@ Phaser.Input.Mouse = function (game) { }; -Phaser.Input.Mouse.LEFT_BUTTON = 0; -Phaser.Input.Mouse.MIDDLE_BUTTON = 1; -Phaser.Input.Mouse.RIGHT_BUTTON = 2; +Phaser.Mouse.LEFT_BUTTON = 0; +Phaser.Mouse.MIDDLE_BUTTON = 1; +Phaser.Mouse.RIGHT_BUTTON = 2; -Phaser.Input.Mouse.prototype = { +Phaser.Mouse.prototype = { game: null, diff --git a/src/input/Pointer.js b/src/input/Pointer.js index 9527d8e9..8e4b1097 100644 --- a/src/input/Pointer.js +++ b/src/input/Pointer.js @@ -3,7 +3,7 @@ * * A Pointer object is used by the Mouse, Touch and MSPoint managers and represents a single finger on the touch screen. */ -Phaser.Input.Pointer = function (game, id) { +Phaser.Pointer = function (game, id) { this.game = game; this.id = id; @@ -22,7 +22,7 @@ Phaser.Input.Pointer = function (game, id) { }; -Phaser.Input.Pointer.prototype = { +Phaser.Pointer.prototype = { /** * Local private variable to store the status of dispatching a hold event @@ -238,7 +238,7 @@ Phaser.Input.Pointer.prototype = { // x and y are the old values here? this.positionDown.setTo(this.x, this.y); - if (this.game.input.multiInputOverride == Phaser.Input.MOUSE_OVERRIDES_TOUCH || this.game.input.multiInputOverride == Phaser.Input.MOUSE_TOUCH_COMBINE || (this.game.input.multiInputOverride == Phaser.Input.TOUCH_OVERRIDES_MOUSE && this.game.input.currentPointers == 0)) + if (this.game.input.multiInputOverride == Phaser.Mouse_OVERRIDES_TOUCH || this.game.input.multiInputOverride == Phaser.Mouse_TOUCH_COMBINE || (this.game.input.multiInputOverride == Phaser.Touch_OVERRIDES_MOUSE && this.game.input.currentPointers == 0)) { //this.game.input.x = this.x * this.game.input.scale.x; //this.game.input.y = this.y * this.game.input.scale.y; @@ -272,7 +272,7 @@ Phaser.Input.Pointer.prototype = { { if (this._holdSent == false && this.duration >= this.game.input.holdRate) { - if (this.game.input.multiInputOverride == Phaser.Input.MOUSE_OVERRIDES_TOUCH || this.game.input.multiInputOverride == Phaser.Input.MOUSE_TOUCH_COMBINE || (this.game.input.multiInputOverride == Phaser.Input.TOUCH_OVERRIDES_MOUSE && this.game.input.currentPointers == 0)) + if (this.game.input.multiInputOverride == Phaser.Mouse_OVERRIDES_TOUCH || this.game.input.multiInputOverride == Phaser.Mouse_TOUCH_COMBINE || (this.game.input.multiInputOverride == Phaser.Touch_OVERRIDES_MOUSE && this.game.input.currentPointers == 0)) { this.game.input.onHold.dispatch(this); } @@ -335,7 +335,7 @@ Phaser.Input.Pointer.prototype = { this.circle.x = this.x; this.circle.y = this.y; - if (this.game.input.multiInputOverride == Phaser.Input.MOUSE_OVERRIDES_TOUCH || this.game.input.multiInputOverride == Phaser.Input.MOUSE_TOUCH_COMBINE || (this.game.input.multiInputOverride == Phaser.Input.TOUCH_OVERRIDES_MOUSE && this.game.input.currentPointers == 0)) + if (this.game.input.multiInputOverride == Phaser.Mouse_OVERRIDES_TOUCH || this.game.input.multiInputOverride == Phaser.Mouse_TOUCH_COMBINE || (this.game.input.multiInputOverride == Phaser.Touch_OVERRIDES_MOUSE && this.game.input.currentPointers == 0)) { this.game.input.activePointer = this; this.game.input.x = this.x; @@ -453,7 +453,7 @@ Phaser.Input.Pointer.prototype = { this.timeUp = this.game.time.now; - if (this.game.input.multiInputOverride == Phaser.Input.MOUSE_OVERRIDES_TOUCH || this.game.input.multiInputOverride == Phaser.Input.MOUSE_TOUCH_COMBINE || (this.game.input.multiInputOverride == Phaser.Input.TOUCH_OVERRIDES_MOUSE && this.game.input.currentPointers == 0)) + if (this.game.input.multiInputOverride == Phaser.Mouse_OVERRIDES_TOUCH || this.game.input.multiInputOverride == Phaser.Mouse_TOUCH_COMBINE || (this.game.input.multiInputOverride == Phaser.Touch_OVERRIDES_MOUSE && this.game.input.currentPointers == 0)) { this.game.input.onUp.dispatch(this); @@ -576,7 +576,7 @@ Phaser.Input.Pointer.prototype = { }; -Object.defineProperty(Phaser.Input.Pointer.prototype, "duration", { +Object.defineProperty(Phaser.Pointer.prototype, "duration", { /** * How long the Pointer has been depressed on the touchscreen. If not currently down it returns -1. @@ -598,7 +598,7 @@ Object.defineProperty(Phaser.Input.Pointer.prototype, "duration", { configurable: true }); -Object.defineProperty(Phaser.Input.Pointer.prototype, "worldX", { +Object.defineProperty(Phaser.Pointer.prototype, "worldX", { /** * Gets the X value of this Pointer in world coordinates based on the given camera. @@ -614,7 +614,7 @@ Object.defineProperty(Phaser.Input.Pointer.prototype, "worldX", { configurable: true }); -Object.defineProperty(Phaser.Input.Pointer.prototype, "worldY", { +Object.defineProperty(Phaser.Pointer.prototype, "worldY", { /** * Gets the Y value of this Pointer in world coordinates based on the given camera. diff --git a/src/input/Touch.js b/src/input/Touch.js index 535995d1..31d336c2 100644 --- a/src/input/Touch.js +++ b/src/input/Touch.js @@ -7,7 +7,7 @@ * http://www.html5rocks.com/en/mobile/touchandmouse/ * Note: Android 2.x only supports 1 touch event at once, no multi-touch */ -Phaser.Input.Touch = function (game) { +Phaser.Touch = function (game) { this.game = game; this.callbackContext = this.game; @@ -21,7 +21,7 @@ Phaser.Input.Touch = function (game) { }; -Phaser.Input.Touch.prototype = { +Phaser.Touch.prototype = { game: null, diff --git a/src/pixi/display/Sprite.js b/src/pixi/display/Sprite.js index 4a6e65a8..e539060e 100644 --- a/src/pixi/display/Sprite.js +++ b/src/pixi/display/Sprite.js @@ -152,7 +152,7 @@ PIXI.Sprite.prototype.setTexture = function(texture) PIXI.Sprite.prototype.onTextureUpdate = function(event) { //this.texture.removeEventListener( 'update', this.onTextureUpdateBind ); - +console.log('pot'); // so if _width is 0 then width was not set.. if(this._width)this.scale.x = this._width / this.texture.frame.width; if(this._height)this.scale.y = this._height / this.texture.frame.height; diff --git a/src/utils/Debug.js b/src/utils/Debug.js new file mode 100644 index 00000000..1a395793 --- /dev/null +++ b/src/utils/Debug.js @@ -0,0 +1,404 @@ +/** +* @author Richard Davey +* @copyright 2013 Photon Storm Ltd. +* @license https://github.com/photonstorm/phaser/blob/master/license.txt MIT License +* @module Phaser +*/ + +Phaser.Utils = { + // Until we have a proper entry-point +} + +/** +* A collection of methods for displaying debug information about game objects. +* +* @class DebugUtils +*/ +Phaser.Utils.Debug = function (game) { + + this.game = game; + this.context = game.context; + +}; + +Phaser.Utils.Debug.prototype = { + + font: '14px Courier', + lineHeight: 16, + renderShadow: true, + currentX: 0, + currentY: 0, + context: null, + + /** + * Internal method that resets the debug output values. + * @method start + * @param {Number} x The X value the debug info will start from. + * @param {Number} y The Y value the debug info will start from. + * @param {String} color The color the debug info will drawn in. + */ + start: function (x, y, color) { + + if (this.context == null) + { + return; + } + + x = x || null; + y = y || null; + color = color || 'rgb(255,255,255)'; + + if (x && y) + { + this.currentX = x; + this.currentY = y; + this.currentColor = color; + } + + this.context.save(); + this.context.setTransform(1, 0, 0, 1, 0, 0); + this.context.fillStyle = color; + this.context.font = this.font; + + }, + + stop: function () { + + this.context.restore(); + + }, + + /** + * Internal method that outputs a single line of text. + * @method line + * @param {String} text The line of text to draw. + * @param {Number} x The X value the debug info will start from. + * @param {Number} y The Y value the debug info will start from. + */ + line: function (text, x, y) { + + if (this.context == null) + { + return; + } + + x = x || null; + y = y || null; + + if (x !== null) { + this.currentX = x; + } + + if (y !== null) { + this.currentY = y; + } + + if (this.renderShadow) + { + this.context.fillStyle = 'rgb(0,0,0)'; + this.context.fillText(text, this.currentX + 1, this.currentY + 1); + this.context.fillStyle = this.currentColor; + } + + this.context.fillText(text, this.currentX, this.currentY); + this.currentY += this.lineHeight; + + }, + + renderSpriteCorners: function (sprite, color) { + + if (this.context == null) + { + return; + } + + if (typeof color === "undefined") { color = 'rgb(255,0,255)'; } + + this.start(0, 0, color); + this.line('x: ' + Math.floor(sprite.transform.upperLeft.x) + ' y: ' + Math.floor(sprite.transform.upperLeft.y), sprite.transform.upperLeft.x, sprite.transform.upperLeft.y); + this.line('x: ' + Math.floor(sprite.transform.upperRight.x) + ' y: ' + Math.floor(sprite.transform.upperRight.y), sprite.transform.upperRight.x, sprite.transform.upperRight.y); + this.line('x: ' + Math.floor(sprite.transform.bottomLeft.x) + ' y: ' + Math.floor(sprite.transform.bottomLeft.y), sprite.transform.bottomLeft.x, sprite.transform.bottomLeft.y); + this.line('x: ' + Math.floor(sprite.transform.bottomRight.x) + ' y: ' + Math.floor(sprite.transform.bottomRight.y), sprite.transform.bottomRight.x, sprite.transform.bottomRight.y); + + }, + + /** + * Render debug infos. (including id, position, rotation, scrolling factor, worldBounds and some other properties) + * @param x {number} X position of the debug info to be rendered. + * @param y {number} Y position of the debug info to be rendered. + * @param [color] {number} color of the debug info to be rendered. (format is css color string) + */ + renderSoundInfo: function (sound, x, y, color) { + + if (this.context == null) + { + return; + } + + color = color || 'rgb(255,255,255)'; + + this.start(x, y, color); + this.line('Sound: ' + sound.key + ' Locked: ' + sound.game.sound.touchLocked + ' Pending Playback: ' + sound.pendingPlayback); + this.line('Decoded: ' + sound.isDecoded + ' Decoding: ' + sound.isDecoding); + this.line('Total Duration: ' + sound.totalDuration + ' Playing: ' + sound.isPlaying); + this.line('Time: ' + sound.currentTime); + this.line('Volume: ' + sound.volume + ' Muted: ' + sound.mute); + this.line('WebAudio: ' + sound.usingWebAudio + ' Audio: ' + sound.usingAudioTag); + + if (sound.currentMarker !== '') + { + this.line('Marker: ' + sound.currentMarker + ' Duration: ' + sound.duration); + this.line('Start: ' + sound.markers[sound.currentMarker].start + ' Stop: ' + sound.markers[sound.currentMarker].stop); + this.line('Position: ' + sound.position); + } + + }, + + /** + * Render debug infos. (including id, position, rotation, scrolling factor, worldBounds and some other properties) + * @param x {number} X position of the debug info to be rendered. + * @param y {number} Y position of the debug info to be rendered. + * @param [color] {number} color of the debug info to be rendered. (format is css color string) + */ + renderCameraInfo: function (camera, x, y, color) { + + if (this.context == null) + { + return; + } + + color = color || 'rgb(255,255,0)'; + + this.start(x, y, color); + this.line('Camera (' + camera.width + ' x ' + camera.height + ')'); + this.line('X: ' + camera.x + ' Y: ' + camera.y); + this.stop(); + + }, + + /** + * Renders the Pointer.circle object onto the stage in green if down or red if up. + * @method renderDebug + */ + renderPointer: function (pointer, hideIfUp, downColor, upColor, color) { + + if (this.context == null) + { + return; + } + + if (typeof hideIfUp === "undefined") { hideIfUp = false; } + if (typeof downColor === "undefined") { downColor = 'rgba(0,255,0,0.5)'; } + if (typeof upColor === "undefined") { upColor = 'rgba(255,0,0,0.5)'; } + if (typeof color === "undefined") { color = 'rgb(255,255,255)'; } + + if (hideIfUp == true && pointer.isUp == true) + { + return; + } + + this.context.beginPath(); + this.context.arc(pointer.x, pointer.y, pointer.circle.radius, 0, Math.PI * 2); + + if (pointer.active) + { + this.context.fillStyle = downColor; + } + else + { + this.context.fillStyle = upColor; + } + + this.context.fill(); + this.context.closePath(); + + // Render the points + this.context.beginPath(); + this.context.moveTo(pointer.positionDown.x, pointer.positionDown.y); + this.context.lineTo(pointer.position.x, pointer.position.y); + this.context.lineWidth = 2; + this.context.stroke(); + this.context.closePath(); + + // Render the text + this.start(pointer.x, pointer.y - 100, color); + this.line('ID: ' + pointer.id + " Active: " + pointer.active); + this.line('World X: ' + pointer.worldX + " World Y: " + pointer.worldY); + this.line('Screen X: ' + pointer.x + " Screen Y: " + pointer.y); + this.line('Duration: ' + pointer.duration + " ms"); + + }, + + /** + * Render debug information about the Input object. + * @param x {number} X position of the debug info to be rendered. + * @param y {number} Y position of the debug info to be rendered. + * @param [color] {number} color of the debug info to be rendered. (format is css color string) + */ + renderInputInfo: function (x, y, color) { + + if (this.context == null) + { + return; + } + + color = color || 'rgb(255,255,0)'; + + this.start(x, y, color); + this.line('Input'); + this.line('X: ' + this.game.input.x + ' Y: ' + this.game.input.y); + this.line('World X: ' + this.game.input.worldX + ' World Y: ' + this.game.input.worldY); + this.line('Scale X: ' + this.game.input.scale.x.toFixed(1) + ' Scale Y: ' + this.game.input.scale.x.toFixed(1)); + this.line('Screen X: ' + this.game.input.activePointer.screenX + ' Screen Y: ' + this.game.input.activePointer.screenY); + this.stop(); + + }, + + /** + * Render debug infos. (including name, bounds info, position and some other properties) + * @param x {number} X position of the debug info to be rendered. + * @param y {number} Y position of the debug info to be rendered. + * @param [color] {number} color of the debug info to be rendered. (format is css color string) + */ + renderSpriteInfo: function (sprite, x, y, color) { + + if (this.context == null) + { + return; + } + + color = color || 'rgb(255, 255, 255)'; + + this.start(x, y, color); + + this.line('Sprite: ' + ' (' + sprite.width + ' x ' + sprite.height + ') anchor: ' + sprite.anchor.x + ' x ' + sprite.anchor.y); + // this.line('x: ' + sprite.x.toFixed(1) + ' y: ' + sprite.y.toFixed(1) + ' rotation: ' + sprite.rotation.toFixed(1)); + // this.line('wx: ' + sprite.worldView.x + ' wy: ' + sprite.worldView.y + ' ww: ' + sprite.worldView.width.toFixed(1) + ' wh: ' + sprite.worldView.height.toFixed(1) + ' wb: ' + sprite.worldView.bottom + ' wr: ' + sprite.worldView.right); + // this.line('sx: ' + sprite.scale.x.toFixed(1) + ' sy: ' + sprite.scale.y.toFixed(1)); + + // 0 = scaleX + // 1 = skewY + // 2 = translateX + // 3 = skewX + // 4 = scaleY + // 5 = translateY + + + this.line('scale x: ' + sprite.worldTransform[0]); + this.line('scale y: ' + sprite.worldTransform[4]); + this.line('tx: ' + sprite.worldTransform[2]); + this.line('ty: ' + sprite.worldTransform[5]); + this.line('skew x: ' + sprite.worldTransform[1]); + this.line('skew y: ' + sprite.worldTransform[3]); + + // this.line('tx: ' + sprite.texture.width.toFixed(1) + ' ty: ' + sprite.texture.height.toFixed(1)); + // this.line('center x: ' + sprite.transform.center.x + ' y: ' + sprite.transform.center.y); + // this.line('cameraView x: ' + sprite.cameraView.x + ' y: ' + sprite.cameraView.y + ' width: ' + sprite.cameraView.width + ' height: ' + sprite.cameraView.height); + // this.line('inCamera: ' + this.game.renderer.spriteRenderer.inCamera(this.game.camera, sprite)); + + }, + + renderSpriteBounds: function (sprite, color) { + + if (this.context == null) + { + return; + } + + color = color || 'rgba(0, 255, 0, 0.2)'; + + this.start(); + this.context.fillStyle = color; + this.context.fillRect(sprite.worldView.x, sprite.worldView.y, sprite.worldView.width, sprite.worldView.height); + this.stop(); + + }, + + renderPixel: function (x, y, fillStyle) { + + if (this.context == null) + { + return; + } + + fillStyle = fillStyle || 'rgba(0,255,0,1)'; + + this.start(); + this.context.fillStyle = fillStyle; + this.context.fillRect(x, y, 2, 2); + this.stop(); + + }, + + renderPoint: function (point, fillStyle) { + + if (this.context == null) + { + return; + } + + fillStyle = fillStyle || 'rgba(0,255,0,1)'; + + this.start(); + this.context.fillStyle = fillStyle; + this.context.fillRect(point.x, point.y, 4, 4); + this.stop(); + + }, + + renderRectangle: function (rect, fillStyle) { + + if (this.context == null) + { + return; + } + + fillStyle = fillStyle || 'rgba(0,255,0,0.3)'; + + this.start(); + this.context.fillStyle = fillStyle; + this.context.fillRect(rect.x, rect.y, rect.width, rect.height); + this.stop(); + + }, + + renderCircle: function (circle, fillStyle) { + + if (this.context == null) + { + return; + } + + fillStyle = fillStyle || 'rgba(0,255,0,0.3)'; + + this.start(); + this.context.fillStyle = fillStyle; + this.context.arc(circle.x, circle.y, circle.radius, 0, Math.PI * 2, false); + this.context.fill(); + this.stop(); + + }, + + /** + * Render text + * @param x {number} X position of the debug info to be rendered. + * @param y {number} Y position of the debug info to be rendered. + * @param [color] {number} color of the debug info to be rendered. (format is css color string) + */ + renderText: function (text, x, y, color, font) { + + if (this.context == null) + { + return; + } + + if (typeof color === "undefined") { color = 'rgb(255,255,255)'; } + if (typeof font === "undefined") { font = '16px Courier'; } + + this.context.font = font; + this.context.fillStyle = color; + this.context.fillText(text, x, y); + + } + +};