id int32 0 58k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
7,300 | melonjs/melonJS | dist/melonjs.js | isAttachedToRoot | function isAttachedToRoot() {
if (this.root === true) {
return true;
} else {
var ancestor = this.ancestor;
while (ancestor) {
if (ancestor.root === true) {
return true;
}
ancestor = ancestor.ancestor;
... | javascript | function isAttachedToRoot() {
if (this.root === true) {
return true;
} else {
var ancestor = this.ancestor;
while (ancestor) {
if (ancestor.root === true) {
return true;
}
ancestor = ancestor.ancestor;
... | [
"function",
"isAttachedToRoot",
"(",
")",
"{",
"if",
"(",
"this",
".",
"root",
"===",
"true",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"var",
"ancestor",
"=",
"this",
".",
"ancestor",
";",
"while",
"(",
"ancestor",
")",
"{",
"if",
"(",
"a... | Checks if this container is root or if it's attached to the root container.
@private
@name isAttachedToRoot
@memberOf me.Container.prototype
@function
@returns Boolean | [
"Checks",
"if",
"this",
"container",
"is",
"root",
"or",
"if",
"it",
"s",
"attached",
"to",
"the",
"root",
"container",
"."
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L11981-L11997 |
7,301 | melonjs/melonJS | dist/melonjs.js | removeChild | function removeChild(child, keepalive) {
if (this.hasChild(child)) {
me.utils.function.defer(deferredRemove, this, child, keepalive);
} else {
throw new Error("Child is not mine.");
}
} | javascript | function removeChild(child, keepalive) {
if (this.hasChild(child)) {
me.utils.function.defer(deferredRemove, this, child, keepalive);
} else {
throw new Error("Child is not mine.");
}
} | [
"function",
"removeChild",
"(",
"child",
",",
"keepalive",
")",
"{",
"if",
"(",
"this",
".",
"hasChild",
"(",
"child",
")",
")",
"{",
"me",
".",
"utils",
".",
"function",
".",
"defer",
"(",
"deferredRemove",
",",
"this",
",",
"child",
",",
"keepalive",... | Invokes the removeChildNow in a defer, to ensure the child is removed safely after the update & draw stack has completed
@name removeChild
@memberOf me.Container.prototype
@public
@function
@param {me.Renderable} child
@param {Boolean} [keepalive=False] True to prevent calling child.destroy() | [
"Invokes",
"the",
"removeChildNow",
"in",
"a",
"defer",
"to",
"ensure",
"the",
"child",
"is",
"removed",
"safely",
"after",
"the",
"update",
"&",
"draw",
"stack",
"has",
"completed"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L12046-L12052 |
7,302 | melonjs/melonJS | dist/melonjs.js | setChildsProperty | function setChildsProperty(prop, val, recursive) {
for (var i = this.children.length; i >= 0; i--) {
var obj = this.children[i];
if (recursive === true && obj instanceof me.Container) {
obj.setChildsProperty(prop, val, recursive);
}
obj[prop] = val;
... | javascript | function setChildsProperty(prop, val, recursive) {
for (var i = this.children.length; i >= 0; i--) {
var obj = this.children[i];
if (recursive === true && obj instanceof me.Container) {
obj.setChildsProperty(prop, val, recursive);
}
obj[prop] = val;
... | [
"function",
"setChildsProperty",
"(",
"prop",
",",
"val",
",",
"recursive",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"this",
".",
"children",
".",
"length",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"var",
"obj",
"=",
"this",
".",
"children",
... | Automatically set the specified property of all childs to the given value
@name setChildsProperty
@memberOf me.Container.prototype
@function
@param {String} property property name
@param {Object} value property value
@param {Boolean} [recursive=false] recursively apply the value to child containers if true | [
"Automatically",
"set",
"the",
"specified",
"property",
"of",
"all",
"childs",
"to",
"the",
"given",
"value"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L12100-L12110 |
7,303 | melonjs/melonJS | dist/melonjs.js | _sortZ | function _sortZ(a, b) {
return b.pos && a.pos ? b.pos.z - a.pos.z : a.pos ? -Infinity : Infinity;
} | javascript | function _sortZ(a, b) {
return b.pos && a.pos ? b.pos.z - a.pos.z : a.pos ? -Infinity : Infinity;
} | [
"function",
"_sortZ",
"(",
"a",
",",
"b",
")",
"{",
"return",
"b",
".",
"pos",
"&&",
"a",
".",
"pos",
"?",
"b",
".",
"pos",
".",
"z",
"-",
"a",
".",
"pos",
".",
"z",
":",
"a",
".",
"pos",
"?",
"-",
"Infinity",
":",
"Infinity",
";",
"}"
] | Z Sorting function
@ignore | [
"Z",
"Sorting",
"function"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L12230-L12232 |
7,304 | melonjs/melonJS | dist/melonjs.js | setDeadzone | function setDeadzone(w, h) {
if (typeof this.deadzone === "undefined") {
this.deadzone = new me.Rect(0, 0, 0, 0);
} // reusing the old code for now...
this.deadzone.pos.set(~~((this.width - w) / 2), ~~((this.height - h) / 2 - h * 0.25));
this.deadzone.resize(w, h);
... | javascript | function setDeadzone(w, h) {
if (typeof this.deadzone === "undefined") {
this.deadzone = new me.Rect(0, 0, 0, 0);
} // reusing the old code for now...
this.deadzone.pos.set(~~((this.width - w) / 2), ~~((this.height - h) / 2 - h * 0.25));
this.deadzone.resize(w, h);
... | [
"function",
"setDeadzone",
"(",
"w",
",",
"h",
")",
"{",
"if",
"(",
"typeof",
"this",
".",
"deadzone",
"===",
"\"undefined\"",
")",
"{",
"this",
".",
"deadzone",
"=",
"new",
"me",
".",
"Rect",
"(",
"0",
",",
"0",
",",
"0",
",",
"0",
")",
";",
"... | change the deadzone settings.
the "deadzone" defines an area within the current camera in which
the followed renderable can move without scrolling the camera.
@name setDeadzone
@see me.Camera2d.follow
@memberOf me.Camera2d
@function
@param {Number} w deadzone width
@param {Number} h deadzone height | [
"change",
"the",
"deadzone",
"settings",
".",
"the",
"deadzone",
"defines",
"an",
"area",
"within",
"the",
"current",
"camera",
"in",
"which",
"the",
"followed",
"renderable",
"can",
"move",
"without",
"scrolling",
"the",
"camera",
"."
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L12548-L12560 |
7,305 | melonjs/melonJS | dist/melonjs.js | resize | function resize(w, h) {
// parent consctructor, resize camera rect
this._super(me.Renderable, "resize", [w, h]); // disable damping while resizing
this.smoothFollow = false; // update bounds
var level = me.levelDirector.getCurrentLevel();
this.setBounds(0, 0, Math.max(w, ... | javascript | function resize(w, h) {
// parent consctructor, resize camera rect
this._super(me.Renderable, "resize", [w, h]); // disable damping while resizing
this.smoothFollow = false; // update bounds
var level = me.levelDirector.getCurrentLevel();
this.setBounds(0, 0, Math.max(w, ... | [
"function",
"resize",
"(",
"w",
",",
"h",
")",
"{",
"// parent consctructor, resize camera rect",
"this",
".",
"_super",
"(",
"me",
".",
"Renderable",
",",
"\"resize\"",
",",
"[",
"w",
",",
"h",
"]",
")",
";",
"// disable damping while resizing",
"this",
".",
... | resize the camera
@name resize
@memberOf me.Camera2d
@function
@param {Number} w new width of the camera
@param {Number} h new height of the camera
@return {me.Camera2d} this camera | [
"resize",
"the",
"camera"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L12571-L12586 |
7,306 | melonjs/melonJS | dist/melonjs.js | move | function move(x, y) {
this.moveTo(this.pos.x + x, this.pos.y + y);
} | javascript | function move(x, y) {
this.moveTo(this.pos.x + x, this.pos.y + y);
} | [
"function",
"move",
"(",
"x",
",",
"y",
")",
"{",
"this",
".",
"moveTo",
"(",
"this",
".",
"pos",
".",
"x",
"+",
"x",
",",
"this",
".",
"pos",
".",
"y",
"+",
"y",
")",
";",
"}"
] | move the camera upper-left position by the specified offset.
@name move
@memberOf me.Camera2d
@see me.Camera2d.focusOn
@function
@param {Number} x
@param {Number} y
@example
// Move the camera up by four pixels
me.game.viewport.move(0, -4); | [
"move",
"the",
"camera",
"upper",
"-",
"left",
"position",
"by",
"the",
"specified",
"offset",
"."
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L12668-L12670 |
7,307 | melonjs/melonJS | dist/melonjs.js | shake | function shake(intensity, duration, axis, onComplete, force) {
if (this._shake.duration === 0 || force === true) {
this._shake.intensity = intensity;
this._shake.duration = duration;
this._shake.axis = axis || this.AXIS.BOTH;
this._shake.onComplete = typeof onComplet... | javascript | function shake(intensity, duration, axis, onComplete, force) {
if (this._shake.duration === 0 || force === true) {
this._shake.intensity = intensity;
this._shake.duration = duration;
this._shake.axis = axis || this.AXIS.BOTH;
this._shake.onComplete = typeof onComplet... | [
"function",
"shake",
"(",
"intensity",
",",
"duration",
",",
"axis",
",",
"onComplete",
",",
"force",
")",
"{",
"if",
"(",
"this",
".",
"_shake",
".",
"duration",
"===",
"0",
"||",
"force",
"===",
"true",
")",
"{",
"this",
".",
"_shake",
".",
"intens... | shake the camera
@name shake
@memberOf me.Camera2d
@function
@param {Number} intensity maximum offset that the screen can be moved
while shaking
@param {Number} duration expressed in milliseconds
@param {me.Camera2d.AXIS} [axis=this.AXIS.BOTH] specify on which axis you
want the shake effect
@param {Function} [onComplet... | [
"shake",
"the",
"camera"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L12797-L12804 |
7,308 | melonjs/melonJS | dist/melonjs.js | drawFX | function drawFX(renderer) {
// fading effect
if (this._fadeIn.tween) {
renderer.clearColor(this._fadeIn.color); // remove the tween if over
if (this._fadeIn.color.alpha === 1.0) {
this._fadeIn.tween = null;
me.pool.push(this._fadeIn.color);
... | javascript | function drawFX(renderer) {
// fading effect
if (this._fadeIn.tween) {
renderer.clearColor(this._fadeIn.color); // remove the tween if over
if (this._fadeIn.color.alpha === 1.0) {
this._fadeIn.tween = null;
me.pool.push(this._fadeIn.color);
... | [
"function",
"drawFX",
"(",
"renderer",
")",
"{",
"// fading effect",
"if",
"(",
"this",
".",
"_fadeIn",
".",
"tween",
")",
"{",
"renderer",
".",
"clearColor",
"(",
"this",
".",
"_fadeIn",
".",
"color",
")",
";",
"// remove the tween if over",
"if",
"(",
"t... | render the camera effects
@ignore | [
"render",
"the",
"camera",
"effects"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L12961-L12983 |
7,309 | melonjs/melonJS | dist/melonjs.js | draw | function draw(renderer, container) {
var translateX = this.pos.x + this.offset.x;
var translateY = this.pos.y + this.offset.y; // translate the world coordinates by default to screen coordinates
container.currentTransform.translate(-translateX, -translateY); // clip to camera bounds
... | javascript | function draw(renderer, container) {
var translateX = this.pos.x + this.offset.x;
var translateY = this.pos.y + this.offset.y; // translate the world coordinates by default to screen coordinates
container.currentTransform.translate(-translateX, -translateY); // clip to camera bounds
... | [
"function",
"draw",
"(",
"renderer",
",",
"container",
")",
"{",
"var",
"translateX",
"=",
"this",
".",
"pos",
".",
"x",
"+",
"this",
".",
"offset",
".",
"x",
";",
"var",
"translateY",
"=",
"this",
".",
"pos",
".",
"y",
"+",
"this",
".",
"offset",
... | draw all object visibile in this viewport
@ignore | [
"draw",
"all",
"object",
"visibile",
"in",
"this",
"viewport"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L12989-L13007 |
7,310 | melonjs/melonJS | dist/melonjs.js | distanceTo | function distanceTo(e) {
var a = this.getBounds();
var b = e.getBounds(); // the me.Vector2d object also implements the same function, but
// we have to use here the center of both entities
var dx = a.pos.x + a.width / 2 - (b.pos.x + b.width / 2);
var dy = a.pos.y + a.heigh... | javascript | function distanceTo(e) {
var a = this.getBounds();
var b = e.getBounds(); // the me.Vector2d object also implements the same function, but
// we have to use here the center of both entities
var dx = a.pos.x + a.width / 2 - (b.pos.x + b.width / 2);
var dy = a.pos.y + a.heigh... | [
"function",
"distanceTo",
"(",
"e",
")",
"{",
"var",
"a",
"=",
"this",
".",
"getBounds",
"(",
")",
";",
"var",
"b",
"=",
"e",
".",
"getBounds",
"(",
")",
";",
"// the me.Vector2d object also implements the same function, but",
"// we have to use here the center of b... | return the distance to the specified entity
@name distanceTo
@memberOf me.Entity
@function
@param {me.Entity} entity Entity
@return {Number} distance | [
"return",
"the",
"distance",
"to",
"the",
"specified",
"entity"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L13146-L13154 |
7,311 | melonjs/melonJS | dist/melonjs.js | distanceToPoint | function distanceToPoint(v) {
var a = this.getBounds(); // the me.Vector2d object also implements the same function, but
// we have to use here the center of both entities
var dx = a.pos.x + a.width / 2 - v.x;
var dy = a.pos.y + a.height / 2 - v.y;
return Math.sqrt(dx * dx ... | javascript | function distanceToPoint(v) {
var a = this.getBounds(); // the me.Vector2d object also implements the same function, but
// we have to use here the center of both entities
var dx = a.pos.x + a.width / 2 - v.x;
var dy = a.pos.y + a.height / 2 - v.y;
return Math.sqrt(dx * dx ... | [
"function",
"distanceToPoint",
"(",
"v",
")",
"{",
"var",
"a",
"=",
"this",
".",
"getBounds",
"(",
")",
";",
"// the me.Vector2d object also implements the same function, but",
"// we have to use here the center of both entities",
"var",
"dx",
"=",
"a",
".",
"pos",
".",... | return the distance to the specified point
@name distanceToPoint
@memberOf me.Entity
@function
@param {me.Vector2d} vector vector
@return {Number} distance | [
"return",
"the",
"distance",
"to",
"the",
"specified",
"point"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L13164-L13171 |
7,312 | melonjs/melonJS | dist/melonjs.js | angleTo | function angleTo(e) {
var a = this.getBounds();
var b = e.getBounds(); // the me.Vector2d object also implements the same function, but
// we have to use here the center of both entities
var ax = b.pos.x + b.width / 2 - (a.pos.x + a.width / 2);
var ay = b.pos.y + b.height /... | javascript | function angleTo(e) {
var a = this.getBounds();
var b = e.getBounds(); // the me.Vector2d object also implements the same function, but
// we have to use here the center of both entities
var ax = b.pos.x + b.width / 2 - (a.pos.x + a.width / 2);
var ay = b.pos.y + b.height /... | [
"function",
"angleTo",
"(",
"e",
")",
"{",
"var",
"a",
"=",
"this",
".",
"getBounds",
"(",
")",
";",
"var",
"b",
"=",
"e",
".",
"getBounds",
"(",
")",
";",
"// the me.Vector2d object also implements the same function, but",
"// we have to use here the center of both... | return the angle to the specified entity
@name angleTo
@memberOf me.Entity
@function
@param {me.Entity} entity Entity
@return {Number} angle in radians | [
"return",
"the",
"angle",
"to",
"the",
"specified",
"entity"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L13181-L13189 |
7,313 | melonjs/melonJS | dist/melonjs.js | angleToPoint | function angleToPoint(v) {
var a = this.getBounds(); // the me.Vector2d object also implements the same function, but
// we have to use here the center of both entities
var ax = v.x - (a.pos.x + a.width / 2);
var ay = v.y - (a.pos.y + a.height / 2);
return Math.atan2(ay, ax... | javascript | function angleToPoint(v) {
var a = this.getBounds(); // the me.Vector2d object also implements the same function, but
// we have to use here the center of both entities
var ax = v.x - (a.pos.x + a.width / 2);
var ay = v.y - (a.pos.y + a.height / 2);
return Math.atan2(ay, ax... | [
"function",
"angleToPoint",
"(",
"v",
")",
"{",
"var",
"a",
"=",
"this",
".",
"getBounds",
"(",
")",
";",
"// the me.Vector2d object also implements the same function, but",
"// we have to use here the center of both entities",
"var",
"ax",
"=",
"v",
".",
"x",
"-",
"(... | return the angle to the specified point
@name angleToPoint
@memberOf me.Entity
@function
@param {me.Vector2d} vector vector
@return {Number} angle in radians | [
"return",
"the",
"angle",
"to",
"the",
"specified",
"point"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L13199-L13206 |
7,314 | melonjs/melonJS | dist/melonjs.js | updateBoundsPos | function updateBoundsPos(x, y) {
if (typeof this.body !== "undefined") {
var _pos = this.body.pos;
this._super(me.Renderable, "updateBoundsPos", [x + _pos.x, y + _pos.y]);
} else {
this._super(me.Renderable, "updateBoundsPos", [x, y]);
}
return this... | javascript | function updateBoundsPos(x, y) {
if (typeof this.body !== "undefined") {
var _pos = this.body.pos;
this._super(me.Renderable, "updateBoundsPos", [x + _pos.x, y + _pos.y]);
} else {
this._super(me.Renderable, "updateBoundsPos", [x, y]);
}
return this... | [
"function",
"updateBoundsPos",
"(",
"x",
",",
"y",
")",
"{",
"if",
"(",
"typeof",
"this",
".",
"body",
"!==",
"\"undefined\"",
")",
"{",
"var",
"_pos",
"=",
"this",
".",
"body",
".",
"pos",
";",
"this",
".",
"_super",
"(",
"me",
".",
"Renderable",
... | update the bounds position when the position is modified
@private
@name updateBoundsPos
@memberOf me.Entity
@function | [
"update",
"the",
"bounds",
"position",
"when",
"the",
"position",
"is",
"modified"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L13224-L13234 |
7,315 | melonjs/melonJS | dist/melonjs.js | preloadTMX | function preloadTMX(tmxData, onload, onerror) {
function addToTMXList(data) {
// set the TMX content
tmxList[tmxData.name] = data; // add the tmx to the levelDirector
if (tmxData.type === "tmx") {
me.levelDirector.addTMXLevel(tmxData.name);
}
}... | javascript | function preloadTMX(tmxData, onload, onerror) {
function addToTMXList(data) {
// set the TMX content
tmxList[tmxData.name] = data; // add the tmx to the levelDirector
if (tmxData.type === "tmx") {
me.levelDirector.addTMXLevel(tmxData.name);
}
}... | [
"function",
"preloadTMX",
"(",
"tmxData",
",",
"onload",
",",
"onerror",
")",
"{",
"function",
"addToTMXList",
"(",
"data",
")",
"{",
"// set the TMX content",
"tmxList",
"[",
"tmxData",
".",
"name",
"]",
"=",
"data",
";",
"// add the tmx to the levelDirector",
... | preload TMX files
@ignore | [
"preload",
"TMX",
"files"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L14360-L14452 |
7,316 | melonjs/melonJS | dist/melonjs.js | setFont | function setFont(font, size) {
// font name and type
var font_names = font.split(",").map(function (value) {
value = value.trim();
return !/(^".*"$)|(^'.*'$)/.test(value) ? "\"" + value + "\"" : value;
}); // font size
if (typeof size === "number") {
... | javascript | function setFont(font, size) {
// font name and type
var font_names = font.split(",").map(function (value) {
value = value.trim();
return !/(^".*"$)|(^'.*'$)/.test(value) ? "\"" + value + "\"" : value;
}); // font size
if (typeof size === "number") {
... | [
"function",
"setFont",
"(",
"font",
",",
"size",
")",
"{",
"// font name and type",
"var",
"font_names",
"=",
"font",
".",
"split",
"(",
"\",\"",
")",
".",
"map",
"(",
"function",
"(",
"value",
")",
"{",
"value",
"=",
"value",
".",
"trim",
"(",
")",
... | set the font family and size
@name setFont
@memberOf me.Text.prototype
@function
@param {String} font a CSS font name
@param {Number|String} size size, or size + suffix (px, em, pt)
@return this object for chaining
@example
font.setFont("Arial", 20);
font.setFont("Arial", "1.5em"); | [
"set",
"the",
"font",
"family",
"and",
"size"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L15253-L15282 |
7,317 | melonjs/melonJS | dist/melonjs.js | setText | function setText(value) {
value = "" + value;
if (this._text !== value) {
if (Array.isArray(value)) {
this._text = value.join("\n");
} else {
this._text = value;
}
this.isDirty = true;
}
return this;
} | javascript | function setText(value) {
value = "" + value;
if (this._text !== value) {
if (Array.isArray(value)) {
this._text = value.join("\n");
} else {
this._text = value;
}
this.isDirty = true;
}
return this;
} | [
"function",
"setText",
"(",
"value",
")",
"{",
"value",
"=",
"\"\"",
"+",
"value",
";",
"if",
"(",
"this",
".",
"_text",
"!==",
"value",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"value",
")",
")",
"{",
"this",
".",
"_text",
"=",
"value"... | change the text to be displayed
@name setText
@memberOf me.Text.prototype
@function
@param {Number|String|String[]} value a string, or an array of strings
@return this object for chaining | [
"change",
"the",
"text",
"to",
"be",
"displayed"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L15292-L15306 |
7,318 | melonjs/melonJS | dist/melonjs.js | measureTextWidth | function measureTextWidth(font, text) {
var characters = text.split("");
var width = 0;
var lastGlyph = null;
for (var i = 0; i < characters.length; i++) {
var ch = characters[i].charCodeAt(0);
var glyph = font.fontData.glyphs[ch];
var kerning = lastGlyph && lastG... | javascript | function measureTextWidth(font, text) {
var characters = text.split("");
var width = 0;
var lastGlyph = null;
for (var i = 0; i < characters.length; i++) {
var ch = characters[i].charCodeAt(0);
var glyph = font.fontData.glyphs[ch];
var kerning = lastGlyph && lastG... | [
"function",
"measureTextWidth",
"(",
"font",
",",
"text",
")",
"{",
"var",
"characters",
"=",
"text",
".",
"split",
"(",
"\"\"",
")",
";",
"var",
"width",
"=",
"0",
";",
"var",
"lastGlyph",
"=",
"null",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
... | Measures the width of a single line of text, does not account for \n
@ignore | [
"Measures",
"the",
"width",
"of",
"a",
"single",
"line",
"of",
"text",
"does",
"not",
"account",
"for",
"\\",
"n"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L15476-L15490 |
7,319 | 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 |
7,320 | 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 |
7,321 | 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 |
7,322 | 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 |
7,323 | 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 | |
7,324 | 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 | |
7,325 | 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 |
7,326 | 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 |
7,327 | 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 |
7,328 | 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 |
7,329 | 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 |
7,330 | 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 |
7,331 | 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 |
7,332 | 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 |
7,333 | 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 |
7,334 | 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 |
7,335 | 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 |
7,336 | 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 |
7,337 | 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 |
7,338 | 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 |
7,339 | 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 |
7,340 | 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 |
7,341 | 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 |
7,342 | 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 |
7,343 | 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 |
7,344 | 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 |
7,345 | 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 |
7,346 | 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 |
7,347 | 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 |
7,348 | 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 |
7,349 | 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 |
7,350 | 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 |
7,351 | 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 |
7,352 | 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 |
7,353 | 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 |
7,354 | 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 |
7,355 | 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 |
7,356 | 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 |
7,357 | 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 |
7,358 | 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 |
7,359 | 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 |
7,360 | 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 |
7,361 | 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 |
7,362 | 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 |
7,363 | 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 |
7,364 | 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 |
7,365 | 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 | |
7,366 | 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 | |
7,367 | 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 | |
7,368 | 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 | |
7,369 | 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 | |
7,370 | 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 | |
7,371 | 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 | |
7,372 | 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 | |
7,373 | 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 | |
7,374 | 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 | |
7,375 | 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 | |
7,376 | 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 | |
7,377 | 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 | |
7,378 | 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 | |
7,379 | 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 | |
7,380 | 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 | |
7,381 | 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 | |
7,382 | 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 | |
7,383 | 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 | |
7,384 | 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 | |
7,385 | 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 | |
7,386 | 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 | |
7,387 | 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 | |
7,388 | 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 | |
7,389 | 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 | |
7,390 | 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 | |
7,391 | 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 | |
7,392 | 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 | |
7,393 | 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 | |
7,394 | 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 | |
7,395 | 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 | |
7,396 | 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 | |
7,397 | 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 | |
7,398 | 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 | |
7,399 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.