Device, Canvas and GamePad classes all updated for better CocoonJS support (thanks Videlais)

This commit is contained in:
photonstorm
2014-02-19 02:45:42 +00:00
parent 14646e811c
commit d057a9fe11
5 changed files with 160 additions and 4 deletions
+2 -1
View File
@@ -26,7 +26,8 @@ Phaser.Canvas = {
width = width || 256;
height = height || 256;
var canvas = document.createElement('canvas');
// var canvas = document.createElement('canvas');
var canvas = document.createElement(navigator.isCocoonJS ? 'screencanvas' : 'canvas');
if (typeof id === 'string')
{
+1 -1
View File
@@ -385,7 +385,7 @@ Phaser.Device.prototype = {
*/
_checkFeatures: function () {
this.canvas = !!window['CanvasRenderingContext2D'];
this.canvas = !!window['CanvasRenderingContext2D'] || this.iscocoonJS;
try {
this.localStorage = !!localStorage.getItem;