Skip to content

Commit 8264351

Browse files
committed
Renamed GetObjectValue to GetValue and replaced through-out entire codebase. More consistent now with GetAdvancedValue, etc.
1 parent 427018d commit 8264351

21 files changed

Lines changed: 198 additions & 198 deletions

File tree

v3/src/actions/GridAlign.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var CONST = require('../utils/align/const');
22
var AlignIn = require('../utils/align/AlignIn');
33
var Zone = require('../gameobjects/zone/Zone');
4-
var GetObjectValue = require('../utils/object/GetObjectValue');
4+
var GetValue = require('../utils/object/GetValue');
55

66
var tempZone = new Zone({}, 0, 0, 1, 1);
77

@@ -58,15 +58,15 @@ var tempZone = new Zone({}, 0, 0, 1, 1);
5858
*/
5959
var GridAlign = function (items, options)
6060
{
61-
var width = GetObjectValue(options, 'width', -1);
62-
var height = GetObjectValue(options, 'height', -1);
63-
var cellWidth = GetObjectValue(options, 'cellWidth', 1);
64-
var cellHeight = GetObjectValue(options, 'cellHeight', cellWidth);
65-
var position = GetObjectValue(options, 'position', CONST.TOP_LEFT);
66-
var x = GetObjectValue(options, 'x', 0);
67-
var y = GetObjectValue(options, 'y', 0);
68-
// var centerX = GetObjectValue(options, 'centerX', null);
69-
// var centerY = GetObjectValue(options, 'centerY', null);
61+
var width = GetValue(options, 'width', -1);
62+
var height = GetValue(options, 'height', -1);
63+
var cellWidth = GetValue(options, 'cellWidth', 1);
64+
var cellHeight = GetValue(options, 'cellHeight', cellWidth);
65+
var position = GetValue(options, 'position', CONST.TOP_LEFT);
66+
var x = GetValue(options, 'x', 0);
67+
var y = GetValue(options, 'y', 0);
68+
// var centerX = GetValue(options, 'centerX', null);
69+
// var centerY = GetValue(options, 'centerY', null);
7070

7171
var cx = 0;
7272
var cy = 0;

v3/src/animation/frame/Animation.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var GetObjectValue = require('../../utils/object/GetObjectValue');
1+
var GetValue = require('../../utils/object/GetValue');
22
var GetFrames = require('./GetFrames');
33

44
var Animation = function (manager, key, config)
@@ -11,14 +11,14 @@ var Animation = function (manager, key, config)
1111
this.type = 'frame';
1212

1313
// Extract all the frame data into the frames array
14-
this.frames = GetFrames(manager.textureManager, GetObjectValue(config, 'frames', []));
14+
this.frames = GetFrames(manager.textureManager, GetValue(config, 'frames', []));
1515

1616
// The frame rate of playback in frames per second (default 24 if duration is null)
17-
this.frameRate = GetObjectValue(config, 'framerate', null);
17+
this.frameRate = GetValue(config, 'framerate', null);
1818

1919
// How long the animation should play for. If frameRate is set it overrides this value
2020
// otherwise frameRate is derived from duration
21-
this.duration = GetObjectValue(config, 'duration', null);
21+
this.duration = GetValue(config, 'duration', null);
2222

2323
if (this.duration === null && this.frameRate === null)
2424
{
@@ -45,42 +45,42 @@ var Animation = function (manager, key, config)
4545
this.msPerFrame = 1000 / this.frameRate;
4646

4747
// Skip frames if the time lags, or always advanced anyway?
48-
this.skipMissedFrames = GetObjectValue(config, 'skipMissedFrames', true);
48+
this.skipMissedFrames = GetValue(config, 'skipMissedFrames', true);
4949

5050
// Delay before starting playback (in seconds)
51-
this.delay = GetObjectValue(config, 'delay', 0);
51+
this.delay = GetValue(config, 'delay', 0);
5252

5353
// Number of times to repeat the animation (-1 for infinity)
54-
this.repeat = GetObjectValue(config, 'repeat', 0);
54+
this.repeat = GetValue(config, 'repeat', 0);
5555

5656
// Delay before the repeat starts (in seconds)
57-
this.repeatDelay = GetObjectValue(config, 'repeatDelay', 0);
57+
this.repeatDelay = GetValue(config, 'repeatDelay', 0);
5858

5959
// Should the animation yoyo? (reverse back down to the start) before repeating?
60-
this.yoyo = GetObjectValue(config, 'yoyo', false);
60+
this.yoyo = GetValue(config, 'yoyo', false);
6161

6262
// Should sprite.visible = true when the animation starts to play?
63-
this.showOnStart = GetObjectValue(config, 'showOnStart', false);
63+
this.showOnStart = GetValue(config, 'showOnStart', false);
6464

6565
// Should sprite.visible = false when the animation finishes?
66-
this.hideOnComplete = GetObjectValue(config, 'hideOnComplete', false);
66+
this.hideOnComplete = GetValue(config, 'hideOnComplete', false);
6767

6868
// Callbacks
69-
this.callbackScope = GetObjectValue(config, 'callbackScope', this);
69+
this.callbackScope = GetValue(config, 'callbackScope', this);
7070

71-
this.onStart = GetObjectValue(config, 'onStart', false);
72-
this.onStartParams = GetObjectValue(config, 'onStartParams', []);
71+
this.onStart = GetValue(config, 'onStart', false);
72+
this.onStartParams = GetValue(config, 'onStartParams', []);
7373

74-
this.onRepeat = GetObjectValue(config, 'onRepeat', false);
75-
this.onRepeatParams = GetObjectValue(config, 'onRepeatParams', []);
74+
this.onRepeat = GetValue(config, 'onRepeat', false);
75+
this.onRepeatParams = GetValue(config, 'onRepeatParams', []);
7676

7777
// Called for EVERY frame of the animation.
7878
// See AnimationFrame.onUpdate for a frame specific callback.
79-
this.onUpdate = GetObjectValue(config, 'onUpdate', false);
80-
this.onUpdateParams = GetObjectValue(config, 'onUpdateParams', []);
79+
this.onUpdate = GetValue(config, 'onUpdate', false);
80+
this.onUpdateParams = GetValue(config, 'onUpdateParams', []);
8181

82-
this.onComplete = GetObjectValue(config, 'onComplete', false);
83-
this.onCompleteParams = GetObjectValue(config, 'onCompleteParams', []);
82+
this.onComplete = GetValue(config, 'onComplete', false);
83+
this.onCompleteParams = GetValue(config, 'onCompleteParams', []);
8484
};
8585

8686
Animation.prototype.constructor = Animation;

v3/src/animation/frame/GetFrames.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var Frame = require('./Frame');
2-
var GetObjectValue = require('../../utils/object/GetObjectValue');
2+
var GetValue = require('../../utils/object/GetValue');
33

44
var GetFrames = function (textureManager, frames)
55
{
@@ -22,23 +22,23 @@ var GetFrames = function (textureManager, frames)
2222
{
2323
var item = frames[i];
2424

25-
var key = GetObjectValue(item, 'key', null);
25+
var key = GetValue(item, 'key', null);
2626

2727
if (!key)
2828
{
2929
continue;
3030
}
3131

32-
var frame = GetObjectValue(item, 'frame', 0);
32+
var frame = GetValue(item, 'frame', 0);
3333

3434
var textureFrame = textureManager.getFrame(key, frame);
3535

3636
animationFrame = new Frame(key, frame, index, textureFrame);
3737

38-
animationFrame.duration = GetObjectValue(item, 'duration', 0);
39-
animationFrame.onUpdate = GetObjectValue(item, 'onUpdate', null);
38+
animationFrame.duration = GetValue(item, 'duration', 0);
39+
animationFrame.onUpdate = GetValue(item, 'onUpdate', null);
4040

41-
var visible = GetObjectValue(item, 'visible', null);
41+
var visible = GetValue(item, 'visible', null);
4242

4343
if (visible !== null)
4444
{

v3/src/animation/manager/components/GenerateFrameNames.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
var GetObjectValue = require('../../../utils/object/GetObjectValue');
1+
var GetValue = require('../../../utils/object/GetValue');
22
var Pad = require('../../../utils/string/Pad');
33

44
var GenerateFrameNames = function (key, config)
55
{
6-
var prefix = GetObjectValue(config, 'prefix', '');
7-
var start = GetObjectValue(config, 'start', 0);
8-
var end = GetObjectValue(config, 'end', 0);
9-
var suffix = GetObjectValue(config, 'suffix', '');
10-
var zeroPad = GetObjectValue(config, 'zeroPad', 0);
11-
var out = GetObjectValue(config, 'framesArray', []);
6+
var prefix = GetValue(config, 'prefix', '');
7+
var start = GetValue(config, 'start', 0);
8+
var end = GetValue(config, 'end', 0);
9+
var suffix = GetValue(config, 'suffix', '');
10+
var zeroPad = GetValue(config, 'zeroPad', 0);
11+
var out = GetValue(config, 'framesArray', []);
1212

1313
var diff = (start < end) ? 1 : -1;
1414

v3/src/animation/manager/components/GenerateFrameNumbers.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
var GetObjectValue = require('../../../utils/object/GetObjectValue');
1+
var GetValue = require('../../../utils/object/GetValue');
22

33
var GenerateFrameNumbers = function (key, config)
44
{
5-
var startFrame = GetObjectValue(config, 'start', 0);
6-
var endFrame = GetObjectValue(config, 'end', -1);
7-
var firstFrame = GetObjectValue(config, 'first', false);
8-
var out = GetObjectValue(config, 'framesArray', []);
5+
var startFrame = GetValue(config, 'start', 0);
6+
var endFrame = GetValue(config, 'end', -1);
7+
var firstFrame = GetValue(config, 'first', false);
8+
var out = GetValue(config, 'framesArray', []);
99

1010
var texture = this.textureManager.get(key);
1111

v3/src/boot/Config.js

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
var MATH = require('../math');
88
var CONST = require('../const');
99
var NOOP = require('../utils/NOOP');
10-
var GetObjectValue = require('../utils/object/GetObjectValue');
10+
var GetValue = require('../utils/object/GetValue');
1111
var ValueToColor = require('../graphics/color/ValueToColor');
1212

1313
var defaultBannerColor = [
@@ -24,57 +24,57 @@ var Config = function (config)
2424
{
2525
if (config === undefined) { config = {}; }
2626

27-
this.width = GetObjectValue(config, 'width', 1024);
28-
this.height = GetObjectValue(config, 'height', 768);
29-
this.zoom = GetObjectValue(config, 'zoom', 1);
27+
this.width = GetValue(config, 'width', 1024);
28+
this.height = GetValue(config, 'height', 768);
29+
this.zoom = GetValue(config, 'zoom', 1);
3030

31-
this.resolution = GetObjectValue(config, 'resolution', 1);
31+
this.resolution = GetValue(config, 'resolution', 1);
3232

33-
this.renderType = GetObjectValue(config, 'type', CONST.AUTO);
33+
this.renderType = GetValue(config, 'type', CONST.AUTO);
3434

35-
this.parent = GetObjectValue(config, 'parent', null);
36-
this.canvas = GetObjectValue(config, 'canvas', null);
37-
this.canvasStyle = GetObjectValue(config, 'canvasStyle', null);
35+
this.parent = GetValue(config, 'parent', null);
36+
this.canvas = GetValue(config, 'canvas', null);
37+
this.canvasStyle = GetValue(config, 'canvasStyle', null);
3838

39-
this.stateConfig = GetObjectValue(config, 'state', null);
39+
this.stateConfig = GetValue(config, 'state', null);
4040

41-
this.seed = GetObjectValue(config, 'seed', [ (Date.now() * Math.random()).toString() ]);
41+
this.seed = GetValue(config, 'seed', [ (Date.now() * Math.random()).toString() ]);
4242

4343
MATH.RND.init(this.seed);
4444

45-
this.gameTitle = GetObjectValue(config, 'title', '');
46-
this.gameURL = GetObjectValue(config, 'url', 'http://phaser.io');
47-
this.gameVersion = GetObjectValue(config, 'version', '');
45+
this.gameTitle = GetValue(config, 'title', '');
46+
this.gameURL = GetValue(config, 'url', 'http://phaser.io');
47+
this.gameVersion = GetValue(config, 'version', '');
4848

4949
// Input
50-
this.inputKeyboard = GetObjectValue(config, 'input.keyboard', true);
51-
this.inputKeyboardEventTarget = GetObjectValue(config, 'input.keyboard.target', window);
50+
this.inputKeyboard = GetValue(config, 'input.keyboard', true);
51+
this.inputKeyboardEventTarget = GetValue(config, 'input.keyboard.target', window);
5252

5353
// If you do: { banner: false } it won't display any banner at all
54-
this.hideBanner = (GetObjectValue(config, 'banner', null) === false);
54+
this.hideBanner = (GetValue(config, 'banner', null) === false);
5555

56-
this.hidePhaser = GetObjectValue(config, 'banner.hidePhaser', false);
57-
this.bannerTextColor = GetObjectValue(config, 'banner.text', defaultBannerTextColor);
58-
this.bannerBackgroundColor = GetObjectValue(config, 'banner.background', defaultBannerColor);
56+
this.hidePhaser = GetValue(config, 'banner.hidePhaser', false);
57+
this.bannerTextColor = GetValue(config, 'banner.text', defaultBannerTextColor);
58+
this.bannerBackgroundColor = GetValue(config, 'banner.background', defaultBannerColor);
5959

60-
this.fps = GetObjectValue(config, 'fps', 60);
61-
this.forceSetTimeOut = GetObjectValue(config, 'forceSetTimeOut', false);
60+
this.fps = GetValue(config, 'fps', 60);
61+
this.forceSetTimeOut = GetValue(config, 'forceSetTimeOut', false);
6262

63-
this.pixelArt = GetObjectValue(config, 'pixelArt', false);
64-
this.transparent = GetObjectValue(config, 'transparent', false);
65-
this.clearBeforeRender = GetObjectValue(config, 'clearBeforeRender', true);
66-
this.backgroundColor = ValueToColor(GetObjectValue(config, 'backgroundColor', 0));
67-
this.preserveDrawingBuffer = ValueToColor(GetObjectValue(config, 'preserveDrawingBuffer', false));
63+
this.pixelArt = GetValue(config, 'pixelArt', false);
64+
this.transparent = GetValue(config, 'transparent', false);
65+
this.clearBeforeRender = GetValue(config, 'clearBeforeRender', true);
66+
this.backgroundColor = ValueToColor(GetValue(config, 'backgroundColor', 0));
67+
this.preserveDrawingBuffer = ValueToColor(GetValue(config, 'preserveDrawingBuffer', false));
6868

6969
// Callbacks
70-
this.preBoot = GetObjectValue(config, 'callbacks.preBoot', NOOP);
71-
this.postBoot = GetObjectValue(config, 'callbacks.postBoot', NOOP);
70+
this.preBoot = GetValue(config, 'callbacks.preBoot', NOOP);
71+
this.postBoot = GetValue(config, 'callbacks.postBoot', NOOP);
7272

7373
// Default / Missing Images
7474
var pngPrefix = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg';
7575

76-
this.defaultImage = GetObjectValue(config, 'images.default', pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg==');
77-
this.missingImage = GetObjectValue(config, 'images.missing', pngPrefix + 'CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg==');
76+
this.defaultImage = GetValue(config, 'images.default', pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg==');
77+
this.missingImage = GetValue(config, 'images.missing', pngPrefix + 'CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg==');
7878
};
7979

8080
Config.prototype.constructor = Config;

v3/src/gameobjects/graphics/Graphics.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var Components = require('../../components');
44
var Render = require('./GraphicsRender');
55
var Commands = require('./Commands');
66
var MATH_CONST = require('../../math/const');
7-
var GetObjectValue = require('../../utils/object/GetObjectValue');
7+
var GetValue = require('../../utils/object/GetValue');
88

99
var Graphics = new Class({
1010

@@ -23,8 +23,8 @@ var Graphics = new Class({
2323

2424
function Graphics (state, options)
2525
{
26-
var x = GetObjectValue(options, 'x', 0);
27-
var y = GetObjectValue(options, 'y', 0);
26+
var x = GetValue(options, 'x', 0);
27+
var y = GetValue(options, 'y', 0);
2828

2929
GameObject.call(this, state, 'Graphics');
3030

@@ -46,19 +46,19 @@ var Graphics = new Class({
4646

4747
setDefaultStyles: function (options)
4848
{
49-
if (GetObjectValue(options, 'lineStyle', null))
49+
if (GetValue(options, 'lineStyle', null))
5050
{
51-
this.defaultStrokeWidth = GetObjectValue(options, 'lineStyle.width', 1);
52-
this.defaultStrokeColor = GetObjectValue(options, 'lineStyle.color', 0xffffff);
53-
this.defaultStrokeAlpha = GetObjectValue(options, 'lineStyle.alpha', 1);
51+
this.defaultStrokeWidth = GetValue(options, 'lineStyle.width', 1);
52+
this.defaultStrokeColor = GetValue(options, 'lineStyle.color', 0xffffff);
53+
this.defaultStrokeAlpha = GetValue(options, 'lineStyle.alpha', 1);
5454

5555
this.lineStyle(this.defaultStrokeWidth, this.defaultStrokeColor, this.defaultStrokeAlpha);
5656
}
5757

58-
if (GetObjectValue(options, 'fillStyle', null))
58+
if (GetValue(options, 'fillStyle', null))
5959
{
60-
this.defaultFillColor = GetObjectValue(options, 'fillStyle.color', 0xffffff);
61-
this.defaultFillAlpha = GetObjectValue(options, 'fillStyle.alpha', 1);
60+
this.defaultFillColor = GetValue(options, 'fillStyle.color', 0xffffff);
61+
this.defaultFillAlpha = GetValue(options, 'fillStyle.alpha', 1);
6262

6363
this.fillStyle(this.defaultFillColor, this.defaultFillAlpha);
6464
}

0 commit comments

Comments
 (0)