melonjs 10.2.0 → 10.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/melonjs.js +4435 -4283
- package/dist/melonjs.min.js +4 -4
- package/dist/melonjs.module.d.ts +3348 -3833
- package/dist/melonjs.module.js +4025 -3920
- package/package.json +13 -14
- package/src/audio/audio.js +45 -45
- package/src/camera/camera2d.js +78 -101
- package/src/entity/draggable.js +21 -29
- package/src/entity/droptarget.js +24 -31
- package/src/entity/entity.js +34 -38
- package/src/game.js +8 -8
- package/src/{shapes → geometries}/ellipse.js +46 -46
- package/src/{shapes → geometries}/line.js +14 -14
- package/src/{shapes → geometries}/poly.js +103 -54
- package/src/{shapes → geometries}/rectangle.js +73 -120
- package/src/index.js +18 -19
- package/src/input/gamepad.js +20 -20
- package/src/input/input.js +3 -3
- package/src/input/keyboard.js +122 -124
- package/src/input/pointer.js +102 -62
- package/src/input/pointerevent.js +97 -42
- package/src/lang/deprecated.js +29 -18
- package/src/level/level.js +34 -26
- package/src/level/tiled/TMXGroup.js +12 -13
- package/src/level/tiled/TMXLayer.js +41 -42
- package/src/level/tiled/TMXObject.js +76 -70
- package/src/level/tiled/TMXTile.js +13 -15
- package/src/level/tiled/TMXTileMap.js +26 -25
- package/src/level/tiled/TMXTileset.js +14 -15
- package/src/level/tiled/TMXTilesetGroup.js +5 -6
- package/src/level/tiled/TMXUtils.js +13 -11
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +3 -4
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +3 -4
- package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +2 -3
- package/src/level/tiled/renderer/TMXRenderer.js +18 -19
- package/src/level/tiled/renderer/TMXStaggeredRenderer.js +2 -3
- package/src/loader/loader.js +46 -40
- package/src/loader/loadingscreen.js +7 -7
- package/src/math/color.js +68 -88
- package/src/math/math.js +33 -33
- package/src/math/matrix2.js +70 -71
- package/src/math/matrix3.js +90 -91
- package/src/math/observable_vector2.js +91 -92
- package/src/math/observable_vector3.js +110 -106
- package/src/math/vector2.js +116 -104
- package/src/math/vector3.js +129 -110
- package/src/particles/emitter.js +116 -126
- package/src/particles/particle.js +4 -5
- package/src/particles/particlecontainer.js +2 -3
- package/src/physics/body.js +82 -83
- package/src/physics/bounds.js +64 -66
- package/src/physics/collision.js +21 -22
- package/src/physics/detector.js +13 -13
- package/src/physics/quadtree.js +26 -25
- package/src/physics/sat.js +21 -21
- package/src/physics/world.js +23 -22
- package/src/plugin/plugin.js +12 -13
- package/src/renderable/GUI.js +20 -26
- package/src/renderable/collectable.js +6 -7
- package/src/renderable/colorlayer.js +11 -12
- package/src/renderable/container.js +98 -81
- package/src/renderable/imagelayer.js +33 -35
- package/src/renderable/nineslicesprite.js +15 -16
- package/src/renderable/renderable.js +112 -111
- package/src/renderable/sprite.js +71 -58
- package/src/renderable/trigger.js +17 -19
- package/src/state/stage.js +14 -15
- package/src/state/state.js +78 -78
- package/src/system/device.js +137 -180
- package/src/system/event.js +116 -104
- package/src/system/pooling.js +15 -15
- package/src/system/save.js +9 -6
- package/src/system/timer.js +33 -33
- package/src/text/bitmaptext.js +39 -46
- package/src/text/bitmaptextdata.js +14 -15
- package/src/text/text.js +55 -58
- package/src/tweens/easing.js +5 -5
- package/src/tweens/interpolation.js +5 -5
- package/src/tweens/tween.js +49 -40
- package/src/utils/agent.js +12 -11
- package/src/utils/array.js +8 -8
- package/src/utils/file.js +7 -7
- package/src/utils/function.js +8 -8
- package/src/utils/string.js +19 -19
- package/src/utils/utils.js +23 -23
- package/src/video/canvas/canvas_renderer.js +127 -128
- package/src/video/renderer.js +69 -69
- package/src/video/texture.js +80 -82
- package/src/video/texture_cache.js +2 -4
- package/src/video/video.js +38 -38
- package/src/video/webgl/buffer/vertex.js +11 -3
- package/src/video/webgl/glshader.js +31 -32
- package/src/video/webgl/webgl_compositor.js +145 -127
- package/src/video/webgl/webgl_renderer.js +196 -175
package/src/system/timer.js
CHANGED
|
@@ -88,7 +88,7 @@ event.on(event.BOOT, () => {
|
|
|
88
88
|
/**
|
|
89
89
|
* a Timer class to manage timing related function (FPS, Game Tick, Time...)
|
|
90
90
|
* @namespace me.timer
|
|
91
|
-
* @
|
|
91
|
+
* @memberof me
|
|
92
92
|
*/
|
|
93
93
|
var timer = {
|
|
94
94
|
|
|
@@ -100,9 +100,9 @@ var timer = {
|
|
|
100
100
|
* use it.
|
|
101
101
|
* @public
|
|
102
102
|
* @see me.timer.interpolation
|
|
103
|
-
* @type {
|
|
103
|
+
* @type {number}
|
|
104
104
|
* @name tick
|
|
105
|
-
* @
|
|
105
|
+
* @memberof me.timer
|
|
106
106
|
*/
|
|
107
107
|
tick : 1.0,
|
|
108
108
|
|
|
@@ -110,9 +110,9 @@ var timer = {
|
|
|
110
110
|
* Last measured fps rate.<br/>
|
|
111
111
|
* This feature is disabled by default, unless the debugPanel is enabled/visible
|
|
112
112
|
* @public
|
|
113
|
-
* @type {
|
|
113
|
+
* @type {number}
|
|
114
114
|
* @name fps
|
|
115
|
-
* @
|
|
115
|
+
* @memberof me.timer
|
|
116
116
|
*/
|
|
117
117
|
fps : 0,
|
|
118
118
|
|
|
@@ -120,27 +120,27 @@ var timer = {
|
|
|
120
120
|
* Set the maximum target display frame per second
|
|
121
121
|
* @public
|
|
122
122
|
* @see me.timer.tick
|
|
123
|
-
* @type {
|
|
123
|
+
* @type {number}
|
|
124
124
|
* @name maxfps
|
|
125
125
|
* @default 60
|
|
126
|
-
* @
|
|
126
|
+
* @memberof me.timer
|
|
127
127
|
*/
|
|
128
128
|
maxfps : 60,
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
131
|
* Enable/disable frame interpolation
|
|
132
132
|
* @see me.timer.tick
|
|
133
|
-
* @type {
|
|
133
|
+
* @type {boolean}
|
|
134
134
|
* @default false
|
|
135
135
|
* @name interpolation
|
|
136
|
-
* @
|
|
136
|
+
* @memberof me.timer
|
|
137
137
|
*/
|
|
138
138
|
interpolation : false,
|
|
139
139
|
|
|
140
140
|
/**
|
|
141
141
|
* reset time (e.g. usefull in case of pause)
|
|
142
142
|
* @name reset
|
|
143
|
-
* @
|
|
143
|
+
* @memberof me.timer
|
|
144
144
|
* @ignore
|
|
145
145
|
* @function
|
|
146
146
|
*/
|
|
@@ -159,12 +159,12 @@ var timer = {
|
|
|
159
159
|
/**
|
|
160
160
|
* Calls a function once after a specified delay. See me.timer.setInterval to repeativly call a function.
|
|
161
161
|
* @name setTimeout
|
|
162
|
-
* @
|
|
162
|
+
* @memberof me.timer
|
|
163
163
|
* @param {Function} fn the function you want to execute after delay milliseconds.
|
|
164
|
-
* @param {
|
|
165
|
-
* @param {
|
|
166
|
-
* @param {
|
|
167
|
-
* @
|
|
164
|
+
* @param {number} delay the number of milliseconds (thousandths of a second) that the function call should be delayed by.
|
|
165
|
+
* @param {boolean} [pauseable=true] respects the pause state of the engine.
|
|
166
|
+
* @param {object} [args] optional parameters which are passed through to the function specified by fn once the timer expires.
|
|
167
|
+
* @returns {number} The numerical ID of the timer, which can be used later with me.timer.clearTimeout().
|
|
168
168
|
* @function
|
|
169
169
|
* @example
|
|
170
170
|
* // set a timer to call "myFunction" after 1000ms
|
|
@@ -172,7 +172,7 @@ var timer = {
|
|
|
172
172
|
* // set a timer to call "myFunction" after 1000ms (respecting the pause state) and passing param1 and param2
|
|
173
173
|
* me.timer.setTimeout(myFunction, 1000, true, param1, param2);
|
|
174
174
|
*/
|
|
175
|
-
setTimeout(fn, delay, pauseable) {
|
|
175
|
+
setTimeout(fn, delay, pauseable, ...args) {
|
|
176
176
|
timers.push({
|
|
177
177
|
fn : fn,
|
|
178
178
|
delay : delay,
|
|
@@ -180,7 +180,7 @@ var timer = {
|
|
|
180
180
|
repeat : false,
|
|
181
181
|
timerId : ++timerId,
|
|
182
182
|
pauseable : pauseable === true || true,
|
|
183
|
-
args :
|
|
183
|
+
args : args
|
|
184
184
|
});
|
|
185
185
|
return timerId;
|
|
186
186
|
},
|
|
@@ -188,12 +188,12 @@ var timer = {
|
|
|
188
188
|
/**
|
|
189
189
|
* Calls a function continously at the specified interval. See setTimeout to call function a single time.
|
|
190
190
|
* @name setInterval
|
|
191
|
-
* @
|
|
191
|
+
* @memberof me.timer
|
|
192
192
|
* @param {Function} fn the function to execute
|
|
193
|
-
* @param {
|
|
194
|
-
* @param {
|
|
195
|
-
* @param {
|
|
196
|
-
* @
|
|
193
|
+
* @param {number} delay the number of milliseconds (thousandths of a second) on how often to execute the function
|
|
194
|
+
* @param {boolean} [pauseable=true] respects the pause state of the engine.
|
|
195
|
+
* @param {object} [args] optional parameters which are passed through to the function specified by fn once the timer expires.
|
|
196
|
+
* @returns {number} The numerical ID of the timer, which can be used later with me.timer.clearInterval().
|
|
197
197
|
* @function
|
|
198
198
|
* @example
|
|
199
199
|
* // set a timer to call "myFunction" every 1000ms
|
|
@@ -201,7 +201,7 @@ var timer = {
|
|
|
201
201
|
* // set a timer to call "myFunction" every 1000ms (respecting the pause state) and passing param1 and param2
|
|
202
202
|
* me.timer.setInterval(myFunction, 1000, true, param1, param2);
|
|
203
203
|
*/
|
|
204
|
-
setInterval(fn, delay, pauseable) {
|
|
204
|
+
setInterval(fn, delay, pauseable, ...args) {
|
|
205
205
|
timers.push({
|
|
206
206
|
fn : fn,
|
|
207
207
|
delay : delay,
|
|
@@ -209,7 +209,7 @@ var timer = {
|
|
|
209
209
|
repeat : true,
|
|
210
210
|
timerId : ++timerId,
|
|
211
211
|
pauseable : pauseable === true || true,
|
|
212
|
-
args :
|
|
212
|
+
args : args
|
|
213
213
|
});
|
|
214
214
|
return timerId;
|
|
215
215
|
},
|
|
@@ -217,9 +217,9 @@ var timer = {
|
|
|
217
217
|
/**
|
|
218
218
|
* Clears the delay set by me.timer.setTimeout().
|
|
219
219
|
* @name clearTimeout
|
|
220
|
-
* @
|
|
220
|
+
* @memberof me.timer
|
|
221
221
|
* @function
|
|
222
|
-
* @param {
|
|
222
|
+
* @param {number} timeoutID ID of the timeout to be cleared
|
|
223
223
|
*/
|
|
224
224
|
clearTimeout(timeoutID) {
|
|
225
225
|
utils.function.defer(clearTimer, this, timeoutID);
|
|
@@ -228,9 +228,9 @@ var timer = {
|
|
|
228
228
|
/**
|
|
229
229
|
* Clears the Interval set by me.timer.setInterval().
|
|
230
230
|
* @name clearInterval
|
|
231
|
-
* @
|
|
231
|
+
* @memberof me.timer
|
|
232
232
|
* @function
|
|
233
|
-
* @param {
|
|
233
|
+
* @param {number} intervalID ID of the interval to be cleared
|
|
234
234
|
*/
|
|
235
235
|
clearInterval(intervalID) {
|
|
236
236
|
utils.function.defer(clearTimer, this, intervalID);
|
|
@@ -240,8 +240,8 @@ var timer = {
|
|
|
240
240
|
* Return the current timestamp in milliseconds <br>
|
|
241
241
|
* since the game has started or since linux epoch (based on browser support for High Resolution Timer)
|
|
242
242
|
* @name getTime
|
|
243
|
-
* @
|
|
244
|
-
* @
|
|
243
|
+
* @memberof me.timer
|
|
244
|
+
* @returns {number}
|
|
245
245
|
* @function
|
|
246
246
|
*/
|
|
247
247
|
getTime() {
|
|
@@ -251,8 +251,8 @@ var timer = {
|
|
|
251
251
|
/**
|
|
252
252
|
* Return elapsed time in milliseconds since the last update
|
|
253
253
|
* @name getDelta
|
|
254
|
-
* @
|
|
255
|
-
* @
|
|
254
|
+
* @memberof me.timer
|
|
255
|
+
* @returns {number}
|
|
256
256
|
* @function
|
|
257
257
|
*/
|
|
258
258
|
getDelta() {
|
|
@@ -263,7 +263,7 @@ var timer = {
|
|
|
263
263
|
* compute the actual frame time and fps rate
|
|
264
264
|
* @name computeFPS
|
|
265
265
|
* @ignore
|
|
266
|
-
* @
|
|
266
|
+
* @memberof me.timer
|
|
267
267
|
* @function
|
|
268
268
|
*/
|
|
269
269
|
countFPS() {
|
package/src/text/bitmaptext.js
CHANGED
|
@@ -35,21 +35,21 @@ var measureTextHeight = function(font) {
|
|
|
35
35
|
* @classdesc
|
|
36
36
|
* a bitmap font object
|
|
37
37
|
* @class BitmapText
|
|
38
|
-
* @
|
|
39
|
-
* @
|
|
40
|
-
* @
|
|
41
|
-
* @param {
|
|
42
|
-
* @param {
|
|
43
|
-
* @param {
|
|
44
|
-
* @param {
|
|
45
|
-
* @param {
|
|
46
|
-
* @param {me.Color|
|
|
47
|
-
* @param {
|
|
48
|
-
* @param {
|
|
49
|
-
* @param {
|
|
50
|
-
* @param {
|
|
38
|
+
* @augments me.Renderable
|
|
39
|
+
* @memberof me
|
|
40
|
+
* @param {number} x position of the text object
|
|
41
|
+
* @param {number} y position of the text object
|
|
42
|
+
* @param {object} settings the text configuration
|
|
43
|
+
* @param {string|Image} settings.font a font name to identify the corresponing source image
|
|
44
|
+
* @param {string} [settings.fontData=settings.font] the bitmap font data corresponding name, or the bitmap font data itself
|
|
45
|
+
* @param {number} [settings.size] size a scaling ratio
|
|
46
|
+
* @param {me.Color|string} [settings.fillStyle] a CSS color value used to tint the bitmapText (@see me.BitmapText.tint)
|
|
47
|
+
* @param {number} [settings.lineWidth=1] line width, in pixels, when drawing stroke
|
|
48
|
+
* @param {string} [settings.textAlign="left"] horizontal text alignment
|
|
49
|
+
* @param {string} [settings.textBaseline="top"] the text baseline
|
|
50
|
+
* @param {number} [settings.lineHeight=1.0] line spacing height
|
|
51
51
|
* @param {me.Vector2d} [settings.anchorPoint={x:0.0, y:0.0}] anchor point to draw the text at
|
|
52
|
-
* @param {(
|
|
52
|
+
* @param {(string|string[])} [settings.text] a string, or an array of strings
|
|
53
53
|
* @example
|
|
54
54
|
* // Use me.loader.preload or me.loader.load to load assets
|
|
55
55
|
* me.loader.preload([
|
|
@@ -76,10 +76,10 @@ class BitmapText extends Renderable {
|
|
|
76
76
|
* Set the default text alignment (or justification),<br>
|
|
77
77
|
* possible values are "left", "right", and "center".
|
|
78
78
|
* @public
|
|
79
|
-
* @type
|
|
79
|
+
* @type {string}
|
|
80
80
|
* @default "left"
|
|
81
81
|
* @name textAlign
|
|
82
|
-
* @
|
|
82
|
+
* @memberof me.BitmapText
|
|
83
83
|
*/
|
|
84
84
|
this.textAlign = settings.textAlign || "left";
|
|
85
85
|
|
|
@@ -87,10 +87,10 @@ class BitmapText extends Renderable {
|
|
|
87
87
|
* Set the text baseline (e.g. the Y-coordinate for the draw operation), <br>
|
|
88
88
|
* possible values are "top", "hanging, "middle, "alphabetic, "ideographic, "bottom"<br>
|
|
89
89
|
* @public
|
|
90
|
-
* @type
|
|
90
|
+
* @type {string}
|
|
91
91
|
* @default "top"
|
|
92
92
|
* @name textBaseline
|
|
93
|
-
* @
|
|
93
|
+
* @memberof me.BitmapText
|
|
94
94
|
*/
|
|
95
95
|
this.textBaseline = settings.textBaseline || "top";
|
|
96
96
|
|
|
@@ -98,19 +98,19 @@ class BitmapText extends Renderable {
|
|
|
98
98
|
* Set the line spacing height (when displaying multi-line strings). <br>
|
|
99
99
|
* Current font height will be multiplied with this value to set the line height.
|
|
100
100
|
* @public
|
|
101
|
-
* @type
|
|
101
|
+
* @type {number}
|
|
102
102
|
* @default 1.0
|
|
103
103
|
* @name lineHeight
|
|
104
|
-
* @
|
|
104
|
+
* @memberof me.BitmapText
|
|
105
105
|
*/
|
|
106
106
|
this.lineHeight = settings.lineHeight || 1.0;
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
109
|
* the text to be displayed
|
|
110
110
|
* @private
|
|
111
|
-
* @type {
|
|
111
|
+
* @type {string[]}
|
|
112
112
|
* @name _text
|
|
113
|
-
* @
|
|
113
|
+
* @memberof me.BitmapText
|
|
114
114
|
*/
|
|
115
115
|
this._text = [];
|
|
116
116
|
|
|
@@ -165,11 +165,11 @@ class BitmapText extends Renderable {
|
|
|
165
165
|
/**
|
|
166
166
|
* change the font settings
|
|
167
167
|
* @name set
|
|
168
|
-
* @
|
|
168
|
+
* @memberof me.BitmapText.prototype
|
|
169
169
|
* @function
|
|
170
|
-
* @param {
|
|
171
|
-
* @param {
|
|
172
|
-
* @
|
|
170
|
+
* @param {string} textAlign ("left", "center", "right")
|
|
171
|
+
* @param {number} [scale]
|
|
172
|
+
* @returns {me.BitmapText} this object for chaining
|
|
173
173
|
*/
|
|
174
174
|
set(textAlign, scale) {
|
|
175
175
|
this.textAlign = textAlign;
|
|
@@ -185,10 +185,10 @@ class BitmapText extends Renderable {
|
|
|
185
185
|
/**
|
|
186
186
|
* change the text to be displayed
|
|
187
187
|
* @name setText
|
|
188
|
-
* @
|
|
188
|
+
* @memberof me.BitmapText.prototype
|
|
189
189
|
* @function
|
|
190
|
-
* @param {
|
|
191
|
-
* @
|
|
190
|
+
* @param {number|string|string[]} value a string, or an array of strings
|
|
191
|
+
* @returns {me.BitmapText} this object for chaining
|
|
192
192
|
*/
|
|
193
193
|
setText(value) {
|
|
194
194
|
if (typeof value === "undefined") {
|
|
@@ -213,18 +213,11 @@ class BitmapText extends Renderable {
|
|
|
213
213
|
* @type {me.Color}
|
|
214
214
|
* @name fillStyle
|
|
215
215
|
* @see me.Renderable#tint
|
|
216
|
-
* @
|
|
217
|
-
*/
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* @ignore
|
|
216
|
+
* @memberof me.BitmapText
|
|
221
217
|
*/
|
|
222
218
|
get fillStyle() {
|
|
223
219
|
return this.tint;
|
|
224
220
|
}
|
|
225
|
-
/**
|
|
226
|
-
* @ignore
|
|
227
|
-
*/
|
|
228
221
|
set fillStyle(value) {
|
|
229
222
|
this.tint = value;
|
|
230
223
|
}
|
|
@@ -232,10 +225,10 @@ class BitmapText extends Renderable {
|
|
|
232
225
|
/**
|
|
233
226
|
* change the font display size
|
|
234
227
|
* @name resize
|
|
235
|
-
* @
|
|
228
|
+
* @memberof me.BitmapText.prototype
|
|
236
229
|
* @function
|
|
237
|
-
* @param {
|
|
238
|
-
* @
|
|
230
|
+
* @param {number} scale ratio
|
|
231
|
+
* @returns {me.BitmapText} this object for chaining
|
|
239
232
|
*/
|
|
240
233
|
resize(scale) {
|
|
241
234
|
this.fontScale.set(scale, scale);
|
|
@@ -248,9 +241,9 @@ class BitmapText extends Renderable {
|
|
|
248
241
|
/**
|
|
249
242
|
* measure the given text size in pixels
|
|
250
243
|
* @name measureText
|
|
251
|
-
* @
|
|
244
|
+
* @memberof me.BitmapText.prototype
|
|
252
245
|
* @function
|
|
253
|
-
* @param {
|
|
246
|
+
* @param {string} [text]
|
|
254
247
|
* @param {me.Rect} [ret] a object in which to store the text metrics
|
|
255
248
|
* @returns {TextMetrics} a TextMetrics object with two properties: `width` and `height`, defining the output dimensions
|
|
256
249
|
*/
|
|
@@ -283,12 +276,12 @@ class BitmapText extends Renderable {
|
|
|
283
276
|
/**
|
|
284
277
|
* draw the bitmap font
|
|
285
278
|
* @name draw
|
|
286
|
-
* @
|
|
279
|
+
* @memberof me.BitmapText.prototype
|
|
287
280
|
* @function
|
|
288
281
|
* @param {me.CanvasRenderer|me.WebGLRenderer} renderer Reference to the destination renderer instance
|
|
289
|
-
* @param {
|
|
290
|
-
* @param {
|
|
291
|
-
* @param {
|
|
282
|
+
* @param {string} [text]
|
|
283
|
+
* @param {number} [x]
|
|
284
|
+
* @param {number} [y]
|
|
292
285
|
*/
|
|
293
286
|
draw(renderer, text, x, y) {
|
|
294
287
|
// save the previous global alpha value
|
|
@@ -5,7 +5,7 @@ var capChars = ["M", "N", "B", "D", "C", "E", "F", "K", "A", "G", "H", "I", "J",
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Gets the value from a string of pairs.
|
|
8
|
-
* @
|
|
8
|
+
* @ignore
|
|
9
9
|
*/
|
|
10
10
|
function getValueFromPair(string, pattern) {
|
|
11
11
|
var value = string.match(pattern);
|
|
@@ -18,11 +18,11 @@ function getValueFromPair(string, pattern) {
|
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Gets the first glyph in the map that is not a space character
|
|
21
|
-
* @
|
|
21
|
+
* @ignore
|
|
22
22
|
* @name _getFirstGlyph
|
|
23
|
-
* @
|
|
23
|
+
* @memberof me.BitmapTextData
|
|
24
24
|
* @function
|
|
25
|
-
* @param {
|
|
25
|
+
* @param {object} glyphs the map of glyphs, each key is a char code
|
|
26
26
|
* @returns {me.Glyph}
|
|
27
27
|
*/
|
|
28
28
|
function getFirstGlyph(glyphs) {
|
|
@@ -37,11 +37,11 @@ function getFirstGlyph(glyphs) {
|
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Creates a glyph to use for the space character
|
|
40
|
-
* @
|
|
40
|
+
* @ignore
|
|
41
41
|
* @name createSpaceGlyph
|
|
42
|
-
* @
|
|
42
|
+
* @memberof me.BitmapTextData
|
|
43
43
|
* @function
|
|
44
|
-
* @param {
|
|
44
|
+
* @param {object} glyphs the map of glyphs, each key is a char code
|
|
45
45
|
*/
|
|
46
46
|
function createSpaceGlyph(glyphs) {
|
|
47
47
|
var spaceCharCode = " ".charCodeAt(0);
|
|
@@ -59,10 +59,9 @@ function createSpaceGlyph(glyphs) {
|
|
|
59
59
|
/**
|
|
60
60
|
* Class for storing relevant data from the font file.
|
|
61
61
|
* @class me.BitmapTextData
|
|
62
|
-
* @
|
|
63
|
-
* @
|
|
64
|
-
* @param data {
|
|
65
|
-
* @constructor
|
|
62
|
+
* @memberof me
|
|
63
|
+
* @ignore
|
|
64
|
+
* @param data {string} - The bitmap font data pulled from the resource loader using me.loader.getBinary()
|
|
66
65
|
*/
|
|
67
66
|
class BitmapTextData {
|
|
68
67
|
|
|
@@ -88,8 +87,8 @@ class BitmapTextData {
|
|
|
88
87
|
/**
|
|
89
88
|
* The map of glyphs, each key is a char code.
|
|
90
89
|
* @name glyphs
|
|
91
|
-
* @type {
|
|
92
|
-
* @
|
|
90
|
+
* @type {object}
|
|
91
|
+
* @memberof me.BitmapTextData
|
|
93
92
|
*/
|
|
94
93
|
this.glyphs = {};
|
|
95
94
|
|
|
@@ -100,9 +99,9 @@ class BitmapTextData {
|
|
|
100
99
|
/**
|
|
101
100
|
* This parses the font data text and builds a map of glyphs containing the data for each character
|
|
102
101
|
* @name parse
|
|
103
|
-
* @
|
|
102
|
+
* @memberof me.BitmapTextData
|
|
104
103
|
* @function
|
|
105
|
-
* @param {
|
|
104
|
+
* @param {string} fontData
|
|
106
105
|
*/
|
|
107
106
|
parse(fontData) {
|
|
108
107
|
if (!fontData) {
|