Skip to content

Commit 4a71309

Browse files
committed
Added missing properties and methods to Quad class.
Updated to use new Mesh Color and Alpha arrays.
1 parent 73ff899 commit 4a71309

4 files changed

Lines changed: 287 additions & 40 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: '5246eae0-3cc6-11e7-a401-c3d2fac692e5'
2+
build: 'dfab8d20-3fb2-11e7-af94-f9a09f1963c8'
33
};
44
module.exports = CHECKSUM;

v3/src/gameobjects/mesh/Mesh.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,30 @@ var Mesh = new Class({
3838
{
3939
throw new Error('Phaser: Vertex count must match UV count');
4040
}
41+
4142
if (colors.length > 0 && colors.length < (vertices.length / 2)|0)
4243
{
4344
throw new Error('Phaser: Color count must match Vertex count');
4445
}
46+
4547
if (alphas.length > 0 && alphas.length < (vertices.length / 2)|0)
4648
{
4749
throw new Error('Phaser: Alpha count must match Vertex count');
4850
}
4951

52+
var i;
53+
5054
if (colors.length === 0)
5155
{
52-
for (var i = 0; i < (vertices.length / 2)|0; ++i)
56+
for (i = 0; i < (vertices.length / 2)|0; ++i)
5357
{
5458
colors[i] = 0xFFFFFF;
5559
}
5660
}
5761

5862
if (alphas.length === 0)
5963
{
60-
for (var i = 0; i < (vertices.length / 2)|0; ++i)
64+
for (i = 0; i < (vertices.length / 2)|0; ++i)
6165
{
6266
alphas[i] = 1.0;
6367
}

v3/src/gameobjects/quad/BuildFromConfig.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
var Quad = require('./Quad');
22
var GetAdvancedValue = require('../../utils/object/GetAdvancedValue');
3-
var GetValue = require('../../utils/object/GetValue');
43
var BuildGameObject = require('../BuildGameObject');
54

65
var BuildFromConfig = function (state, config)
76
{
7+
var x = GetAdvancedValue(config, 'x', 0);
8+
var y = GetAdvancedValue(config, 'y', 0);
89
var key = GetAdvancedValue(config, 'key', null);
910
var frame = GetAdvancedValue(config, 'frame', null);
10-
var vertices = GetValue(config, 'vertices', []);
11-
var indices = GetValue(config, 'indices', []);
12-
var uv = GetValue(config, 'uv', []);
1311

14-
var quad = new Quad(state, 0, 0, vertices, uv, indices, key, frame);
12+
var quad = new Quad(state, x, y, key, frame);
1513

1614
BuildGameObject(state, quad, config);
1715

0 commit comments

Comments
 (0)