repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
melonjs/melonJS
dist/melonjs.js
measureTextHeight
function measureTextHeight(font) { return font.fontData.capHeight * font.lineHeight * font.fontScale.y; }
javascript
function measureTextHeight(font) { return font.fontData.capHeight * font.lineHeight * font.fontScale.y; }
[ "function", "measureTextHeight", "(", "font", ")", "{", "return", "font", ".", "fontData", ".", "capHeight", "*", "font", ".", "lineHeight", "*", "font", ".", "fontScale", ".", "y", ";", "}" ]
Measures the height of a single line of text, does not account for \n @ignore
[ "Measures", "the", "height", "of", "a", "single", "line", "of", "text", "does", "not", "account", "for", "\\", "n" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L15497-L15499
train
melonjs/melonJS
dist/melonjs.js
set
function set(textAlign, scale) { this.textAlign = textAlign; // updated scaled Size if (scale) { this.resize(scale); } this.isDirty = true; return this; }
javascript
function set(textAlign, scale) { this.textAlign = textAlign; // updated scaled Size if (scale) { this.resize(scale); } this.isDirty = true; return this; }
[ "function", "set", "(", "textAlign", ",", "scale", ")", "{", "this", ".", "textAlign", "=", "textAlign", ";", "// updated scaled Size", "if", "(", "scale", ")", "{", "this", ".", "resize", "(", "scale", ")", ";", "}", "this", ".", "isDirty", "=", "true...
change the font settings @name set @memberOf me.BitmapText.prototype @function @param {String} textAlign ("left", "center", "right") @param {Number} [scale] @return this object for chaining
[ "change", "the", "font", "settings" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L15616-L15625
train
melonjs/melonJS
dist/melonjs.js
draw
function draw(renderer, text, x, y) { // allows to provide backward compatibility when // adding Bitmap Font to an object container if (typeof this.ancestor === "undefined") { // update cache this.setText(text); // force update bounds this.update(0); // save ...
javascript
function draw(renderer, text, x, y) { // allows to provide backward compatibility when // adding Bitmap Font to an object container if (typeof this.ancestor === "undefined") { // update cache this.setText(text); // force update bounds this.update(0); // save ...
[ "function", "draw", "(", "renderer", ",", "text", ",", "x", ",", "y", ")", "{", "// allows to provide backward compatibility when", "// adding Bitmap Font to an object container", "if", "(", "typeof", "this", ".", "ancestor", "===", "\"undefined\"", ")", "{", "// upda...
draw the bitmap font @name draw @memberOf me.BitmapText.prototype @function @param {me.CanvasRenderer|me.WebGLRenderer} renderer Reference to the destination renderer instance @param {String} [text] @param {Number} [x] @param {Number} [y]
[ "draw", "the", "bitmap", "font" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L15713-L15816
train
melonjs/melonJS
dist/melonjs.js
_getFirstGlyph
function _getFirstGlyph() { var keys = Object.keys(this.glyphs); for (var i = 0; i < keys.length; i++) { if (keys[i] > 32) { return this.glyphs[keys[i]]; } } return null; }
javascript
function _getFirstGlyph() { var keys = Object.keys(this.glyphs); for (var i = 0; i < keys.length; i++) { if (keys[i] > 32) { return this.glyphs[keys[i]]; } } return null; }
[ "function", "_getFirstGlyph", "(", ")", "{", "var", "keys", "=", "Object", ".", "keys", "(", "this", ".", "glyphs", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "keys", ".", "length", ";", "i", "++", ")", "{", "if", "(", "keys", ...
Gets the first glyph in the map that is not a space character @private @name _getFirstGlyph @memberOf me.BitmapTextData @function @returns {me.Glyph}
[ "Gets", "the", "first", "glyph", "in", "the", "map", "that", "is", "not", "a", "space", "character" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L15958-L15968
train
melonjs/melonJS
dist/melonjs.js
function(id, internal) { var self = this; // If the sound hasn't loaded, add it to the load queue to stop when capable. if (self._state !== 'loaded' || self._playLock) { self._queue.push({ event: 'stop', action: function() { self.stop(id); ...
javascript
function(id, internal) { var self = this; // If the sound hasn't loaded, add it to the load queue to stop when capable. if (self._state !== 'loaded' || self._playLock) { self._queue.push({ event: 'stop', action: function() { self.stop(id); ...
[ "function", "(", "id", ",", "internal", ")", "{", "var", "self", "=", "this", ";", "// If the sound hasn't loaded, add it to the load queue to stop when capable.", "if", "(", "self", ".", "_state", "!==", "'loaded'", "||", "self", ".", "_playLock", ")", "{", "self...
Stop playback and reset to start. @param {Number} id The sound ID (empty to stop all in group). @param {Boolean} internal Internal Use: true prevents event firing. @return {Howl}
[ "Stop", "playback", "and", "reset", "to", "start", "." ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L17140-L17201
train
melonjs/melonJS
dist/melonjs.js
function() { var self = this; // Stop playing any active sounds. var sounds = self._sounds; for (var i=0; i<sounds.length; i++) { // Stop the sound if it is currently playing. if (!sounds[i]._paused) { self.stop(sounds[i]._id); } ...
javascript
function() { var self = this; // Stop playing any active sounds. var sounds = self._sounds; for (var i=0; i<sounds.length; i++) { // Stop the sound if it is currently playing. if (!sounds[i]._paused) { self.stop(sounds[i]._id); } ...
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "// Stop playing any active sounds.", "var", "sounds", "=", "self", ".", "_sounds", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "sounds", ".", "length", ";", "i", "++", ")", "{", ...
Unload and destroy the current Howl object. This will immediately stop all sound instances attached to this group.
[ "Unload", "and", "destroy", "the", "current", "Howl", "object", ".", "This", "will", "immediately", "stop", "all", "sound", "instances", "attached", "to", "this", "group", "." ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L17792-L17854
train
melonjs/melonJS
dist/melonjs.js
soundLoadError
function soundLoadError(sound_name, onerror_cb) { // check the retry counter if (retry_counter++ > 3) { // something went wrong var errmsg = "melonJS: failed loading " + sound_name; if (me.sys.stopOnAudioError === false) { // disable audio me...
javascript
function soundLoadError(sound_name, onerror_cb) { // check the retry counter if (retry_counter++ > 3) { // something went wrong var errmsg = "melonJS: failed loading " + sound_name; if (me.sys.stopOnAudioError === false) { // disable audio me...
[ "function", "soundLoadError", "(", "sound_name", ",", "onerror_cb", ")", "{", "// check the retry counter", "if", "(", "retry_counter", "++", ">", "3", ")", "{", "// something went wrong", "var", "errmsg", "=", "\"melonJS: failed loading \"", "+", "sound_name", ";", ...
event listener callback on load error @ignore
[ "event", "listener", "callback", "on", "load", "error" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L19257-L19281
train
melonjs/melonJS
dist/melonjs.js
autoDetectRenderer
function autoDetectRenderer(c, width, height, options) { try { return new me.WebGLRenderer(c, width, height, options); } catch (e) { return new me.CanvasRenderer(c, width, height, options); } }
javascript
function autoDetectRenderer(c, width, height, options) { try { return new me.WebGLRenderer(c, width, height, options); } catch (e) { return new me.CanvasRenderer(c, width, height, options); } }
[ "function", "autoDetectRenderer", "(", "c", ",", "width", ",", "height", ",", "options", ")", "{", "try", "{", "return", "new", "me", ".", "WebGLRenderer", "(", "c", ",", "width", ",", "height", ",", "options", ")", ";", "}", "catch", "(", "e", ")", ...
Auto-detect the best renderer to use @ignore
[ "Auto", "-", "detect", "the", "best", "renderer", "to", "use" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L19896-L19902
train
melonjs/melonJS
dist/melonjs.js
overlaps
function overlaps(rect) { return rect.left < this.getWidth() && rect.right > 0 && rect.top < this.getHeight() && rect.bottom > 0; }
javascript
function overlaps(rect) { return rect.left < this.getWidth() && rect.right > 0 && rect.top < this.getHeight() && rect.bottom > 0; }
[ "function", "overlaps", "(", "rect", ")", "{", "return", "rect", ".", "left", "<", "this", ".", "getWidth", "(", ")", "&&", "rect", ".", "right", ">", "0", "&&", "rect", ".", "top", "<", "this", ".", "getHeight", "(", ")", "&&", "rect", ".", "bot...
check if the given rectangle overlaps with the renderer screen coordinates @name overlaps @memberOf me.Renderer.prototype @function @param {me.Rect} rect @return {boolean} true if overlaps
[ "check", "if", "the", "given", "rectangle", "overlaps", "with", "the", "renderer", "screen", "coordinates" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L20572-L20574
train
melonjs/melonJS
dist/melonjs.js
stroke
function stroke(shape, fill) { if (shape.shapeType === "Rectangle") { this.strokeRect(shape.left, shape.top, shape.width, shape.height, fill); } else if (shape instanceof me.Line || shape instanceof me.Polygon) { this.strokePolygon(shape, fill); } else if (shape instance...
javascript
function stroke(shape, fill) { if (shape.shapeType === "Rectangle") { this.strokeRect(shape.left, shape.top, shape.width, shape.height, fill); } else if (shape instanceof me.Line || shape instanceof me.Polygon) { this.strokePolygon(shape, fill); } else if (shape instance...
[ "function", "stroke", "(", "shape", ",", "fill", ")", "{", "if", "(", "shape", ".", "shapeType", "===", "\"Rectangle\"", ")", "{", "this", ".", "strokeRect", "(", "shape", ".", "left", ",", "shape", ".", "top", ",", "shape", ".", "width", ",", "shape...
stroke the given shape @name stroke @memberOf me.Renderer.prototype @function @param {me.Rect|me.Polygon|me.Line|me.Ellipse} shape a shape object to stroke
[ "stroke", "the", "given", "shape" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L20632-L20640
train
melonjs/melonJS
dist/melonjs.js
createAtlas
function createAtlas(width, height, name, repeat) { return { "meta": { "app": "melonJS", "size": { "w": width, "h": height }, "repeat": repeat || "no-repeat", "image": "default" }, "f...
javascript
function createAtlas(width, height, name, repeat) { return { "meta": { "app": "melonJS", "size": { "w": width, "h": height }, "repeat": repeat || "no-repeat", "image": "default" }, "f...
[ "function", "createAtlas", "(", "width", ",", "height", ",", "name", ",", "repeat", ")", "{", "return", "{", "\"meta\"", ":", "{", "\"app\"", ":", "\"melonJS\"", ",", "\"size\"", ":", "{", "\"w\"", ":", "width", ",", "\"h\"", ":", "height", "}", ",", ...
create a simple 1 frame texture atlas based on the given parameters @ignore
[ "create", "a", "simple", "1", "frame", "texture", "atlas", "based", "on", "the", "given", "parameters" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L20876-L20897
train
melonjs/melonJS
dist/melonjs.js
getAtlas
function getAtlas(key) { if (typeof key === "string") { return this.atlases.get(key); } else { return this.atlases.values().next().value; } }
javascript
function getAtlas(key) { if (typeof key === "string") { return this.atlases.get(key); } else { return this.atlases.values().next().value; } }
[ "function", "getAtlas", "(", "key", ")", "{", "if", "(", "typeof", "key", "===", "\"string\"", ")", "{", "return", "this", ".", "atlases", ".", "get", "(", "key", ")", ";", "}", "else", "{", "return", "this", ".", "atlases", ".", "values", "(", ")"...
return the default or specified atlas dictionnary @name getAtlas @memberOf me.Renderer.Texture @function @param {String} [name] atlas name in case of multipack textures @return {Object}
[ "return", "the", "default", "or", "specified", "atlas", "dictionnary" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L21037-L21043
train
melonjs/melonJS
dist/melonjs.js
fillArc
function fillArc(x, y, radius, start, end, antiClockwise) { this.strokeArc(x, y, radius, start, end, antiClockwise || false, true); }
javascript
function fillArc(x, y, radius, start, end, antiClockwise) { this.strokeArc(x, y, radius, start, end, antiClockwise || false, true); }
[ "function", "fillArc", "(", "x", ",", "y", ",", "radius", ",", "start", ",", "end", ",", "antiClockwise", ")", "{", "this", ".", "strokeArc", "(", "x", ",", "y", ",", "radius", ",", "start", ",", "end", ",", "antiClockwise", "||", "false", ",", "tr...
Fill an arc at the specified coordinates with given radius, start and end points @name fillArc @memberOf me.CanvasRenderer.prototype @function @param {Number} x arc center point x-axis @param {Number} y arc center point y-axis @param {Number} radius @param {Number} start start angle in radians @param {Number} end end a...
[ "Fill", "an", "arc", "at", "the", "specified", "coordinates", "with", "given", "radius", "start", "and", "end", "points" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L21584-L21586
train
melonjs/melonJS
dist/melonjs.js
fillLine
function fillLine(startX, startY, endX, endY) { this.strokeLine(startX, startY, endX, endY); }
javascript
function fillLine(startX, startY, endX, endY) { this.strokeLine(startX, startY, endX, endY); }
[ "function", "fillLine", "(", "startX", ",", "startY", ",", "endX", ",", "endY", ")", "{", "this", ".", "strokeLine", "(", "startX", ",", "startY", ",", "endX", ",", "endY", ")", ";", "}" ]
Fill a line of the given two points @name fillLine @memberOf me.CanvasRenderer.prototype @function @param {Number} startX the start x coordinate @param {Number} startY the start y coordinate @param {Number} endX the end x coordinate @param {Number} endY the end y coordinate
[ "Fill", "a", "line", "of", "the", "given", "two", "points" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L21675-L21677
train
melonjs/melonJS
dist/melonjs.js
strokeRect
function strokeRect(x, y, width, height) { if (this.backBufferContext2D.globalAlpha < 1 / 255) { // Fast path: don't draw fully transparent return; } this.backBufferContext2D.strokeRect(x, y, width, height); }
javascript
function strokeRect(x, y, width, height) { if (this.backBufferContext2D.globalAlpha < 1 / 255) { // Fast path: don't draw fully transparent return; } this.backBufferContext2D.strokeRect(x, y, width, height); }
[ "function", "strokeRect", "(", "x", ",", "y", ",", "width", ",", "height", ")", "{", "if", "(", "this", ".", "backBufferContext2D", ".", "globalAlpha", "<", "1", "/", "255", ")", "{", "// Fast path: don't draw fully transparent", "return", ";", "}", "this", ...
Stroke a rectangle at the specified coordinates @name strokeRect @memberOf me.CanvasRenderer.prototype @function @param {Number} x @param {Number} y @param {Number} width @param {Number} height
[ "Stroke", "a", "rectangle", "at", "the", "specified", "coordinates" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L21731-L21738
train
melonjs/melonJS
dist/melonjs.js
createPattern
function createPattern(image, repeat) { if (!me.Math.isPowerOfTwo(image.width) || !me.Math.isPowerOfTwo(image.height)) { var src = typeof image.src !== "undefined" ? image.src : image; throw new Error("[WebGL Renderer] " + src + " is not a POT texture " + "(" + image.width + "x" + image.h...
javascript
function createPattern(image, repeat) { if (!me.Math.isPowerOfTwo(image.width) || !me.Math.isPowerOfTwo(image.height)) { var src = typeof image.src !== "undefined" ? image.src : image; throw new Error("[WebGL Renderer] " + src + " is not a POT texture " + "(" + image.width + "x" + image.h...
[ "function", "createPattern", "(", "image", ",", "repeat", ")", "{", "if", "(", "!", "me", ".", "Math", ".", "isPowerOfTwo", "(", "image", ".", "width", ")", "||", "!", "me", ".", "Math", ".", "isPowerOfTwo", "(", "image", ".", "height", ")", ")", "...
Create a pattern with the specified repetition @name createPattern @memberOf me.WebGLRenderer.prototype @function @param {image} image Source image @param {String} repeat Define how the pattern should be repeated @return {me.video.renderer.Texture} @see me.ImageLayer#repeat @example var tileable = renderer.createPatt...
[ "Create", "a", "pattern", "with", "the", "specified", "repetition" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L22201-L22211
train
melonjs/melonJS
dist/melonjs.js
getContextGL
function getContextGL(canvas, transparent) { if (typeof canvas === "undefined" || canvas === null) { throw new Error("You must pass a canvas element in order to create " + "a GL context"); } if (typeof transparent !== "boolean") { transparent = true; } ...
javascript
function getContextGL(canvas, transparent) { if (typeof canvas === "undefined" || canvas === null) { throw new Error("You must pass a canvas element in order to create " + "a GL context"); } if (typeof transparent !== "boolean") { transparent = true; } ...
[ "function", "getContextGL", "(", "canvas", ",", "transparent", ")", "{", "if", "(", "typeof", "canvas", "===", "\"undefined\"", "||", "canvas", "===", "null", ")", "{", "throw", "new", "Error", "(", "\"You must pass a canvas element in order to create \"", "+", "\...
Returns the WebGL Context object of the given Canvas @name getContextGL @memberOf me.WebGLRenderer.prototype @function @param {Canvas} canvas @param {Boolean} [transparent=true] use false to disable transparency @return {WebGLRenderingContext}
[ "Returns", "the", "WebGL", "Context", "object", "of", "the", "given", "Canvas" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L22367-L22391
train
melonjs/melonJS
dist/melonjs.js
setBlendMode
function setBlendMode(mode, gl) { gl = gl || this.gl; gl.enable(gl.BLEND); switch (mode) { case "multiply": gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); this.currentBlendMode = mode; break; default: gl.blendFun...
javascript
function setBlendMode(mode, gl) { gl = gl || this.gl; gl.enable(gl.BLEND); switch (mode) { case "multiply": gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); this.currentBlendMode = mode; break; default: gl.blendFun...
[ "function", "setBlendMode", "(", "mode", ",", "gl", ")", "{", "gl", "=", "gl", "||", "this", ".", "gl", ";", "gl", ".", "enable", "(", "gl", ".", "BLEND", ")", ";", "switch", "(", "mode", ")", "{", "case", "\"multiply\"", ":", "gl", ".", "blendFu...
set a blend mode for the given context @name setBlendMode @memberOf me.WebGLRenderer.prototype @function @param {String} [mode="normal"] blend mode : "normal", "multiply" @param {WebGLRenderingContext} [gl]
[ "set", "a", "blend", "mode", "for", "the", "given", "context" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L22413-L22428
train
melonjs/melonJS
dist/melonjs.js
scaleCanvas
function scaleCanvas(scaleX, scaleY) { var w = this.canvas.width * scaleX; var h = this.canvas.height * scaleY; // adjust CSS style for High-DPI devices if (me.device.devicePixelRatio > 1) { this.canvas.style.width = w / me.device.devicePixelRatio + "px"; this.canvas.st...
javascript
function scaleCanvas(scaleX, scaleY) { var w = this.canvas.width * scaleX; var h = this.canvas.height * scaleY; // adjust CSS style for High-DPI devices if (me.device.devicePixelRatio > 1) { this.canvas.style.width = w / me.device.devicePixelRatio + "px"; this.canvas.st...
[ "function", "scaleCanvas", "(", "scaleX", ",", "scaleY", ")", "{", "var", "w", "=", "this", ".", "canvas", ".", "width", "*", "scaleX", ";", "var", "h", "=", "this", ".", "canvas", ".", "height", "*", "scaleY", ";", "// adjust CSS style for High-DPI device...
scales the canvas & GL Context @name scaleCanvas @memberOf me.WebGLRenderer.prototype @function
[ "scales", "the", "canvas", "&", "GL", "Context" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L22451-L22464
train
melonjs/melonJS
dist/melonjs.js
save
function save() { this._colorStack.push(this.currentColor.clone()); this._matrixStack.push(this.currentTransform.clone()); if (this.gl.isEnabled(this.gl.SCISSOR_TEST)) { // FIXME avoid slice and object realloc this._scissorStack.push(this.currentScissor.slice()); ...
javascript
function save() { this._colorStack.push(this.currentColor.clone()); this._matrixStack.push(this.currentTransform.clone()); if (this.gl.isEnabled(this.gl.SCISSOR_TEST)) { // FIXME avoid slice and object realloc this._scissorStack.push(this.currentScissor.slice()); ...
[ "function", "save", "(", ")", "{", "this", ".", "_colorStack", ".", "push", "(", "this", ".", "currentColor", ".", "clone", "(", ")", ")", ";", "this", ".", "_matrixStack", ".", "push", "(", "this", ".", "currentTransform", ".", "clone", "(", ")", ")...
saves the canvas context @name save @memberOf me.WebGLRenderer.prototype @function
[ "saves", "the", "canvas", "context" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L22506-L22515
train
melonjs/melonJS
dist/melonjs.js
strokePolygon
function strokePolygon(poly, fill) { if (fill === true) { this.fillPolygon(poly); } else { var len = poly.points.length, points = this._glPoints, i; // Grow internal points buffer if necessary for (i = points.length; i < len; i++) { ...
javascript
function strokePolygon(poly, fill) { if (fill === true) { this.fillPolygon(poly); } else { var len = poly.points.length, points = this._glPoints, i; // Grow internal points buffer if necessary for (i = points.length; i < len; i++) { ...
[ "function", "strokePolygon", "(", "poly", ",", "fill", ")", "{", "if", "(", "fill", "===", "true", ")", "{", "this", ".", "fillPolygon", "(", "poly", ")", ";", "}", "else", "{", "var", "len", "=", "poly", ".", "points", ".", "length", ",", "points"...
Stroke a me.Polygon on the screen with a specified color @name strokePolygon @memberOf me.WebGLRenderer.prototype @function @param {me.Polygon} poly the shape to draw
[ "Stroke", "a", "me", ".", "Polygon", "on", "the", "screen", "with", "a", "specified", "color" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L22728-L22748
train
melonjs/melonJS
dist/melonjs.js
fillPolygon
function fillPolygon(poly) { var points = poly.points; var glPoints = this._glPoints; var indices = poly.getIndices(); var x = poly.pos.x, y = poly.pos.y; // Grow internal points buffer if necessary for (i = glPoints.length; i < indices.length; i++) { ...
javascript
function fillPolygon(poly) { var points = poly.points; var glPoints = this._glPoints; var indices = poly.getIndices(); var x = poly.pos.x, y = poly.pos.y; // Grow internal points buffer if necessary for (i = glPoints.length; i < indices.length; i++) { ...
[ "function", "fillPolygon", "(", "poly", ")", "{", "var", "points", "=", "poly", ".", "points", ";", "var", "glPoints", "=", "this", ".", "_glPoints", ";", "var", "indices", "=", "poly", ".", "getIndices", "(", ")", ";", "var", "x", "=", "poly", ".", ...
Fill a me.Polygon on the screen @name fillPolygon @memberOf me.WebGLRenderer.prototype @function @param {me.Polygon} poly the shape to draw
[ "Fill", "a", "me", ".", "Polygon", "on", "the", "screen" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L22757-L22775
train
melonjs/melonJS
dist/melonjs.js
translate
function translate(x, y) { if (this.settings.subPixel === false) { this.currentTransform.translate(~~x, ~~y); } else { this.currentTransform.translate(x, y); } }
javascript
function translate(x, y) { if (this.settings.subPixel === false) { this.currentTransform.translate(~~x, ~~y); } else { this.currentTransform.translate(x, y); } }
[ "function", "translate", "(", "x", ",", "y", ")", "{", "if", "(", "this", ".", "settings", ".", "subPixel", "===", "false", ")", "{", "this", ".", "currentTransform", ".", "translate", "(", "~", "~", "x", ",", "~", "~", "y", ")", ";", "}", "else"...
Translates the uniform matrix by the given coordinates @name translate @memberOf me.WebGLRenderer.prototype @function @param {Number} x @param {Number} y
[ "Translates", "the", "uniform", "matrix", "by", "the", "given", "coordinates" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L22862-L22868
train
melonjs/melonJS
dist/melonjs.js
setProjection
function setProjection(w, h) { this.flush(); this.gl.viewport(0, 0, w, h); this.uMatrix.setTransform(2 / w, 0, 0, 0, -2 / h, 0, -1, 1, 1); }
javascript
function setProjection(w, h) { this.flush(); this.gl.viewport(0, 0, w, h); this.uMatrix.setTransform(2 / w, 0, 0, 0, -2 / h, 0, -1, 1, 1); }
[ "function", "setProjection", "(", "w", ",", "h", ")", "{", "this", ".", "flush", "(", ")", ";", "this", ".", "gl", ".", "viewport", "(", "0", ",", "0", ",", "w", ",", "h", ")", ";", "this", ".", "uMatrix", ".", "setTransform", "(", "2", "/", ...
Sets the projection matrix with the given size @name setProjection @memberOf me.WebGLRenderer.Compositor @function @param {Number} w WebGL Canvas width @param {Number} h WebGL Canvas height
[ "Sets", "the", "projection", "matrix", "with", "the", "given", "size" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L23099-L23103
train
melonjs/melonJS
dist/melonjs.js
compileProgram
function compileProgram(gl, vertex, fragment) { var vertShader = compileShader(gl, gl.VERTEX_SHADER, vertex); var fragShader = compileShader(gl, gl.FRAGMENT_SHADER, fragment); var program = gl.createProgram(); gl.attachShader(program, vertShader); gl.attachShader(program, fragShader);...
javascript
function compileProgram(gl, vertex, fragment) { var vertShader = compileShader(gl, gl.VERTEX_SHADER, vertex); var fragShader = compileShader(gl, gl.FRAGMENT_SHADER, fragment); var program = gl.createProgram(); gl.attachShader(program, vertShader); gl.attachShader(program, fragShader);...
[ "function", "compileProgram", "(", "gl", ",", "vertex", ",", "fragment", ")", "{", "var", "vertShader", "=", "compileShader", "(", "gl", ",", "gl", ".", "VERTEX_SHADER", ",", "vertex", ")", ";", "var", "fragShader", "=", "compileShader", "(", "gl", ",", ...
Compile GLSL into a shader object @private
[ "Compile", "GLSL", "into", "a", "shader", "object" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L23510-L23527
train
melonjs/melonJS
dist/melonjs.js
minify
function minify(src) { // remove comments src = src.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm, "$1"); // Remove leading and trailing whitespace from lines src = src.replace(/(\\n\s+)|(\s+\\n)/g, ""); // Remove line breaks src = src.replace(/(\\r|\\n)+/g, ""); // Remove unnecessary whi...
javascript
function minify(src) { // remove comments src = src.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm, "$1"); // Remove leading and trailing whitespace from lines src = src.replace(/(\\n\s+)|(\s+\\n)/g, ""); // Remove line breaks src = src.replace(/(\\r|\\n)+/g, ""); // Remove unnecessary whi...
[ "function", "minify", "(", "src", ")", "{", "// remove comments", "src", "=", "src", ".", "replace", "(", "/", "\\/\\*[\\s\\S]*?\\*\\/|([^\\\\:]|^)\\/\\/.*$", "/", "gm", ",", "\"$1\"", ")", ";", "// Remove leading and trailing whitespace from lines", "src", "=", "src"...
clean the given source from space, comments, etc... @private
[ "clean", "the", "given", "source", "from", "space", "comments", "etc", "..." ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L23569-L23579
train
melonjs/melonJS
dist/melonjs.js
setEvent
function setEvent(event, pageX, pageY, clientX, clientY, pointerId) { var width = 1; var height = 1; // the original event object this.event = event; this.pageX = pageX || 0; this.pageY = pageY || 0; this.clientX = clientX || 0; this.clientY = clientY || 0...
javascript
function setEvent(event, pageX, pageY, clientX, clientY, pointerId) { var width = 1; var height = 1; // the original event object this.event = event; this.pageX = pageX || 0; this.pageY = pageY || 0; this.clientX = clientX || 0; this.clientY = clientY || 0...
[ "function", "setEvent", "(", "event", ",", "pageX", ",", "pageY", ",", "clientX", ",", "clientY", ",", "pointerId", ")", "{", "var", "width", "=", "1", ";", "var", "height", "=", "1", ";", "// the original event object", "this", ".", "event", "=", "event...
initialize the Pointer object using the given Event Object @name me.Pointer#set @private @function @param {Event} event the original Event object @param {Number} pageX the horizontal coordinate at which the event occurred, relative to the left edge of the entire document @param {Number} pageY the vertical coordinate at...
[ "initialize", "the", "Pointer", "object", "using", "the", "given", "Event", "Object" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L24587-L24638
train
melonjs/melonJS
dist/melonjs.js
normalizeEvent
function normalizeEvent(event) { var pointer; // PointerEvent or standard Mouse event if (me.device.TouchEvent && event.changedTouches) { // iOS/Android Touch event for (var i = 0, l = event.changedTouches.length; i < l; i++) { var touchEvent = event.changedTouches[i]; ...
javascript
function normalizeEvent(event) { var pointer; // PointerEvent or standard Mouse event if (me.device.TouchEvent && event.changedTouches) { // iOS/Android Touch event for (var i = 0, l = event.changedTouches.length; i < l; i++) { var touchEvent = event.changedTouches[i]; ...
[ "function", "normalizeEvent", "(", "event", ")", "{", "var", "pointer", ";", "// PointerEvent or standard Mouse event", "if", "(", "me", ".", "device", ".", "TouchEvent", "&&", "event", ".", "changedTouches", ")", "{", "// iOS/Android Touch event", "for", "(", "va...
translate event coordinates @ignore
[ "translate", "event", "coordinates" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L24992-L25019
train
melonjs/melonJS
dist/melonjs.js
wiredXbox360NormalizeFn
function wiredXbox360NormalizeFn(value, axis, button) { if (button === api.GAMEPAD.BUTTONS.L2 || button === api.GAMEPAD.BUTTONS.R2) { return (value + 1) / 2; } return value; }
javascript
function wiredXbox360NormalizeFn(value, axis, button) { if (button === api.GAMEPAD.BUTTONS.L2 || button === api.GAMEPAD.BUTTONS.R2) { return (value + 1) / 2; } return value; }
[ "function", "wiredXbox360NormalizeFn", "(", "value", ",", "axis", ",", "button", ")", "{", "if", "(", "button", "===", "api", ".", "GAMEPAD", ".", "BUTTONS", ".", "L2", "||", "button", "===", "api", ".", "GAMEPAD", ".", "BUTTONS", ".", "R2", ")", "{", ...
Normalize axis values for wired Xbox 360 @ignore
[ "Normalize", "axis", "values", "for", "wired", "Xbox", "360" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L25369-L25375
train
melonjs/melonJS
dist/melonjs.js
ouyaNormalizeFn
function ouyaNormalizeFn(value, axis, button) { if (value > 0) { if (button === api.GAMEPAD.BUTTONS.L2) { // L2 is wonky; seems like the deadzone is around 20000 // (That's over 15% of the total range!) value = Math.max(0, value - 20000) / 111070; } else { ...
javascript
function ouyaNormalizeFn(value, axis, button) { if (value > 0) { if (button === api.GAMEPAD.BUTTONS.L2) { // L2 is wonky; seems like the deadzone is around 20000 // (That's over 15% of the total range!) value = Math.max(0, value - 20000) / 111070; } else { ...
[ "function", "ouyaNormalizeFn", "(", "value", ",", "axis", ",", "button", ")", "{", "if", "(", "value", ">", "0", ")", "{", "if", "(", "button", "===", "api", ".", "GAMEPAD", ".", "BUTTONS", ".", "L2", ")", "{", "// L2 is wonky; seems like the deadzone is a...
Normalize axis values for OUYA @ignore
[ "Normalize", "axis", "values", "for", "OUYA" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L25382-L25398
train
melonjs/melonJS
dist/melonjs.js
lighten
function lighten(scale) { scale = me.Math.clamp(scale, 0, 1); this.glArray[0] = me.Math.clamp(this.glArray[0] + (1 - this.glArray[0]) * scale, 0, 1); this.glArray[1] = me.Math.clamp(this.glArray[1] + (1 - this.glArray[1]) * scale, 0, 1); this.glArray[2] = me.Math.clamp(this.glArray[2...
javascript
function lighten(scale) { scale = me.Math.clamp(scale, 0, 1); this.glArray[0] = me.Math.clamp(this.glArray[0] + (1 - this.glArray[0]) * scale, 0, 1); this.glArray[1] = me.Math.clamp(this.glArray[1] + (1 - this.glArray[1]) * scale, 0, 1); this.glArray[2] = me.Math.clamp(this.glArray[2...
[ "function", "lighten", "(", "scale", ")", "{", "scale", "=", "me", ".", "Math", ".", "clamp", "(", "scale", ",", "0", ",", "1", ")", ";", "this", ".", "glArray", "[", "0", "]", "=", "me", ".", "Math", ".", "clamp", "(", "this", ".", "glArray", ...
Lighten this color value by 0..1 @name lighten @memberOf me.Color @function @param {Number} scale @return {me.Color} Reference to this object for method chaining
[ "Lighten", "this", "color", "value", "by", "0", "..", "1" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L26332-L26338
train
melonjs/melonJS
dist/melonjs.js
add
function add(props) { Object.keys(props).forEach(function (key) { if (isReserved(key)) { return; } (function (prop) { Object.defineProperty(api, prop, { configurable: true, enumerable: true, ...
javascript
function add(props) { Object.keys(props).forEach(function (key) { if (isReserved(key)) { return; } (function (prop) { Object.defineProperty(api, prop, { configurable: true, enumerable: true, ...
[ "function", "add", "(", "props", ")", "{", "Object", ".", "keys", "(", "props", ")", ".", "forEach", "(", "function", "(", "key", ")", "{", "if", "(", "isReserved", "(", "key", ")", ")", "{", "return", ";", "}", "(", "function", "(", "prop", ")",...
Add new keys to localStorage and set them to the given default values if they do not exist @name add @memberOf me.save @function @param {Object} props key and corresponding values @example // Initialize "score" and "lives" with default values me.save.add({ score : 0, lives : 3 });
[ "Add", "new", "keys", "to", "localStorage", "and", "set", "them", "to", "the", "given", "default", "values", "if", "they", "do", "not", "exist" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L26668-L26708
train
melonjs/melonJS
dist/melonjs.js
remove
function remove(key) { if (!isReserved(key)) { if (typeof data[key] !== "undefined") { delete data[key]; if (me.device.localStorage === true) { localStorage.removeItem("me.save." + key); localStorage.setItem("me.save", JSON.stringi...
javascript
function remove(key) { if (!isReserved(key)) { if (typeof data[key] !== "undefined") { delete data[key]; if (me.device.localStorage === true) { localStorage.removeItem("me.save." + key); localStorage.setItem("me.save", JSON.stringi...
[ "function", "remove", "(", "key", ")", "{", "if", "(", "!", "isReserved", "(", "key", ")", ")", "{", "if", "(", "typeof", "data", "[", "key", "]", "!==", "\"undefined\"", ")", "{", "delete", "data", "[", "key", "]", ";", "if", "(", "me", ".", "...
Remove a key from localStorage @name remove @memberOf me.save @function @param {String} key key to be removed @example // Remove the "score" key from localStorage me.save.remove("score");
[ "Remove", "a", "key", "from", "localStorage" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L26720-L26731
train
melonjs/melonJS
dist/melonjs.js
setTMXValue
function setTMXValue(name, type, value) { var match; if (typeof value !== "string") { // Value is already normalized (e.g. with JSON maps) return value; } switch (type) { case "int": case "float": value = Number(value); ...
javascript
function setTMXValue(name, type, value) { var match; if (typeof value !== "string") { // Value is already normalized (e.g. with JSON maps) return value; } switch (type) { case "int": case "float": value = Number(value); ...
[ "function", "setTMXValue", "(", "name", ",", "type", ",", "value", ")", "{", "var", "match", ";", "if", "(", "typeof", "value", "!==", "\"string\"", ")", "{", "// Value is already normalized (e.g. with JSON maps)", "return", "value", ";", "}", "switch", "(", "...
set and interpret a TMX property value @ignore
[ "set", "and", "interpret", "a", "TMX", "property", "value" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L26755-L26819
train
melonjs/melonJS
dist/melonjs.js
parseTMXShapes
function parseTMXShapes() { var i = 0; var shapes = []; // add an ellipse shape if (this.isEllipse === true) { // ellipse coordinates are the center position, so set default to the corresonding radius shapes.push(new me.Ellipse(this.width / 2, this.height / 2, this.widt...
javascript
function parseTMXShapes() { var i = 0; var shapes = []; // add an ellipse shape if (this.isEllipse === true) { // ellipse coordinates are the center position, so set default to the corresonding radius shapes.push(new me.Ellipse(this.width / 2, this.height / 2, this.widt...
[ "function", "parseTMXShapes", "(", ")", "{", "var", "i", "=", "0", ";", "var", "shapes", "=", "[", "]", ";", "// add an ellipse shape", "if", "(", "this", ".", "isEllipse", "===", "true", ")", "{", "// ellipse coordinates are the center position, so set default to...
parses the TMX shape definition and returns a corresponding array of me.Shape object @name parseTMXShapes @memberOf me.TMXObject @private @function @return {me.Polygon[]|me.Line[]|me.Ellipse[]} an array of shape objects
[ "parses", "the", "TMX", "shape", "definition", "and", "returns", "a", "corresponding", "array", "of", "me", ".", "Shape", "object" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L27477-L27519
train
melonjs/melonJS
dist/melonjs.js
createTransform
function createTransform() { if (this.currentTransform === null) { this.currentTransform = new me.Matrix2d(); } else { // reset the matrix this.currentTransform.identity(); } if (this.flippedAD) { // Use shearing to swap the X/Y axis ...
javascript
function createTransform() { if (this.currentTransform === null) { this.currentTransform = new me.Matrix2d(); } else { // reset the matrix this.currentTransform.identity(); } if (this.flippedAD) { // Use shearing to swap the X/Y axis ...
[ "function", "createTransform", "(", ")", "{", "if", "(", "this", ".", "currentTransform", "===", "null", ")", "{", "this", ".", "currentTransform", "=", "new", "me", ".", "Matrix2d", "(", ")", ";", "}", "else", "{", "// reset the matrix", "this", ".", "c...
create a transformation matrix for this tile @ignore
[ "create", "a", "transformation", "matrix", "for", "this", "tile" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L27637-L27660
train
melonjs/melonJS
dist/melonjs.js
getRenderable
function getRenderable(settings) { var renderable; var tileset = this.tileset; if (tileset.animations.has(this.tileId)) { var frames = []; var frameId = []; tileset.animations.get(this.tileId).frames.forEach(function (frame) { frameId.push(frame....
javascript
function getRenderable(settings) { var renderable; var tileset = this.tileset; if (tileset.animations.has(this.tileId)) { var frames = []; var frameId = []; tileset.animations.get(this.tileId).frames.forEach(function (frame) { frameId.push(frame....
[ "function", "getRenderable", "(", "settings", ")", "{", "var", "renderable", ";", "var", "tileset", "=", "this", ".", "tileset", ";", "if", "(", "tileset", ".", "animations", ".", "has", "(", "this", ".", "tileId", ")", ")", "{", "var", "frames", "=", ...
return a renderable object for this Tile object @name me.Tile#getRenderable @public @function @param {Object} [settings] see {@link me.Sprite} @return {me.Renderable} a me.Sprite object
[ "return", "a", "renderable", "object", "for", "this", "Tile", "object" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L27670-L27719
train
melonjs/melonJS
dist/melonjs.js
update
function update(dt) { var duration = 0, now = me.timer.getTime(), result = false; if (this._lastUpdate !== now) { this._lastUpdate = now; this.animations.forEach(function (anim) { anim.dt += dt; duration = anim.cur.duration; ...
javascript
function update(dt) { var duration = 0, now = me.timer.getTime(), result = false; if (this._lastUpdate !== now) { this._lastUpdate = now; this.animations.forEach(function (anim) { anim.dt += dt; duration = anim.cur.duration; ...
[ "function", "update", "(", "dt", ")", "{", "var", "duration", "=", "0", ",", "now", "=", "me", ".", "timer", ".", "getTime", "(", ")", ",", "result", "=", "false", ";", "if", "(", "this", ".", "_lastUpdate", "!==", "now", ")", "{", "this", ".", ...
update tile animations
[ "update", "tile", "animations" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L27947-L27969
train
melonjs/melonJS
dist/melonjs.js
canRender
function canRender(component) { return this.cols === component.cols && this.rows === component.rows && this.tilewidth === component.tilewidth && this.tileheight === component.tileheight; }
javascript
function canRender(component) { return this.cols === component.cols && this.rows === component.rows && this.tilewidth === component.tilewidth && this.tileheight === component.tileheight; }
[ "function", "canRender", "(", "component", ")", "{", "return", "this", ".", "cols", "===", "component", ".", "cols", "&&", "this", ".", "rows", "===", "component", ".", "rows", "&&", "this", ".", "tilewidth", "===", "component", ".", "tilewidth", "&&", "...
return true if the renderer can render the specified layer @name me.TMXRenderer#canRender @public @function @param {me.TMXTileMap|me.TMXLayer} component TMX Map or Layer @return {boolean}
[ "return", "true", "if", "the", "renderer", "can", "render", "the", "specified", "layer" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L28134-L28136
train
melonjs/melonJS
dist/melonjs.js
initArray
function initArray(layer) { // initialize the array layer.layerData = new Array(layer.cols); for (var x = 0; x < layer.cols; x++) { layer.layerData[x] = new Array(layer.rows); for (var y = 0; y < layer.rows; y++) { layer.layerData[x][y] = null; } } ...
javascript
function initArray(layer) { // initialize the array layer.layerData = new Array(layer.cols); for (var x = 0; x < layer.cols; x++) { layer.layerData[x] = new Array(layer.rows); for (var y = 0; y < layer.rows; y++) { layer.layerData[x][y] = null; } } ...
[ "function", "initArray", "(", "layer", ")", "{", "// initialize the array", "layer", ".", "layerData", "=", "new", "Array", "(", "layer", ".", "cols", ")", ";", "for", "(", "var", "x", "=", "0", ";", "x", "<", "layer", ".", "cols", ";", "x", "++", ...
Create required arrays for the given layer object @ignore
[ "Create", "required", "arrays", "for", "the", "given", "layer", "object" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L28680-L28691
train
melonjs/melonJS
dist/melonjs.js
setLayerData
function setLayerData(layer, data) { var idx = 0; // initialize the array initArray(layer); // set everything for (var y = 0; y < layer.rows; y++) { for (var x = 0; x < layer.cols; x++) { // get the value of the gid var gid = data[idx++]; // fill the array ...
javascript
function setLayerData(layer, data) { var idx = 0; // initialize the array initArray(layer); // set everything for (var y = 0; y < layer.rows; y++) { for (var x = 0; x < layer.cols; x++) { // get the value of the gid var gid = data[idx++]; // fill the array ...
[ "function", "setLayerData", "(", "layer", ",", "data", ")", "{", "var", "idx", "=", "0", ";", "// initialize the array", "initArray", "(", "layer", ")", ";", "// set everything", "for", "(", "var", "y", "=", "0", ";", "y", "<", "layer", ".", "rows", ";...
Set a tiled layer Data @ignore
[ "Set", "a", "tiled", "layer", "Data" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L28698-L28714
train
melonjs/melonJS
dist/melonjs.js
getTileId
function getTileId(x, y) { var tile = this.getTile(x, y); return tile ? tile.tileId : null; }
javascript
function getTileId(x, y) { var tile = this.getTile(x, y); return tile ? tile.tileId : null; }
[ "function", "getTileId", "(", "x", ",", "y", ")", "{", "var", "tile", "=", "this", ".", "getTile", "(", "x", ",", "y", ")", ";", "return", "tile", "?", "tile", ".", "tileId", ":", "null", ";", "}" ]
Return the TileId of the Tile at the specified position @name getTileId @memberOf me.TMXLayer @public @function @param {Number} x X coordinate (in world/pixels coordinates) @param {Number} y Y coordinate (in world/pixels coordinates) @return {Number} TileId or null if there is no Tile at the given position
[ "Return", "the", "TileId", "of", "the", "Tile", "at", "the", "specified", "position" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L28900-L28903
train
melonjs/melonJS
dist/melonjs.js
setTile
function setTile(x, y, tileId) { if (!this.tileset.contains(tileId)) { // look for the corresponding tileset this.tileset = this.tilesets.getTilesetByGid(tileId); } var tile = this.layerData[x][y] = new me.Tile(x, y, tileId, this.tileset); // draw the corresponding tile...
javascript
function setTile(x, y, tileId) { if (!this.tileset.contains(tileId)) { // look for the corresponding tileset this.tileset = this.tilesets.getTilesetByGid(tileId); } var tile = this.layerData[x][y] = new me.Tile(x, y, tileId, this.tileset); // draw the corresponding tile...
[ "function", "setTile", "(", "x", ",", "y", ",", "tileId", ")", "{", "if", "(", "!", "this", ".", "tileset", ".", "contains", "(", "tileId", ")", ")", "{", "// look for the corresponding tileset", "this", ".", "tileset", "=", "this", ".", "tilesets", ".",...
Create a new Tile at the specified position @name setTile @memberOf me.TMXLayer @public @function @param {Number} x X coordinate (in map coordinates: row/column) @param {Number} y Y coordinate (in map coordinates: row/column) @param {Number} tileId tileId @return {me.Tile} the corresponding newly created tile object
[ "Create", "a", "new", "Tile", "at", "the", "specified", "position" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L28947-L28960
train
melonjs/melonJS
dist/melonjs.js
getRenderer
function getRenderer(layer) { // first ensure a renderer is associated to this map if (typeof this.renderer === "undefined" || !this.renderer.canRender(this)) { this.renderer = getNewDefaultRenderer(this); } // return a renderer for the given layer (if any) if (typeof la...
javascript
function getRenderer(layer) { // first ensure a renderer is associated to this map if (typeof this.renderer === "undefined" || !this.renderer.canRender(this)) { this.renderer = getNewDefaultRenderer(this); } // return a renderer for the given layer (if any) if (typeof la...
[ "function", "getRenderer", "(", "layer", ")", "{", "// first ensure a renderer is associated to this map", "if", "(", "typeof", "this", ".", "renderer", "===", "\"undefined\"", "||", "!", "this", ".", "renderer", ".", "canRender", "(", "this", ")", ")", "{", "th...
Return the map default renderer @name getRenderer @memberOf me.TMXTileMap @public @function @param {me.TMXLayer} [layer] a layer object @return {me.TMXRenderer} a TMX renderer
[ "Return", "the", "map", "default", "renderer" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L29263-L29276
train
melonjs/melonJS
dist/melonjs.js
initEvents
function initEvents() { var self = this; /** * @ignore */ this.mouseDown = function (e) { this.translatePointerEvent(e, Event.DRAGSTART); }; /** * @ignore */ this.mouseUp = function (e) { this.translat...
javascript
function initEvents() { var self = this; /** * @ignore */ this.mouseDown = function (e) { this.translatePointerEvent(e, Event.DRAGSTART); }; /** * @ignore */ this.mouseUp = function (e) { this.translat...
[ "function", "initEvents", "(", ")", "{", "var", "self", "=", "this", ";", "/**\n * @ignore\n */", "this", ".", "mouseDown", "=", "function", "(", "e", ")", "{", "this", ".", "translatePointerEvent", "(", "e", ",", "Event", ".", "DRAGSTART", ...
Initializes the events the modules needs to listen to It translates the pointer events to me.events in order to make them pass through the system and to make this module testable. Then we subscribe this module to the transformed events. @name initEvents @memberOf me.DraggableEntity @function
[ "Initializes", "the", "events", "the", "modules", "needs", "to", "listen", "to", "It", "translates", "the", "pointer", "events", "to", "me", ".", "events", "in", "order", "to", "make", "them", "pass", "through", "the", "system", "and", "to", "make", "this"...
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L30825-L30857
train
melonjs/melonJS
dist/melonjs.js
goTo
function goTo(level) { this.gotolevel = level || this.nextlevel; // load a level //console.log("going to : ", to); if (this.fade && this.duration) { if (!this.fading) { this.fading = true; me.game.viewport.fadeIn(this.fade, this.duration, this.onFadeCompl...
javascript
function goTo(level) { this.gotolevel = level || this.nextlevel; // load a level //console.log("going to : ", to); if (this.fade && this.duration) { if (!this.fading) { this.fading = true; me.game.viewport.fadeIn(this.fade, this.duration, this.onFadeCompl...
[ "function", "goTo", "(", "level", ")", "{", "this", ".", "gotolevel", "=", "level", "||", "this", ".", "nextlevel", ";", "// load a level", "//console.log(\"going to : \", to);", "if", "(", "this", ".", "fade", "&&", "this", ".", "duration", ")", "{", "if", ...
go to the specified level @name goTo @memberOf me.LevelEntity @function @param {String} [level=this.nextlevel] name of the level to load @protected
[ "go", "to", "the", "specified", "level" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L31141-L31153
train
melonjs/melonJS
src/renderable/sprite.js
function (duration, callback) { this._flicker.duration = duration; if (this._flicker.duration <= 0) { this._flicker.isFlickering = false; this._flicker.callback = null; } else if (!this._flicker.isFlickering) { this._flicker...
javascript
function (duration, callback) { this._flicker.duration = duration; if (this._flicker.duration <= 0) { this._flicker.isFlickering = false; this._flicker.callback = null; } else if (!this._flicker.isFlickering) { this._flicker...
[ "function", "(", "duration", ",", "callback", ")", "{", "this", ".", "_flicker", ".", "duration", "=", "duration", ";", "if", "(", "this", ".", "_flicker", ".", "duration", "<=", "0", ")", "{", "this", ".", "_flicker", ".", "isFlickering", "=", "false"...
make the object flicker @name flicker @memberOf me.Sprite.prototype @function @param {Number} duration expressed in milliseconds @param {Function} callback Function to call when flickering ends @return {me.Sprite} Reference to this object for method chaining @example // make the object flicker for 1 second // and then ...
[ "make", "the", "object", "flicker" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/renderable/sprite.js#L222-L233
train
melonjs/melonJS
examples/UI/js/entities/buttons.js
function (/* event */) { this.setRegion(this.unclicked_region); // account for the different sprite size this.pos.y -= this.unclicked_region.height - this.height; this.height = this.unclicked_region.height; // don't propagate the event return false; }
javascript
function (/* event */) { this.setRegion(this.unclicked_region); // account for the different sprite size this.pos.y -= this.unclicked_region.height - this.height; this.height = this.unclicked_region.height; // don't propagate the event return false; }
[ "function", "(", "/* event */", ")", "{", "this", ".", "setRegion", "(", "this", ".", "unclicked_region", ")", ";", "// account for the different sprite size", "this", ".", "pos", ".", "y", "-=", "this", ".", "unclicked_region", ".", "height", "-", "this", "."...
function called when the pointer button is released
[ "function", "called", "when", "the", "pointer", "button", "is", "released" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/examples/UI/js/entities/buttons.js#L70-L77
train
melonjs/melonJS
examples/UI/js/entities/buttons.js
function (selected) { if (selected) { this.setRegion(this.on_icon_region); this.isSelected = true; } else { this.setRegion(this.off_icon_region); this.isSelected = false; } }
javascript
function (selected) { if (selected) { this.setRegion(this.on_icon_region); this.isSelected = true; } else { this.setRegion(this.off_icon_region); this.isSelected = false; } }
[ "function", "(", "selected", ")", "{", "if", "(", "selected", ")", "{", "this", ".", "setRegion", "(", "this", ".", "on_icon_region", ")", ";", "this", ".", "isSelected", "=", "true", ";", "}", "else", "{", "this", ".", "setRegion", "(", "this", ".",...
change the checkbox state
[ "change", "the", "checkbox", "state" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/examples/UI/js/entities/buttons.js#L149-L157
train
melonjs/melonJS
src/video/webgl/webgl_renderer.js
function (col, opaque) { this.save(); this.resetTransform(); this.currentColor.copy(col); if (opaque) { this.compositor.clear(); } else { this.fillRect(0, 0, this.canvas.width, this.canvas.height); } ...
javascript
function (col, opaque) { this.save(); this.resetTransform(); this.currentColor.copy(col); if (opaque) { this.compositor.clear(); } else { this.fillRect(0, 0, this.canvas.width, this.canvas.height); } ...
[ "function", "(", "col", ",", "opaque", ")", "{", "this", ".", "save", "(", ")", ";", "this", ".", "resetTransform", "(", ")", ";", "this", ".", "currentColor", ".", "copy", "(", "col", ")", ";", "if", "(", "opaque", ")", "{", "this", ".", "compos...
Clears the gl context with the given color. @name clearColor @memberOf me.WebGLRenderer.prototype @function @param {me.Color|String} color CSS color. @param {Boolean} [opaque=false] Allow transparency [default] or clear the surface completely [true]
[ "Clears", "the", "gl", "context", "with", "the", "given", "color", "." ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/video/webgl/webgl_renderer.js#L235-L246
train
melonjs/melonJS
src/video/webgl/webgl_renderer.js
function (image, sx, sy, sw, sh, dx, dy, dw, dh) { if (typeof sw === "undefined") { sw = dw = image.width; sh = dh = image.height; dx = sx; dy = sy; sx = 0; sy = 0; } else if (typeof dx ==...
javascript
function (image, sx, sy, sw, sh, dx, dy, dw, dh) { if (typeof sw === "undefined") { sw = dw = image.width; sh = dh = image.height; dx = sx; dy = sy; sx = 0; sy = 0; } else if (typeof dx ==...
[ "function", "(", "image", ",", "sx", ",", "sy", ",", "sw", ",", "sh", ",", "dx", ",", "dy", ",", "dw", ",", "dh", ")", "{", "if", "(", "typeof", "sw", "===", "\"undefined\"", ")", "{", "sw", "=", "dw", "=", "image", ".", "width", ";", "sh", ...
Draw an image to the gl context @name drawImage @memberOf me.WebGLRenderer.prototype @function @param {Image} image An element to draw into the context. The specification permits any canvas image source (CanvasImageSource), specifically, a CSSImageValue, an HTMLImageElement, an SVGImageElement, an HTMLVideoElement, an ...
[ "Draw", "an", "image", "to", "the", "gl", "context" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/video/webgl/webgl_renderer.js#L320-L348
train
melonjs/melonJS
src/video/webgl/webgl_renderer.js
function (x, y, width, height) { var points = this._glPoints; points[0].x = x; points[0].y = y; points[1].x = x + width; points[1].y = y; points[2].x = x + width; points[2].y = y + height; points[3].x = x; points...
javascript
function (x, y, width, height) { var points = this._glPoints; points[0].x = x; points[0].y = y; points[1].x = x + width; points[1].y = y; points[2].x = x + width; points[2].y = y + height; points[3].x = x; points...
[ "function", "(", "x", ",", "y", ",", "width", ",", "height", ")", "{", "var", "points", "=", "this", ".", "_glPoints", ";", "points", "[", "0", "]", ".", "x", "=", "x", ";", "points", "[", "0", "]", ".", "y", "=", "y", ";", "points", "[", "...
Draw a stroke rectangle at the specified coordinates @name strokeRect @memberOf me.WebGLRenderer.prototype @function @param {Number} x @param {Number} y @param {Number} width @param {Number} height
[ "Draw", "a", "stroke", "rectangle", "at", "the", "specified", "coordinates" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/video/webgl/webgl_renderer.js#L848-L859
train
melonjs/melonJS
plugins/debug/debugPanel.js
function () { if (!this.visible) { // add the debug panel to the game world me.game.world.addChild(this, Infinity); // register a mouse event for the checkboxes me.input.registerPointerEvent("pointerdown", this, this.onClick.bind(this)); ...
javascript
function () { if (!this.visible) { // add the debug panel to the game world me.game.world.addChild(this, Infinity); // register a mouse event for the checkboxes me.input.registerPointerEvent("pointerdown", this, this.onClick.bind(this)); ...
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "visible", ")", "{", "// add the debug panel to the game world", "me", ".", "game", ".", "world", ".", "addChild", "(", "this", ",", "Infinity", ")", ";", "// register a mouse event for the checkboxes", "me...
show the debug panel @ignore
[ "show", "the", "debug", "panel" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/plugins/debug/debugPanel.js#L614-L625
train
melonjs/melonJS
plugins/debug/debugPanel.js
function () { if (this.visible) { // release the mouse event for the checkboxes me.input.releasePointerEvent("pointerdown", this); // remove the debug panel from the game world me.game.world.removeChild(this, true); // mark it a...
javascript
function () { if (this.visible) { // release the mouse event for the checkboxes me.input.releasePointerEvent("pointerdown", this); // remove the debug panel from the game world me.game.world.removeChild(this, true); // mark it a...
[ "function", "(", ")", "{", "if", "(", "this", ".", "visible", ")", "{", "// release the mouse event for the checkboxes", "me", ".", "input", ".", "releasePointerEvent", "(", "\"pointerdown\"", ",", "this", ")", ";", "// remove the debug panel from the game world", "me...
hide the debug panel @ignore
[ "hide", "the", "debug", "panel" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/plugins/debug/debugPanel.js#L631-L642
train
melonjs/melonJS
src/state/stage.js
function () { var self = this; // add all defined cameras this.settings.cameras.forEach(function(camera) { self.cameras.set(camera.name, camera); }); // empty or no default camera if (this.cameras.has("default") === false) { ...
javascript
function () { var self = this; // add all defined cameras this.settings.cameras.forEach(function(camera) { self.cameras.set(camera.name, camera); }); // empty or no default camera if (this.cameras.has("default") === false) { ...
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "// add all defined cameras", "this", ".", "settings", ".", "cameras", ".", "forEach", "(", "function", "(", "camera", ")", "{", "self", ".", "cameras", ".", "set", "(", "camera", ".", "name", ...
Object reset function @ignore
[ "Object", "reset", "function" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/state/stage.js#L53-L77
train
melonjs/melonJS
src/renderable/renderable.js
function (m) { var bounds = this.getBounds(); this.currentTransform.multiply(m); bounds.setPoints(bounds.transform(m).points); bounds.pos.setV(this.pos); return this; }
javascript
function (m) { var bounds = this.getBounds(); this.currentTransform.multiply(m); bounds.setPoints(bounds.transform(m).points); bounds.pos.setV(this.pos); return this; }
[ "function", "(", "m", ")", "{", "var", "bounds", "=", "this", ".", "getBounds", "(", ")", ";", "this", ".", "currentTransform", ".", "multiply", "(", "m", ")", ";", "bounds", ".", "setPoints", "(", "bounds", ".", "transform", "(", "m", ")", ".", "p...
multiply the renderable currentTransform with the given matrix @name transform @memberOf me.Renderable.prototype @see me.Renderable#currentTransform @function @param {me.Matrix2d} matrix the transformation matrix @return {me.Renderable} Reference to this object for method chaining
[ "multiply", "the", "renderable", "currentTransform", "with", "the", "given", "matrix" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/renderable/renderable.js#L416-L422
train
melonjs/melonJS
src/renderable/renderable.js
function (target) { var a = this.getBounds(); var ax, ay; if (target instanceof me.Renderable) { var b = target.getBounds(); ax = b.centerX - a.centerX; ay = b.centerY - a.centerY; } else { // vector object ...
javascript
function (target) { var a = this.getBounds(); var ax, ay; if (target instanceof me.Renderable) { var b = target.getBounds(); ax = b.centerX - a.centerX; ay = b.centerY - a.centerY; } else { // vector object ...
[ "function", "(", "target", ")", "{", "var", "a", "=", "this", ".", "getBounds", "(", ")", ";", "var", "ax", ",", "ay", ";", "if", "(", "target", "instanceof", "me", ".", "Renderable", ")", "{", "var", "b", "=", "target", ".", "getBounds", "(", ")...
return the angle to the specified target @name angleTo @memberOf me.Renderable @function @param {me.Renderable|me.Vector2d|me.Vector3d} target @return {Number} angle in radians
[ "return", "the", "angle", "to", "the", "specified", "target" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/renderable/renderable.js#L432-L446
train
melonjs/melonJS
src/renderable/renderable.js
function (target) { var a = this.getBounds(); var dx, dy; if (target instanceof me.Renderable) { var b = target.getBounds(); dx = a.centerX - b.centerX; dy = a.centerY - b.centerY; } else { // vector object ...
javascript
function (target) { var a = this.getBounds(); var dx, dy; if (target instanceof me.Renderable) { var b = target.getBounds(); dx = a.centerX - b.centerX; dy = a.centerY - b.centerY; } else { // vector object ...
[ "function", "(", "target", ")", "{", "var", "a", "=", "this", ".", "getBounds", "(", ")", ";", "var", "dx", ",", "dy", ";", "if", "(", "target", "instanceof", "me", ".", "Renderable", ")", "{", "var", "b", "=", "target", ".", "getBounds", "(", ")...
return the distance to the specified target @name distanceTo @memberOf me.Renderable @function @param {me.Renderable|me.Vector2d|me.Vector3d} target @return {Number} distance
[ "return", "the", "distance", "to", "the", "specified", "target" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/renderable/renderable.js#L456-L470
train
melonjs/melonJS
src/renderable/renderable.js
function (target) { var position; if (target instanceof me.Renderable) { position = target.pos; } else { position = target; } var angle = this.angleTo(position); this.rotate(angle); return this; ...
javascript
function (target) { var position; if (target instanceof me.Renderable) { position = target.pos; } else { position = target; } var angle = this.angleTo(position); this.rotate(angle); return this; ...
[ "function", "(", "target", ")", "{", "var", "position", ";", "if", "(", "target", "instanceof", "me", ".", "Renderable", ")", "{", "position", "=", "target", ".", "pos", ";", "}", "else", "{", "position", "=", "target", ";", "}", "var", "angle", "=",...
Rotate this renderable towards the given target. @name lookAt @memberOf me.Renderable.prototype @function @param {me.Renderable|me.Vector2d|me.Vector3d} target the renderable or position to look at @return {me.Renderable} Reference to this object for method chaining
[ "Rotate", "this", "renderable", "towards", "the", "given", "target", "." ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/renderable/renderable.js#L480-L494
train
melonjs/melonJS
src/math/matrix2.js
function (b) { b = b.val; var a = this.val, a0 = a[0], a1 = a[1], a3 = a[3], a4 = a[4], b0 = b[0], b1 = b[1], b3 = b[3], b4 = b[4], b6 = b[6], ...
javascript
function (b) { b = b.val; var a = this.val, a0 = a[0], a1 = a[1], a3 = a[3], a4 = a[4], b0 = b[0], b1 = b[1], b3 = b[3], b4 = b[4], b6 = b[6], ...
[ "function", "(", "b", ")", "{", "b", "=", "b", ".", "val", ";", "var", "a", "=", "this", ".", "val", ",", "a0", "=", "a", "[", "0", "]", ",", "a1", "=", "a", "[", "1", "]", ",", "a3", "=", "a", "[", "3", "]", ",", "a4", "=", "a", "[...
multiply both matrix @name multiply @memberOf me.Matrix2d @function @param {me.Matrix2d} b Other matrix @return {me.Matrix2d} Reference to this object for method chaining
[ "multiply", "both", "matrix" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/math/matrix2.js#L115-L137
train
melonjs/melonJS
src/math/matrix2.js
function () { var val = this.val; var a = val[ 0 ], b = val[ 1 ], c = val[ 2 ], d = val[ 3 ], e = val[ 4 ], f = val[ 5 ], g = val[ 6 ], h = val[ 7 ], i = val[ 8 ]; var ta = i * e - f * h, td = f * g - i * d, tg = h * d...
javascript
function () { var val = this.val; var a = val[ 0 ], b = val[ 1 ], c = val[ 2 ], d = val[ 3 ], e = val[ 4 ], f = val[ 5 ], g = val[ 6 ], h = val[ 7 ], i = val[ 8 ]; var ta = i * e - f * h, td = f * g - i * d, tg = h * d...
[ "function", "(", ")", "{", "var", "val", "=", "this", ".", "val", ";", "var", "a", "=", "val", "[", "0", "]", ",", "b", "=", "val", "[", "1", "]", ",", "c", "=", "val", "[", "2", "]", ",", "d", "=", "val", "[", "3", "]", ",", "e", "="...
invert this matrix, causing it to apply the opposite transformation. @name invert @memberOf me.Matrix2d @function @return {me.Matrix2d} Reference to this object for method chaining
[ "invert", "this", "matrix", "causing", "it", "to", "apply", "the", "opposite", "transformation", "." ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/math/matrix2.js#L169-L195
train
melonjs/melonJS
src/math/matrix2.js
function (v) { var a = this.val, x = v.x, y = v.y; v.x = x * a[0] + y * a[3] + a[6]; v.y = x * a[1] + y * a[4] + a[7]; return v; }
javascript
function (v) { var a = this.val, x = v.x, y = v.y; v.x = x * a[0] + y * a[3] + a[6]; v.y = x * a[1] + y * a[4] + a[7]; return v; }
[ "function", "(", "v", ")", "{", "var", "a", "=", "this", ".", "val", ",", "x", "=", "v", ".", "x", ",", "y", "=", "v", ".", "y", ";", "v", ".", "x", "=", "x", "*", "a", "[", "0", "]", "+", "y", "*", "a", "[", "3", "]", "+", "a", "...
Transforms the given vector according to this matrix. @name multiplyVector @memberOf me.Matrix2d @function @param {me.Vector2d} vector the vector object to be transformed @return {me.Vector2d} result vector object. Useful for chaining method calls.
[ "Transforms", "the", "given", "vector", "according", "to", "this", "matrix", "." ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/math/matrix2.js#L205-L214
train
melonjs/melonJS
src/math/matrix2.js
function (x, y) { var a = this.val, _x = x, _y = typeof(y) === "undefined" ? _x : y; a[0] *= _x; a[1] *= _x; a[3] *= _y; a[4] *= _y; return this; }
javascript
function (x, y) { var a = this.val, _x = x, _y = typeof(y) === "undefined" ? _x : y; a[0] *= _x; a[1] *= _x; a[3] *= _y; a[4] *= _y; return this; }
[ "function", "(", "x", ",", "y", ")", "{", "var", "a", "=", "this", ".", "val", ",", "_x", "=", "x", ",", "_y", "=", "typeof", "(", "y", ")", "===", "\"undefined\"", "?", "_x", ":", "y", ";", "a", "[", "0", "]", "*=", "_x", ";", "a", "[", ...
scale the matrix @name scale @memberOf me.Matrix2d @function @param {Number} x a number representing the abscissa of the scaling vector. @param {Number} [y=x] a number representing the ordinate of the scaling vector. @return {me.Matrix2d} Reference to this object for method chaining
[ "scale", "the", "matrix" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/math/matrix2.js#L246-L257
train
melonjs/melonJS
src/math/matrix2.js
function (x, y) { var a = this.val; a[6] += a[0] * x + a[3] * y; a[7] += a[1] * x + a[4] * y; return this; }
javascript
function (x, y) { var a = this.val; a[6] += a[0] * x + a[3] * y; a[7] += a[1] * x + a[4] * y; return this; }
[ "function", "(", "x", ",", "y", ")", "{", "var", "a", "=", "this", ".", "val", ";", "a", "[", "6", "]", "+=", "a", "[", "0", "]", "*", "x", "+", "a", "[", "3", "]", "*", "y", ";", "a", "[", "7", "]", "+=", "a", "[", "1", "]", "*", ...
translate the matrix position on the horizontal and vertical axis @name translate @memberOf me.Matrix2d @function @param {Number} x the x coordindates to translate the matrix by @param {Number} y the y coordindates to translate the matrix by @return {me.Matrix2d} Reference to this object for method chaining
[ "translate", "the", "matrix", "position", "on", "the", "horizontal", "and", "vertical", "axis" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/math/matrix2.js#L335-L342
train
melonjs/melonJS
src/video/renderer.js
function (width, height) { if (width !== this.backBufferCanvas.width || height !== this.backBufferCanvas.height) { this.canvas.width = this.backBufferCanvas.width = width; this.canvas.height = this.backBufferCanvas.height = height; this.currentScissor[0] = 0; ...
javascript
function (width, height) { if (width !== this.backBufferCanvas.width || height !== this.backBufferCanvas.height) { this.canvas.width = this.backBufferCanvas.width = width; this.canvas.height = this.backBufferCanvas.height = height; this.currentScissor[0] = 0; ...
[ "function", "(", "width", ",", "height", ")", "{", "if", "(", "width", "!==", "this", ".", "backBufferCanvas", ".", "width", "||", "height", "!==", "this", ".", "backBufferCanvas", ".", "height", ")", "{", "this", ".", "canvas", ".", "width", "=", "thi...
resizes the system canvas @name resize @memberOf me.Renderer.prototype @function @param {Number} width new width of the canvas @param {Number} height new height of the canvas
[ "resizes", "the", "system", "canvas" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/video/renderer.js#L288-L300
train
melonjs/melonJS
src/camera/camera2d.js
function (x, y) { var _x = this.pos.x; var _y = this.pos.y; this.pos.x = me.Math.clamp( x, this.bounds.pos.x, this.bounds.width - this.width ); this.pos.y = me.Math.clamp( y, this...
javascript
function (x, y) { var _x = this.pos.x; var _y = this.pos.y; this.pos.x = me.Math.clamp( x, this.bounds.pos.x, this.bounds.width - this.width ); this.pos.y = me.Math.clamp( y, this...
[ "function", "(", "x", ",", "y", ")", "{", "var", "_x", "=", "this", ".", "pos", ".", "x", ";", "var", "_y", "=", "this", ".", "pos", ".", "y", ";", "this", ".", "pos", ".", "x", "=", "me", ".", "Math", ".", "clamp", "(", "x", ",", "this",...
move the camera upper-left position to the specified coordinates @name moveTo @memberOf me.Camera2d @see me.Camera2d.focusOn @function @param {Number} x @param {Number} y
[ "move", "the", "camera", "upper", "-", "left", "position", "to", "the", "specified", "coordinates" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/camera/camera2d.js#L338-L357
train
melonjs/melonJS
src/camera/camera2d.js
function (target) { var bounds = target.getBounds(); this.moveTo( target.pos.x + bounds.pos.x + (bounds.width / 2), target.pos.y + bounds.pos.y + (bounds.height / 2) ); }
javascript
function (target) { var bounds = target.getBounds(); this.moveTo( target.pos.x + bounds.pos.x + (bounds.width / 2), target.pos.y + bounds.pos.y + (bounds.height / 2) ); }
[ "function", "(", "target", ")", "{", "var", "bounds", "=", "target", ".", "getBounds", "(", ")", ";", "this", ".", "moveTo", "(", "target", ".", "pos", ".", "x", "+", "bounds", ".", "pos", ".", "x", "+", "(", "bounds", ".", "width", "/", "2", "...
set the camera position around the specified object @name focusOn @memberOf me.Camera2d @function @param {me.Renderable}
[ "set", "the", "camera", "position", "around", "the", "specified", "object" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/camera/camera2d.js#L551-L557
train
melonjs/melonJS
src/camera/camera2d.js
function (obj, floating) { if (floating === true || obj.floating === true) { // check against screen coordinates return me.video.renderer.overlaps(obj.getBounds()); } else { // check if within the current camera return obj.getBounds...
javascript
function (obj, floating) { if (floating === true || obj.floating === true) { // check against screen coordinates return me.video.renderer.overlaps(obj.getBounds()); } else { // check if within the current camera return obj.getBounds...
[ "function", "(", "obj", ",", "floating", ")", "{", "if", "(", "floating", "===", "true", "||", "obj", ".", "floating", "===", "true", ")", "{", "// check against screen coordinates", "return", "me", ".", "video", ".", "renderer", ".", "overlaps", "(", "obj...
check if the specified renderable is in the camera @name isVisible @memberOf me.Camera2d @function @param {me.Renderable} object @param {Boolean} [floating===object.floating] if visibility check should be done against screen coordinates @return {Boolean}
[ "check", "if", "the", "specified", "renderable", "is", "in", "the", "camera" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/camera/camera2d.js#L568-L576
train
melonjs/melonJS
examples/isometric_rpg/js/screens/play.js
function (event) { var tile = this.refLayer.getTile(event.gameWorldX, event.gameWorldY); if (tile && tile !== this.currentTile) { // get the tile x/y world isometric coordinates this.refLayer.getRenderer().tileToPixelCoords(tile.col, tile.row, this...
javascript
function (event) { var tile = this.refLayer.getTile(event.gameWorldX, event.gameWorldY); if (tile && tile !== this.currentTile) { // get the tile x/y world isometric coordinates this.refLayer.getRenderer().tileToPixelCoords(tile.col, tile.row, this...
[ "function", "(", "event", ")", "{", "var", "tile", "=", "this", ".", "refLayer", ".", "getTile", "(", "event", ".", "gameWorldX", ",", "event", ".", "gameWorldY", ")", ";", "if", "(", "tile", "&&", "tile", "!==", "this", ".", "currentTile", ")", "{",...
pointer move event callback
[ "pointer", "move", "event", "callback" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/examples/isometric_rpg/js/screens/play.js#L51-L65
train
melonjs/melonJS
src/level/tiled/renderer/TMXIsometricRenderer.js
function (obj) { var tileX = obj.x / this.hTilewidth; var tileY = obj.y / this.tileheight; var isoPos = me.pool.pull("me.Vector2d"); this.tileToPixelCoords(tileX, tileY, isoPos); obj.x = isoPos.x; obj.y = isoPos.y; me.pool.push(isoPo...
javascript
function (obj) { var tileX = obj.x / this.hTilewidth; var tileY = obj.y / this.tileheight; var isoPos = me.pool.pull("me.Vector2d"); this.tileToPixelCoords(tileX, tileY, isoPos); obj.x = isoPos.x; obj.y = isoPos.y; me.pool.push(isoPo...
[ "function", "(", "obj", ")", "{", "var", "tileX", "=", "obj", ".", "x", "/", "this", ".", "hTilewidth", ";", "var", "tileY", "=", "obj", ".", "y", "/", "this", ".", "tileheight", ";", "var", "isoPos", "=", "me", ".", "pool", ".", "pull", "(", "...
fix the position of Objects to match the way Tiled places them @ignore
[ "fix", "the", "position", "of", "Objects", "to", "match", "the", "way", "Tiled", "places", "them" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/level/tiled/renderer/TMXIsometricRenderer.js#L84-L95
train
melonjs/melonJS
src/level/tiled/TMXLayer.js
function (x, y) { if (this.containsPoint(x, y)) { var renderer = this.renderer; var tile = null; var coord = renderer.pixelToTileCoords(x, y, me.pool.pull("me.Vector2d")); if ((coord.x >= 0 && coord.x < renderer.cols) && ( coord.y >= 0 && coord...
javascript
function (x, y) { if (this.containsPoint(x, y)) { var renderer = this.renderer; var tile = null; var coord = renderer.pixelToTileCoords(x, y, me.pool.pull("me.Vector2d")); if ((coord.x >= 0 && coord.x < renderer.cols) && ( coord.y >= 0 && coord...
[ "function", "(", "x", ",", "y", ")", "{", "if", "(", "this", ".", "containsPoint", "(", "x", ",", "y", ")", ")", "{", "var", "renderer", "=", "this", ".", "renderer", ";", "var", "tile", "=", "null", ";", "var", "coord", "=", "renderer", ".", "...
Return the Tile object at the specified position @name getTile @memberOf me.TMXLayer @public @function @param {Number} x X coordinate (in world/pixels coordinates) @param {Number} y Y coordinate (in world/pixels coordinates) @return {me.Tile} corresponding tile or null if outside of the map area @example // get the TMX...
[ "Return", "the", "Tile", "object", "at", "the", "specified", "position" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/level/tiled/TMXLayer.js#L264-L275
train
melonjs/melonJS
src/level/tiled/TMXLayer.js
function (x, y) { // clearing tile this.layerData[x][y] = null; // erase the corresponding area in the canvas if (this.preRender) { this.canvasRenderer.clearRect(x * this.tilewidth, y * this.tileheight, this.tilewidth, this.tileheight); } ...
javascript
function (x, y) { // clearing tile this.layerData[x][y] = null; // erase the corresponding area in the canvas if (this.preRender) { this.canvasRenderer.clearRect(x * this.tilewidth, y * this.tileheight, this.tilewidth, this.tileheight); } ...
[ "function", "(", "x", ",", "y", ")", "{", "// clearing tile", "this", ".", "layerData", "[", "x", "]", "[", "y", "]", "=", "null", ";", "// erase the corresponding area in the canvas", "if", "(", "this", ".", "preRender", ")", "{", "this", ".", "canvasRend...
clear the tile at the specified position @name clearTile @memberOf me.TMXLayer @public @function @param {Number} x X coordinate (in map coordinates: row/column) @param {Number} y Y coordinate (in map coordinates: row/column) @example me.game.world.getChildByType(me.TMXLayer).forEach(function(layer) { // clear all tiles...
[ "clear", "the", "tile", "at", "the", "specified", "position" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/level/tiled/TMXLayer.js#L315-L322
train
melonjs/melonJS
src/level/tiled/TMXLayer.js
function (dt) { if (this.isAnimated) { var result = false; for (var i = 0; i < this.animatedTilesets.length; i++) { result = this.animatedTilesets[i].update(dt) || result; } return result; } return f...
javascript
function (dt) { if (this.isAnimated) { var result = false; for (var i = 0; i < this.animatedTilesets.length; i++) { result = this.animatedTilesets[i].update(dt) || result; } return result; } return f...
[ "function", "(", "dt", ")", "{", "if", "(", "this", ".", "isAnimated", ")", "{", "var", "result", "=", "false", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "animatedTilesets", ".", "length", ";", "i", "++", ")", "{", "res...
update animations in a tileset layer @ignore
[ "update", "animations", "in", "a", "tileset", "layer" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/level/tiled/TMXLayer.js#L328-L338
train
melonjs/melonJS
src/level/tiled/TMXLayer.js
function (renderer, rect) { // use the offscreen canvas if (this.preRender) { var width = Math.min(rect.width, this.width); var height = Math.min(rect.height, this.height); // draw using the cached canvas renderer.drawImage( ...
javascript
function (renderer, rect) { // use the offscreen canvas if (this.preRender) { var width = Math.min(rect.width, this.width); var height = Math.min(rect.height, this.height); // draw using the cached canvas renderer.drawImage( ...
[ "function", "(", "renderer", ",", "rect", ")", "{", "// use the offscreen canvas", "if", "(", "this", ".", "preRender", ")", "{", "var", "width", "=", "Math", ".", "min", "(", "rect", ".", "width", ",", "this", ".", "width", ")", ";", "var", "height", ...
draw a tileset layer @ignore
[ "draw", "a", "tileset", "layer" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/level/tiled/TMXLayer.js#L344-L364
train
melonjs/melonJS
src/shapes/ellipse.js
function () { return new me.Ellipse( this.pos.x, this.pos.y, this.radiusV.x * 2, this.radiusV.y * 2 ); }
javascript
function () { return new me.Ellipse( this.pos.x, this.pos.y, this.radiusV.x * 2, this.radiusV.y * 2 ); }
[ "function", "(", ")", "{", "return", "new", "me", ".", "Ellipse", "(", "this", ".", "pos", ".", "x", ",", "this", ".", "pos", ".", "y", ",", "this", ".", "radiusV", ".", "x", "*", "2", ",", "this", ".", "radiusV", ".", "y", "*", "2", ")", "...
clone this Ellipse @name clone @memberOf me.Ellipse.prototype @function @return {me.Ellipse} new Ellipse
[ "clone", "this", "Ellipse" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/shapes/ellipse.js#L265-L272
train
melonjs/melonJS
examples/platformer/js/entities/controls.js
function (x, y) { if (x - this.pos.x < this.width / 2) { if (this.cursors.left === false) { me.input.triggerKeyEvent(me.input.KEY.LEFT, true); this.cursors.left = true; this.joypad_offset.x = -((this.width / 2 - (x - this.pos.x)) % this.pad.width / 4);...
javascript
function (x, y) { if (x - this.pos.x < this.width / 2) { if (this.cursors.left === false) { me.input.triggerKeyEvent(me.input.KEY.LEFT, true); this.cursors.left = true; this.joypad_offset.x = -((this.width / 2 - (x - this.pos.x)) % this.pad.width / 4);...
[ "function", "(", "x", ",", "y", ")", "{", "if", "(", "x", "-", "this", ".", "pos", ".", "x", "<", "this", ".", "width", "/", "2", ")", "{", "if", "(", "this", ".", "cursors", ".", "left", "===", "false", ")", "{", "me", ".", "input", ".", ...
update the cursors value and trigger key event
[ "update", "the", "cursors", "value", "and", "trigger", "key", "event" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/examples/platformer/js/entities/controls.js#L168-L193
train
melonjs/melonJS
examples/platformer/js/entities/controls.js
function (event) { this.setOpacity(0.25); if (this.cursors.left === true) { me.input.triggerKeyEvent(me.input.KEY.LEFT, false); this.cursors.left = false; } if (this.cursors.right === true) { me.input.triggerKeyEvent(me.input.KEY.RIGHT, false); ...
javascript
function (event) { this.setOpacity(0.25); if (this.cursors.left === true) { me.input.triggerKeyEvent(me.input.KEY.LEFT, false); this.cursors.left = false; } if (this.cursors.right === true) { me.input.triggerKeyEvent(me.input.KEY.RIGHT, false); ...
[ "function", "(", "event", ")", "{", "this", ".", "setOpacity", "(", "0.25", ")", ";", "if", "(", "this", ".", "cursors", ".", "left", "===", "true", ")", "{", "me", ".", "input", ".", "triggerKeyEvent", "(", "me", ".", "input", ".", "KEY", ".", "...
function called when the object is release or cancelled
[ "function", "called", "when", "the", "object", "is", "release", "or", "cancelled" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/examples/platformer/js/entities/controls.js#L209-L221
train
melonjs/melonJS
examples/platformer/js/entities/controls.js
function (renderer) { // call the super constructor this._super(me.GUI_Object, "draw", [ renderer ]); this.pad.pos.setV(this.pos).add(this.relative).add(this.joypad_offset); this.pad.draw(renderer); }
javascript
function (renderer) { // call the super constructor this._super(me.GUI_Object, "draw", [ renderer ]); this.pad.pos.setV(this.pos).add(this.relative).add(this.joypad_offset); this.pad.draw(renderer); }
[ "function", "(", "renderer", ")", "{", "// call the super constructor", "this", ".", "_super", "(", "me", ".", "GUI_Object", ",", "\"draw\"", ",", "[", "renderer", "]", ")", ";", "this", ".", "pad", ".", "pos", ".", "setV", "(", "this", ".", "pos", ")"...
extend the draw function
[ "extend", "the", "draw", "function" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/examples/platformer/js/entities/controls.js#L226-L231
train
melonjs/melonJS
examples/whack-a-mole/js/entities/entities.js
function() { if (this.isOut === true) { this.isOut = false; // set touch animation this.setCurrentAnimation("touch", this.hide.bind(this)); // make it flicker this.flicker(750); // play ow FX me.audio.play("ow"); //...
javascript
function() { if (this.isOut === true) { this.isOut = false; // set touch animation this.setCurrentAnimation("touch", this.hide.bind(this)); // make it flicker this.flicker(750); // play ow FX me.audio.play("ow"); //...
[ "function", "(", ")", "{", "if", "(", "this", ".", "isOut", "===", "true", ")", "{", "this", ".", "isOut", "=", "false", ";", "// set touch animation", "this", ".", "setCurrentAnimation", "(", "\"touch\"", ",", "this", ".", "hide", ".", "bind", "(", "t...
callback for mouse click
[ "callback", "for", "mouse", "click" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/examples/whack-a-mole/js/entities/entities.js#L46-L72
train
melonjs/melonJS
examples/whack-a-mole/js/entities/entities.js
function() { var finalpos = this.initialPos - 140; this.displayTween = me.pool.pull("me.Tween", this.pos).to({y: finalpos }, 200); this.displayTween.easing(me.Tween.Easing.Quadratic.Out); this.displayTween.onComplete(this.onDisplayed.bind(this)); this.displayTween.start(); ...
javascript
function() { var finalpos = this.initialPos - 140; this.displayTween = me.pool.pull("me.Tween", this.pos).to({y: finalpos }, 200); this.displayTween.easing(me.Tween.Easing.Quadratic.Out); this.displayTween.onComplete(this.onDisplayed.bind(this)); this.displayTween.start(); ...
[ "function", "(", ")", "{", "var", "finalpos", "=", "this", ".", "initialPos", "-", "140", ";", "this", ".", "displayTween", "=", "me", ".", "pool", ".", "pull", "(", "\"me.Tween\"", ",", "this", ".", "pos", ")", ".", "to", "(", "{", "y", ":", "fi...
display the mole goes out of the hole
[ "display", "the", "mole", "goes", "out", "of", "the", "hole" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/examples/whack-a-mole/js/entities/entities.js#L79-L87
train
melonjs/melonJS
examples/whack-a-mole/js/entities/entities.js
function() { var finalpos = this.initialPos; this.displayTween = me.pool.pull("me.Tween", this.pos).to({y: finalpos }, 200); this.displayTween.easing(me.Tween.Easing.Quadratic.In); this.displayTween.onComplete(this.onHidden.bind(this)); this.displayTween.start(); }
javascript
function() { var finalpos = this.initialPos; this.displayTween = me.pool.pull("me.Tween", this.pos).to({y: finalpos }, 200); this.displayTween.easing(me.Tween.Easing.Quadratic.In); this.displayTween.onComplete(this.onHidden.bind(this)); this.displayTween.start(); }
[ "function", "(", ")", "{", "var", "finalpos", "=", "this", ".", "initialPos", ";", "this", ".", "displayTween", "=", "me", ".", "pool", ".", "pull", "(", "\"me.Tween\"", ",", "this", ".", "pos", ")", ".", "to", "(", "{", "y", ":", "finalpos", "}", ...
hide the mole goes into the hole
[ "hide", "the", "mole", "goes", "into", "the", "hole" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/examples/whack-a-mole/js/entities/entities.js#L101-L107
train
melonjs/melonJS
examples/whack-a-mole/js/entities/entities.js
function ( dt ) { if (this.isVisible) { // call the super function to manage animation this._super(me.Sprite, "update", [dt] ); // hide the mode after 1/2 sec if (this.isOut===true) { this.timer += dt; if ((this.timer) >= 500) ...
javascript
function ( dt ) { if (this.isVisible) { // call the super function to manage animation this._super(me.Sprite, "update", [dt] ); // hide the mode after 1/2 sec if (this.isOut===true) { this.timer += dt; if ((this.timer) >= 500) ...
[ "function", "(", "dt", ")", "{", "if", "(", "this", ".", "isVisible", ")", "{", "// call the super function to manage animation", "this", ".", "_super", "(", "me", ".", "Sprite", ",", "\"update\"", ",", "[", "dt", "]", ")", ";", "// hide the mode after 1/2 sec...
update the mole
[ "update", "the", "mole" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/examples/whack-a-mole/js/entities/entities.js#L122-L150
train
melonjs/melonJS
src/input/keyboard.js
function (e, keyCode, mouseButton) { keyCode = keyCode || e.keyCode || e.button; var action = keyBindings[keyCode]; // publish a message for keydown event me.event.publish(me.event.KEYDOWN, [ action, keyCode, action ? !keyLocked[action] : true ...
javascript
function (e, keyCode, mouseButton) { keyCode = keyCode || e.keyCode || e.button; var action = keyBindings[keyCode]; // publish a message for keydown event me.event.publish(me.event.KEYDOWN, [ action, keyCode, action ? !keyLocked[action] : true ...
[ "function", "(", "e", ",", "keyCode", ",", "mouseButton", ")", "{", "keyCode", "=", "keyCode", "||", "e", ".", "keyCode", "||", "e", ".", "button", ";", "var", "action", "=", "keyBindings", "[", "keyCode", "]", ";", "// publish a message for keydown event", ...
key down event @ignore
[ "key", "down", "event" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/input/keyboard.js#L27-L58
train
melonjs/melonJS
src/renderable/container.js
function () { // cancel any sort operation if (this.pendingSort) { clearTimeout(this.pendingSort); this.pendingSort = null; } // delete all children for (var i = this.children.length, obj; i >= 0; (obj = this.children[--i])) { ...
javascript
function () { // cancel any sort operation if (this.pendingSort) { clearTimeout(this.pendingSort); this.pendingSort = null; } // delete all children for (var i = this.children.length, obj; i >= 0; (obj = this.children[--i])) { ...
[ "function", "(", ")", "{", "// cancel any sort operation", "if", "(", "this", ".", "pendingSort", ")", "{", "clearTimeout", "(", "this", ".", "pendingSort", ")", ";", "this", ".", "pendingSort", "=", "null", ";", "}", "// delete all children", "for", "(", "v...
reset the container, removing all childrens, and reseting transforms. @name reset @memberOf me.Container @function
[ "reset", "the", "container", "removing", "all", "childrens", "and", "reseting", "transforms", "." ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/renderable/container.js#L145-L164
train
melonjs/melonJS
src/renderable/container.js
function (a, b) { if (!b.pos || !a.pos) { return (a.pos ? -Infinity : Infinity); } var result = b.pos.z - a.pos.z; return (result ? result : (b.pos.x - a.pos.x)); }
javascript
function (a, b) { if (!b.pos || !a.pos) { return (a.pos ? -Infinity : Infinity); } var result = b.pos.z - a.pos.z; return (result ? result : (b.pos.x - a.pos.x)); }
[ "function", "(", "a", ",", "b", ")", "{", "if", "(", "!", "b", ".", "pos", "||", "!", "a", ".", "pos", ")", "{", "return", "(", "a", ".", "pos", "?", "-", "Infinity", ":", "Infinity", ")", ";", "}", "var", "result", "=", "b", ".", "pos", ...
X Sorting function @ignore
[ "X", "Sorting", "function" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/renderable/container.js#L773-L779
train
melonjs/melonJS
src/renderable/container.js
function (a, b) { if (!b.pos || !a.pos) { return (a.pos ? -Infinity : Infinity); } var result = b.pos.z - a.pos.z; return (result ? result : (b.pos.y - a.pos.y)); }
javascript
function (a, b) { if (!b.pos || !a.pos) { return (a.pos ? -Infinity : Infinity); } var result = b.pos.z - a.pos.z; return (result ? result : (b.pos.y - a.pos.y)); }
[ "function", "(", "a", ",", "b", ")", "{", "if", "(", "!", "b", ".", "pos", "||", "!", "a", ".", "pos", ")", "{", "return", "(", "a", ".", "pos", "?", "-", "Infinity", ":", "Infinity", ")", ";", "}", "var", "result", "=", "b", ".", "pos", ...
Y Sorting function @ignore
[ "Y", "Sorting", "function" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/renderable/container.js#L785-L791
train
melonjs/melonJS
src/renderable/imagelayer.js
function (renderer) { var viewport = me.game.viewport, width = this.imagewidth, height = this.imageheight, bw = viewport.bounds.width, bh = viewport.bounds.height, ax = this.anchorPoint.x, ay = this.anchorPoint.y...
javascript
function (renderer) { var viewport = me.game.viewport, width = this.imagewidth, height = this.imageheight, bw = viewport.bounds.width, bh = viewport.bounds.height, ax = this.anchorPoint.x, ay = this.anchorPoint.y...
[ "function", "(", "renderer", ")", "{", "var", "viewport", "=", "me", ".", "game", ".", "viewport", ",", "width", "=", "this", ".", "imagewidth", ",", "height", "=", "this", ".", "imageheight", ",", "bw", "=", "viewport", ".", "bounds", ".", "width", ...
draw the image layer @ignore
[ "draw", "the", "image", "layer" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/renderable/imagelayer.js#L275-L299
train
melonjs/melonJS
examples/drag-and-drop/js/entities/entities.js
function (e) { // save a reference to this to use in the timeout var self = this; // call the super function this._super(me.DroptargetEntity, "draw", [e]); // indicate a succesful drop this.color = "green"; // set the color back to red after a second windo...
javascript
function (e) { // save a reference to this to use in the timeout var self = this; // call the super function this._super(me.DroptargetEntity, "draw", [e]); // indicate a succesful drop this.color = "green"; // set the color back to red after a second windo...
[ "function", "(", "e", ")", "{", "// save a reference to this to use in the timeout", "var", "self", "=", "this", ";", "// call the super function", "this", ".", "_super", "(", "me", ".", "DroptargetEntity", ",", "\"draw\"", ",", "[", "e", "]", ")", ";", "// indi...
drop overwrite function
[ "drop", "overwrite", "function" ]
6c1823cc245df7c958db243a0531506eb838d72c
https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/examples/drag-and-drop/js/entities/entities.js#L79-L90
train
serverless-heaven/serverless-webpack
lib/packExternalModules.js
addModulesToPackageJson
function addModulesToPackageJson(externalModules, packageJson, pathToPackageRoot) { _.forEach(externalModules, externalModule => { const splitModule = _.split(externalModule, '@'); // If we have a scoped module we have to re-add the @ if (_.startsWith(externalModule, '@')) { splitModule.splice(0, 1)...
javascript
function addModulesToPackageJson(externalModules, packageJson, pathToPackageRoot) { _.forEach(externalModules, externalModule => { const splitModule = _.split(externalModule, '@'); // If we have a scoped module we have to re-add the @ if (_.startsWith(externalModule, '@')) { splitModule.splice(0, 1)...
[ "function", "addModulesToPackageJson", "(", "externalModules", ",", "packageJson", ",", "pathToPackageRoot", ")", "{", "_", ".", "forEach", "(", "externalModules", ",", "externalModule", "=>", "{", "const", "splitModule", "=", "_", ".", "split", "(", "externalModu...
Add the given modules to a package json's dependencies.
[ "Add", "the", "given", "modules", "to", "a", "package", "json", "s", "dependencies", "." ]
fc2cffdce9f9a74a5e04f6ac527ed4fbb7b69699
https://github.com/serverless-heaven/serverless-webpack/blob/fc2cffdce9f9a74a5e04f6ac527ed4fbb7b69699/lib/packExternalModules.js#L23-L37
train
serverless-heaven/serverless-webpack
lib/packExternalModules.js
removeExcludedModules
function removeExcludedModules(modules, packageForceExcludes, log) { const excludedModules = _.remove(modules, externalModule => { // eslint-disable-line lodash/prefer-immutable-method const splitModule = _.split(externalModule, '@'); // If we have a scoped module we have to re-add the @ if (_.startsWit...
javascript
function removeExcludedModules(modules, packageForceExcludes, log) { const excludedModules = _.remove(modules, externalModule => { // eslint-disable-line lodash/prefer-immutable-method const splitModule = _.split(externalModule, '@'); // If we have a scoped module we have to re-add the @ if (_.startsWit...
[ "function", "removeExcludedModules", "(", "modules", ",", "packageForceExcludes", ",", "log", ")", "{", "const", "excludedModules", "=", "_", ".", "remove", "(", "modules", ",", "externalModule", "=>", "{", "// eslint-disable-line lodash/prefer-immutable-method", "const...
Remove a given list of excluded modules from a module list @this - The active plugin instance
[ "Remove", "a", "given", "list", "of", "excluded", "modules", "from", "a", "module", "list" ]
fc2cffdce9f9a74a5e04f6ac527ed4fbb7b69699
https://github.com/serverless-heaven/serverless-webpack/blob/fc2cffdce9f9a74a5e04f6ac527ed4fbb7b69699/lib/packExternalModules.js#L43-L58
train
serverless-heaven/serverless-webpack
lib/packExternalModules.js
getProdModules
function getProdModules(externalModules, packagePath, dependencyGraph, forceExcludes) { const packageJsonPath = path.join(process.cwd(), packagePath); const packageJson = require(packageJsonPath); const prodModules = []; // only process the module stated in dependencies section if (!packageJson.dependencies)...
javascript
function getProdModules(externalModules, packagePath, dependencyGraph, forceExcludes) { const packageJsonPath = path.join(process.cwd(), packagePath); const packageJson = require(packageJsonPath); const prodModules = []; // only process the module stated in dependencies section if (!packageJson.dependencies)...
[ "function", "getProdModules", "(", "externalModules", ",", "packagePath", ",", "dependencyGraph", ",", "forceExcludes", ")", "{", "const", "packageJsonPath", "=", "path", ".", "join", "(", "process", ".", "cwd", "(", ")", ",", "packagePath", ")", ";", "const",...
Resolve the needed versions of production dependencies for external modules. @this - The active plugin instance
[ "Resolve", "the", "needed", "versions", "of", "production", "dependencies", "for", "external", "modules", "." ]
fc2cffdce9f9a74a5e04f6ac527ed4fbb7b69699
https://github.com/serverless-heaven/serverless-webpack/blob/fc2cffdce9f9a74a5e04f6ac527ed4fbb7b69699/lib/packExternalModules.js#L64-L124
train
serverless-heaven/serverless-webpack
lib/packExternalModules.js
findExternalOrigin
function findExternalOrigin(issuer) { if (!_.isNil(issuer) && _.startsWith(issuer.rawRequest, './')) { return findExternalOrigin(issuer.issuer); } return issuer; }
javascript
function findExternalOrigin(issuer) { if (!_.isNil(issuer) && _.startsWith(issuer.rawRequest, './')) { return findExternalOrigin(issuer.issuer); } return issuer; }
[ "function", "findExternalOrigin", "(", "issuer", ")", "{", "if", "(", "!", "_", ".", "isNil", "(", "issuer", ")", "&&", "_", ".", "startsWith", "(", "issuer", ".", "rawRequest", ",", "'./'", ")", ")", "{", "return", "findExternalOrigin", "(", "issuer", ...
Find the original module that required the transient dependency. Returns undefined if the module is a first level dependency. @param {Object} issuer - Module issuer
[ "Find", "the", "original", "module", "that", "required", "the", "transient", "dependency", ".", "Returns", "undefined", "if", "the", "module", "is", "a", "first", "level", "dependency", "." ]
fc2cffdce9f9a74a5e04f6ac527ed4fbb7b69699
https://github.com/serverless-heaven/serverless-webpack/blob/fc2cffdce9f9a74a5e04f6ac527ed4fbb7b69699/lib/packExternalModules.js#L148-L153
train
serverless-heaven/serverless-webpack
lib/utils.js
purgeCache
function purgeCache(moduleName) { return searchAndProcessCache(moduleName, function (mod) { delete require.cache[mod.id]; }) .then(() => { _.forEach(_.keys(module.constructor._pathCache), function(cacheKey) { if (cacheKey.indexOf(moduleName)>0) { delete module.constructor._pathCache[cacheKey...
javascript
function purgeCache(moduleName) { return searchAndProcessCache(moduleName, function (mod) { delete require.cache[mod.id]; }) .then(() => { _.forEach(_.keys(module.constructor._pathCache), function(cacheKey) { if (cacheKey.indexOf(moduleName)>0) { delete module.constructor._pathCache[cacheKey...
[ "function", "purgeCache", "(", "moduleName", ")", "{", "return", "searchAndProcessCache", "(", "moduleName", ",", "function", "(", "mod", ")", "{", "delete", "require", ".", "cache", "[", "mod", ".", "id", "]", ";", "}", ")", ".", "then", "(", "(", ")"...
Remove the specified module from the require cache. @param {string} moduleName
[ "Remove", "the", "specified", "module", "from", "the", "require", "cache", "." ]
fc2cffdce9f9a74a5e04f6ac527ed4fbb7b69699
https://github.com/serverless-heaven/serverless-webpack/blob/fc2cffdce9f9a74a5e04f6ac527ed4fbb7b69699/lib/utils.js#L20-L32
train
SAP/fundamental
docs/js/customscripts.js
getBlock
function getBlock(control) { var block = control.parentNode; while (block.getAttribute("role") !== "tablist") { block = block.parentNode; } return block; }
javascript
function getBlock(control) { var block = control.parentNode; while (block.getAttribute("role") !== "tablist") { block = block.parentNode; } return block; }
[ "function", "getBlock", "(", "control", ")", "{", "var", "block", "=", "control", ".", "parentNode", ";", "while", "(", "block", ".", "getAttribute", "(", "\"role\"", ")", "!==", "\"tablist\"", ")", "{", "block", "=", "block", ".", "parentNode", ";", "}"...
climb up DOM to get block element
[ "climb", "up", "DOM", "to", "get", "block", "element" ]
1b10ee982d42b7bcd95d6bb4249ebe026afd9a68
https://github.com/SAP/fundamental/blob/1b10ee982d42b7bcd95d6bb4249ebe026afd9a68/docs/js/customscripts.js#L99-L105
train
SAP/fundamental
docs/js/jquery.shuffle.min.js
dashify
function dashify( prop ) { if (!prop) { return ''; } // Replace upper case with dash-lowercase, // then fix ms- prefixes because they're not capitalized. return prop.replace(/([A-Z])/g, function( str, m1 ) { return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-'); }
javascript
function dashify( prop ) { if (!prop) { return ''; } // Replace upper case with dash-lowercase, // then fix ms- prefixes because they're not capitalized. return prop.replace(/([A-Z])/g, function( str, m1 ) { return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-'); }
[ "function", "dashify", "(", "prop", ")", "{", "if", "(", "!", "prop", ")", "{", "return", "''", ";", "}", "// Replace upper case with dash-lowercase,", "// then fix ms- prefixes because they're not capitalized.", "return", "prop", ".", "replace", "(", "/", "([A-Z])", ...
Returns css prefixed properties like `-webkit-transition` or `box-sizing` from `transition` or `boxSizing`, respectively. @param {(string|boolean)} prop Property to be prefixed. @return {string} The prefixed css property.
[ "Returns", "css", "prefixed", "properties", "like", "-", "webkit", "-", "transition", "or", "box", "-", "sizing", "from", "transition", "or", "boxSizing", "respectively", "." ]
1b10ee982d42b7bcd95d6bb4249ebe026afd9a68
https://github.com/SAP/fundamental/blob/1b10ee982d42b7bcd95d6bb4249ebe026afd9a68/docs/js/jquery.shuffle.min.js#L40-L50
train
SAP/fundamental
docs/js/jquery.shuffle.min.js
function( element, options ) { options = options || {}; $.extend( this, Shuffle.options, options, Shuffle.settings ); this.$el = $(element); this.element = element; this.unique = 'shuffle_' + id++; this._fire( Shuffle.EventType.LOADING ); this._init(); // Dispatch the done event asynchronously so tha...
javascript
function( element, options ) { options = options || {}; $.extend( this, Shuffle.options, options, Shuffle.settings ); this.$el = $(element); this.element = element; this.unique = 'shuffle_' + id++; this._fire( Shuffle.EventType.LOADING ); this._init(); // Dispatch the done event asynchronously so tha...
[ "function", "(", "element", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "$", ".", "extend", "(", "this", ",", "Shuffle", ".", "options", ",", "options", ",", "Shuffle", ".", "settings", ")", ";", "this", ".", "$el", "=...
Categorize, sort, and filter a responsive grid of items. @param {Element} element An element which is the parent container for the grid items. @param {Object} [options=Shuffle.options] Options object. @constructor
[ "Categorize", "sort", "and", "filter", "a", "responsive", "grid", "of", "items", "." ]
1b10ee982d42b7bcd95d6bb4249ebe026afd9a68
https://github.com/SAP/fundamental/blob/1b10ee982d42b7bcd95d6bb4249ebe026afd9a68/docs/js/jquery.shuffle.min.js#L181-L198
train
SAP/fundamental
docs/js/jquery.shuffle.min.js
handleTransitionEnd
function handleTransitionEnd( evt ) { // Make sure this event handler has not bubbled up from a child. if ( evt.target === evt.currentTarget ) { $( evt.target ).off( TRANSITIONEND, handleTransitionEnd ); callback(); } }
javascript
function handleTransitionEnd( evt ) { // Make sure this event handler has not bubbled up from a child. if ( evt.target === evt.currentTarget ) { $( evt.target ).off( TRANSITIONEND, handleTransitionEnd ); callback(); } }
[ "function", "handleTransitionEnd", "(", "evt", ")", "{", "// Make sure this event handler has not bubbled up from a child.", "if", "(", "evt", ".", "target", "===", "evt", ".", "currentTarget", ")", "{", "$", "(", "evt", ".", "target", ")", ".", "off", "(", "TRA...
Transition end handler removes its listener.
[ "Transition", "end", "handler", "removes", "its", "listener", "." ]
1b10ee982d42b7bcd95d6bb4249ebe026afd9a68
https://github.com/SAP/fundamental/blob/1b10ee982d42b7bcd95d6bb4249ebe026afd9a68/docs/js/jquery.shuffle.min.js#L1090-L1096
train
Leaflet/Leaflet.markercluster
src/MarkerClusterGroup.Refresh.js
function (layers) { var id, parent; // Assumes layers is an Array or an Object whose prototype is non-enumerable. for (id in layers) { // Flag parent clusters' icon as "dirty", all the way up. // Dumb process that flags multiple times upper parents, but still // much more efficient than trying to be sma...
javascript
function (layers) { var id, parent; // Assumes layers is an Array or an Object whose prototype is non-enumerable. for (id in layers) { // Flag parent clusters' icon as "dirty", all the way up. // Dumb process that flags multiple times upper parents, but still // much more efficient than trying to be sma...
[ "function", "(", "layers", ")", "{", "var", "id", ",", "parent", ";", "// Assumes layers is an Array or an Object whose prototype is non-enumerable.", "for", "(", "id", "in", "layers", ")", "{", "// Flag parent clusters' icon as \"dirty\", all the way up.", "// Dumb process tha...
Simply flags all parent clusters of the given markers as having a "dirty" icon. @param layers Array(L.Marker)|Map(L.Marker) list of markers. @private
[ "Simply", "flags", "all", "parent", "clusters", "of", "the", "given", "markers", "as", "having", "a", "dirty", "icon", "." ]
93bf5408ad84b74ea42f55ccb6ca0450daa41427
https://github.com/Leaflet/Leaflet.markercluster/blob/93bf5408ad84b74ea42f55ccb6ca0450daa41427/src/MarkerClusterGroup.Refresh.js#L46-L62
train
Leaflet/Leaflet.markercluster
src/MarkerClusterGroup.Refresh.js
function (layers) { var id, layer; for (id in layers) { layer = layers[id]; // Make sure we do not override markers that do not belong to THIS group. if (this.hasLayer(layer)) { // Need to re-create the icon first, then re-draw the marker. layer.setIcon(this._overrideMarkerIcon(layer)); } } ...
javascript
function (layers) { var id, layer; for (id in layers) { layer = layers[id]; // Make sure we do not override markers that do not belong to THIS group. if (this.hasLayer(layer)) { // Need to re-create the icon first, then re-draw the marker. layer.setIcon(this._overrideMarkerIcon(layer)); } } ...
[ "function", "(", "layers", ")", "{", "var", "id", ",", "layer", ";", "for", "(", "id", "in", "layers", ")", "{", "layer", "=", "layers", "[", "id", "]", ";", "// Make sure we do not override markers that do not belong to THIS group.", "if", "(", "this", ".", ...
Re-draws the icon of the supplied markers. To be used in singleMarkerMode only. @param layers Array(L.Marker)|Map(L.Marker) list of markers. @private
[ "Re", "-", "draws", "the", "icon", "of", "the", "supplied", "markers", ".", "To", "be", "used", "in", "singleMarkerMode", "only", "." ]
93bf5408ad84b74ea42f55ccb6ca0450daa41427
https://github.com/Leaflet/Leaflet.markercluster/blob/93bf5408ad84b74ea42f55ccb6ca0450daa41427/src/MarkerClusterGroup.Refresh.js#L70-L82
train
Leaflet/Leaflet.markercluster
src/MarkerClusterGroup.Refresh.js
function (options, directlyRefreshClusters) { var icon = this.options.icon; L.setOptions(icon, options); this.setIcon(icon); // Shortcut to refresh the associated MCG clusters right away. // To be used when refreshing a single marker. // Otherwise, better use MCG.refreshClusters() once at the end with ...
javascript
function (options, directlyRefreshClusters) { var icon = this.options.icon; L.setOptions(icon, options); this.setIcon(icon); // Shortcut to refresh the associated MCG clusters right away. // To be used when refreshing a single marker. // Otherwise, better use MCG.refreshClusters() once at the end with ...
[ "function", "(", "options", ",", "directlyRefreshClusters", ")", "{", "var", "icon", "=", "this", ".", "options", ".", "icon", ";", "L", ".", "setOptions", "(", "icon", ",", "options", ")", ";", "this", ".", "setIcon", "(", "icon", ")", ";", "// Shortc...
Updates the given options in the marker's icon and refreshes the marker. @param options map object of icon options. @param directlyRefreshClusters boolean (optional) true to trigger MCG.refreshClustersOf() right away with this single marker. @returns {L.Marker}
[ "Updates", "the", "given", "options", "in", "the", "marker", "s", "icon", "and", "refreshes", "the", "marker", "." ]
93bf5408ad84b74ea42f55ccb6ca0450daa41427
https://github.com/Leaflet/Leaflet.markercluster/blob/93bf5408ad84b74ea42f55ccb6ca0450daa41427/src/MarkerClusterGroup.Refresh.js#L93-L109
train