littlejsengine 1.8.4 → 1.8.6

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.
@@ -307,10 +307,10 @@ constructor(pos, size=tileCollisionSize, tileInfo=tile(), scale=vec2(1), renderO
307
307
  /** Draw directly to the 2D canvas in world space (bipass webgl)
308
308
  * @param {Vector2} pos
309
309
  * @param {Vector2} size
310
- * @param {Number} [angle=0]
311
- * @param {Boolean} [mirror=0]
310
+ * @param {Number} angle
311
+ * @param {Boolean} mirror
312
312
  * @param {Function} drawFunction */
313
- drawCanvas2D(pos, size, angle=0, mirror, drawFunction)
313
+ drawCanvas2D(pos, size, angle, mirror, drawFunction)
314
314
  {
315
315
  const context = this.context;
316
316
  context.save();
@@ -324,12 +324,12 @@ constructor(pos, size=tileCollisionSize, tileInfo=tile(), scale=vec2(1), renderO
324
324
  }
325
325
 
326
326
  /** Draw a tile directly onto the layer canvas
327
- * @param {Vector2} pos
328
- * @param {Vector2} [size=Vector2(1,1)]
327
+ * @param {Vector2} pos
328
+ * @param {Vector2} [size=Vector2(1,1)]
329
329
  * @param {TileInfo} [tileInfo]
330
- * @param {Color} [color=Color()]
331
- * @param {Number} [angle=0]
332
- * @param {Boolean} [mirror=0] */
330
+ * @param {Color} [color=Color()]
331
+ * @param {Number} [angle=0]
332
+ * @param {Boolean} [mirror=0] */
333
333
  drawTile(pos, size=vec2(1), tileInfo, color=new Color, angle, mirror)
334
334
  {
335
335
  this.drawCanvas2D(pos, size, angle, mirror, (context)=>
@@ -407,7 +407,7 @@ class Vector2
407
407
  arrayCheck(arraySize) { return this.x >= 0 && this.y >= 0 && this.x < arraySize.x && this.y < arraySize.y; }
408
408
 
409
409
  /** Returns this vector expressed as a string
410
- * @param {float} digits - precision to display
410
+ * @param {Number} digits - precision to display
411
411
  * @return {String} */
412
412
  toString(digits=3)
413
413
  { if (debug) { return `(${(this.x<0?'':' ') + this.x.toFixed(digits)},${(this.y<0?'':' ') + this.y.toFixed(digits)} )`; }}
@@ -161,7 +161,7 @@ function glCreateProgram(vsSource, fsSource)
161
161
  return program;
162
162
  }
163
163
 
164
- /** Create WebGL texture from an image and set the texture settings
164
+ /** Create WebGL texture from an image and init the texture settings
165
165
  * @param {Image} image
166
166
  * @return {WebGLTexture}
167
167
  * @memberof WebGL */
@@ -170,7 +170,8 @@ function glCreateTexture(image)
170
170
  // build the texture
171
171
  const texture = glContext.createTexture();
172
172
  glContext.bindTexture(gl_TEXTURE_2D, texture);
173
- image && image.width && glContext.texImage2D(gl_TEXTURE_2D, 0, gl_RGBA, gl_RGBA, gl_UNSIGNED_BYTE, image);
173
+ if (image)
174
+ glContext.texImage2D(gl_TEXTURE_2D, 0, gl_RGBA, gl_RGBA, gl_UNSIGNED_BYTE, image);
174
175
 
175
176
  // use point filtering for pixelated rendering
176
177
  const filter = canvasPixelated ? gl_NEAREST : gl_LINEAR;