Skip to content

Commit 42ecf4a

Browse files
committed
Fixed polyfill errors and added direction consts.
1 parent babe6e9 commit 42ecf4a

4 files changed

Lines changed: 17 additions & 140 deletions

File tree

v3/src/checksum.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
var CHECKSUM = {
2-
build: '234a6e20-5acf-11e7-94ea-914d156f6e97'
2+
build: 'e3e6e2b0-5ad6-11e7-b604-99296cb8a42f'
33
};
44
module.exports = CHECKSUM;

v3/src/const.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ var CONST = {
55
AUTO: 0,
66
CANVAS: 1,
77
WEBGL: 2,
8-
HEADLESS: 3
8+
HEADLESS: 3,
9+
10+
NONE: 4,
11+
UP: 5,
12+
DOWN: 6,
13+
LEFT: 7,
14+
RIGHT: 8
915

1016
};
1117

v3/src/physics/impact/Body.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,22 @@ var Body = new Class({
7676

7777
var res = this.world.collisionMap.trace(this.pos.x, this.pos.y, mx, my, this.size.x, this.size.y);
7878

79-
UpdateMotion(this, res);
79+
if (this.handleMovementTrace(res))
80+
{
81+
UpdateMotion(this, res);
82+
}
8083

8184
if (window.dumpit)
8285
{
8386
console.log('END res', res.pos.x, res.pos.y);
8487
}
8588
},
8689

90+
handleMovementTrace: function (res)
91+
{
92+
return true;
93+
},
94+
8795
skipHash: function ()
8896
{
8997
return (!this.enabled || (this.type === 0 && this.checkAgainst === 0 && this.collides === 0));

v3/src/polyfills/Function.bind.js

Lines changed: 0 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@
33
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
44
*/
55

6-
// ES6 Math.trunc - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc
7-
if (!Math.trunc) {
8-
Math.trunc = function trunc(x) {
9-
return x < 0 ? Math.ceil(x) : Math.floor(x);
10-
};
11-
}
12-
136
/**
147
* A polyfill for Function.prototype.bind
158
*/
@@ -52,133 +45,3 @@ if (!Function.prototype.bind) {
5245
})();
5346
}
5447

55-
/**
56-
* A polyfill for Array.isArray
57-
*/
58-
if (!Array.isArray)
59-
{
60-
Array.isArray = function (arg)
61-
{
62-
return Object.prototype.toString.call(arg) === '[object Array]';
63-
};
64-
}
65-
66-
/**
67-
* A polyfill for Array.forEach
68-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
69-
*/
70-
if (!Array.prototype.forEach)
71-
{
72-
Array.prototype.forEach = function(fun /*, thisArg */)
73-
{
74-
"use strict";
75-
76-
if (this === void 0 || this === null)
77-
{
78-
throw new TypeError();
79-
}
80-
81-
var t = Object(this);
82-
var len = t.length >>> 0;
83-
84-
if (typeof fun !== "function")
85-
{
86-
throw new TypeError();
87-
}
88-
89-
var thisArg = arguments.length >= 2 ? arguments[1] : void 0;
90-
91-
for (var i = 0; i < len; i++)
92-
{
93-
if (i in t)
94-
{
95-
fun.call(thisArg, t[i], i, t);
96-
}
97-
}
98-
};
99-
}
100-
101-
/**
102-
* Low-budget Float32Array knock-off, suitable for use with P2.js in IE9
103-
* Source: http://www.html5gamedevs.com/topic/5988-phaser-12-ie9/
104-
* Cameron Foale (http://www.kibibu.com)
105-
*/
106-
if (typeof window.Uint32Array !== "function" && typeof window.Uint32Array !== "object")
107-
{
108-
var CheapArray = function(type)
109-
{
110-
var proto = new Array(); // jshint ignore:line
111-
112-
window[type] = function(arg) {
113-
114-
if (typeof(arg) === "number")
115-
{
116-
Array.call(this, arg);
117-
this.length = arg;
118-
119-
for (var i = 0; i < this.length; i++)
120-
{
121-
this[i] = 0;
122-
}
123-
}
124-
else
125-
{
126-
Array.call(this, arg.length);
127-
128-
this.length = arg.length;
129-
130-
for (var i = 0; i < this.length; i++)
131-
{
132-
this[i] = arg[i];
133-
}
134-
}
135-
};
136-
137-
window[type].prototype = proto;
138-
window[type].constructor = window[type];
139-
};
140-
141-
CheapArray('Float32Array'); // jshint ignore:line
142-
CheapArray('Uint32Array'); // jshint ignore:line
143-
CheapArray('Uint16Array'); // jshint ignore:line
144-
CheapArray('Int16Array'); // jshint ignore:line
145-
CheapArray('ArrayBuffer'); // jshint ignore:line
146-
}
147-
148-
/**
149-
* Also fix for the absent console in IE9
150-
*/
151-
if (!window.console)
152-
{
153-
window.console = {};
154-
window.console.log = window.console.assert = function(){};
155-
window.console.warn = window.console.assert = function(){};
156-
}
157-
158-
/**
159-
* performance.now
160-
*/
161-
(function(){
162-
163-
if ("performance" in window == false) {
164-
window.performance = {};
165-
}
166-
167-
Date.now = (Date.now || function () { // thanks IE8
168-
return new Date().getTime();
169-
});
170-
171-
if ("now" in window.performance == false)
172-
{
173-
var nowOffset = Date.now();
174-
175-
if (performance.timing && performance.timing.navigationStart){
176-
nowOffset = performance.timing.navigationStart
177-
}
178-
179-
window.performance.now = function now(){
180-
return Date.now() - nowOffset;
181-
}
182-
}
183-
184-
})();

0 commit comments

Comments
 (0)