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,200 | APIDevTools/swagger-express-middleware | lib/mock/semantic-response.js | getResourceSchemas | function getResourceSchemas (path) {
let schemas = [];
["post", "put", "patch"].forEach((operation) => {
if (path[operation]) {
schemas.push(util.getRequestSchema(path, path[operation]));
}
});
return schemas;
} | javascript | function getResourceSchemas (path) {
let schemas = [];
["post", "put", "patch"].forEach((operation) => {
if (path[operation]) {
schemas.push(util.getRequestSchema(path, path[operation]));
}
});
return schemas;
} | [
"function",
"getResourceSchemas",
"(",
"path",
")",
"{",
"let",
"schemas",
"=",
"[",
"]",
";",
"[",
"\"post\"",
",",
"\"put\"",
",",
"\"patch\"",
"]",
".",
"forEach",
"(",
"(",
"operation",
")",
"=>",
"{",
"if",
"(",
"path",
"[",
"operation",
"]",
")... | Returns the JSON schemas for the given path's PUT, POST, and PATCH operations.
Usually these operations are not wrapped, so we can assume that they are the actual resource schema.
@param {object} path - A Path object, from the Swagger API.
@returns {object[]} - An array of JSON schema objects | [
"Returns",
"the",
"JSON",
"schemas",
"for",
"the",
"given",
"path",
"s",
"PUT",
"POST",
"and",
"PATCH",
"operations",
".",
"Usually",
"these",
"operations",
"are",
"not",
"wrapped",
"so",
"we",
"can",
"assume",
"that",
"they",
"are",
"the",
"actual",
"reso... | 7544c22045945565f6555419b678fe51ba664a1f | https://github.com/APIDevTools/swagger-express-middleware/blob/7544c22045945565f6555419b678fe51ba664a1f/lib/mock/semantic-response.js#L147-L157 |
7,201 | APIDevTools/swagger-express-middleware | lib/mock/semantic-response.js | schemasMatch | function schemasMatch (schemasToMatch, schemaToTest) {
let propertiesToTest = 0;
if (schemaToTest.properties) {
propertiesToTest = Object.keys(schemaToTest.properties).length;
}
return schemasToMatch.some((schemaToMatch) => {
let propertiesToMatch = 0;
if (schemaToMatch.properties) {
properti... | javascript | function schemasMatch (schemasToMatch, schemaToTest) {
let propertiesToTest = 0;
if (schemaToTest.properties) {
propertiesToTest = Object.keys(schemaToTest.properties).length;
}
return schemasToMatch.some((schemaToMatch) => {
let propertiesToMatch = 0;
if (schemaToMatch.properties) {
properti... | [
"function",
"schemasMatch",
"(",
"schemasToMatch",
",",
"schemaToTest",
")",
"{",
"let",
"propertiesToTest",
"=",
"0",
";",
"if",
"(",
"schemaToTest",
".",
"properties",
")",
"{",
"propertiesToTest",
"=",
"Object",
".",
"keys",
"(",
"schemaToTest",
".",
"prope... | Determines whether the given JSON schema matches any of the given JSON schemas.
@param {object[]} schemasToMatch - An array of JSON schema objects
@param {object} schemaToTest - The JSON schema object to test against the other schemas
@returns {boolean} - Returns true if the schema matches a... | [
"Determines",
"whether",
"the",
"given",
"JSON",
"schema",
"matches",
"any",
"of",
"the",
"given",
"JSON",
"schemas",
"."
] | 7544c22045945565f6555419b678fe51ba664a1f | https://github.com/APIDevTools/swagger-express-middleware/blob/7544c22045945565f6555419b678fe51ba664a1f/lib/mock/semantic-response.js#L166-L187 |
7,202 | APIDevTools/swagger-express-middleware | lib/mock/edit-collection.js | mergeCollection | function mergeCollection (req, res, next, dataStore) {
let collection = req.path;
let resources = createResources(req);
// Set the "Location" HTTP header.
// If the operation allows saving multiple resources, then use the collection path.
// If the operation only saves a single resource, then use the resourc... | javascript | function mergeCollection (req, res, next, dataStore) {
let collection = req.path;
let resources = createResources(req);
// Set the "Location" HTTP header.
// If the operation allows saving multiple resources, then use the collection path.
// If the operation only saves a single resource, then use the resourc... | [
"function",
"mergeCollection",
"(",
"req",
",",
"res",
",",
"next",
",",
"dataStore",
")",
"{",
"let",
"collection",
"=",
"req",
".",
"path",
";",
"let",
"resources",
"=",
"createResources",
"(",
"req",
")",
";",
"// Set the \"Location\" HTTP header.",
"// If ... | Adds one or more REST resources to the collection, or updates them if they already exist.
A unique URL is generated for each new resource, based on the schema definition in the Swagger API,
and this URL is used to determine whether a given resource is being created or updated.
For example, if you POST the data {id: 12... | [
"Adds",
"one",
"or",
"more",
"REST",
"resources",
"to",
"the",
"collection",
"or",
"updates",
"them",
"if",
"they",
"already",
"exist",
".",
"A",
"unique",
"URL",
"is",
"generated",
"for",
"each",
"new",
"resource",
"based",
"on",
"the",
"schema",
"definit... | 7544c22045945565f6555419b678fe51ba664a1f | https://github.com/APIDevTools/swagger-express-middleware/blob/7544c22045945565f6555419b678fe51ba664a1f/lib/mock/edit-collection.js#L34-L46 |
7,203 | APIDevTools/swagger-express-middleware | lib/mock/edit-collection.js | getResourceName | function getResourceName (data, schema) {
// Try to find the "name" property using several different methods
let propInfo =
getResourceNameByValue(data, schema) ||
getResourceNameByName(data, schema) ||
getResourceNameByRequired(data, schema) ||
getResourceNameByFile(data, schema);
... | javascript | function getResourceName (data, schema) {
// Try to find the "name" property using several different methods
let propInfo =
getResourceNameByValue(data, schema) ||
getResourceNameByName(data, schema) ||
getResourceNameByRequired(data, schema) ||
getResourceNameByFile(data, schema);
... | [
"function",
"getResourceName",
"(",
"data",
",",
"schema",
")",
"{",
"// Try to find the \"name\" property using several different methods",
"let",
"propInfo",
"=",
"getResourceNameByValue",
"(",
"data",
",",
"schema",
")",
"||",
"getResourceNameByName",
"(",
"data",
",",... | Returns the property that is the REST resource's "unique" name.
@param {*} data - The parsed resource data.
@param {object} schema - The JSON schema for the data.
@returns {PropertyInfo} - The resource's name. | [
"Returns",
"the",
"property",
"that",
"is",
"the",
"REST",
"resource",
"s",
"unique",
"name",
"."
] | 7544c22045945565f6555419b678fe51ba664a1f | https://github.com/APIDevTools/swagger-express-middleware/blob/7544c22045945565f6555419b678fe51ba664a1f/lib/mock/edit-collection.js#L146-L172 |
7,204 | APIDevTools/swagger-express-middleware | lib/mock/edit-collection.js | getResourceNameByName | function getResourceNameByName (data, schema) {
/** @name PropertyInfo */
let propInfo = {
name: "",
schema: {
type: ""
},
value: undefined
};
// Get a list of all existing and possible properties of the resource
let propNames = _.union(_.keys(schema.properties), _.keys(data));
// Lo... | javascript | function getResourceNameByName (data, schema) {
/** @name PropertyInfo */
let propInfo = {
name: "",
schema: {
type: ""
},
value: undefined
};
// Get a list of all existing and possible properties of the resource
let propNames = _.union(_.keys(schema.properties), _.keys(data));
// Lo... | [
"function",
"getResourceNameByName",
"(",
"data",
",",
"schema",
")",
"{",
"/** @name PropertyInfo */",
"let",
"propInfo",
"=",
"{",
"name",
":",
"\"\"",
",",
"schema",
":",
"{",
"type",
":",
"\"\"",
"}",
",",
"value",
":",
"undefined",
"}",
";",
"// Get a... | Tries to find the REST resource's name by searching for commonly-used property names like "id", "key", etc.
@param {*} data - The parsed resource data.
@param {object} schema - The JSON schema for the data.
@returns {PropertyInfo|undefined} | [
"Tries",
"to",
"find",
"the",
"REST",
"resource",
"s",
"name",
"by",
"searching",
"for",
"commonly",
"-",
"used",
"property",
"names",
"like",
"id",
"key",
"etc",
"."
] | 7544c22045945565f6555419b678fe51ba664a1f | https://github.com/APIDevTools/swagger-express-middleware/blob/7544c22045945565f6555419b678fe51ba664a1f/lib/mock/edit-collection.js#L200-L245 |
7,205 | APIDevTools/swagger-express-middleware | lib/mock/edit-collection.js | getResourceNameByRequired | function getResourceNameByRequired (data, schema) {
let propInfo = {
name: "",
schema: {
type: ""
},
value: undefined
};
let foundMatch = _.some(schema.required, (propName) => {
propInfo.name = propName;
propInfo.schema = schema.properties[propName];
propInfo.value = data[propNa... | javascript | function getResourceNameByRequired (data, schema) {
let propInfo = {
name: "",
schema: {
type: ""
},
value: undefined
};
let foundMatch = _.some(schema.required, (propName) => {
propInfo.name = propName;
propInfo.schema = schema.properties[propName];
propInfo.value = data[propNa... | [
"function",
"getResourceNameByRequired",
"(",
"data",
",",
"schema",
")",
"{",
"let",
"propInfo",
"=",
"{",
"name",
":",
"\"\"",
",",
"schema",
":",
"{",
"type",
":",
"\"\"",
"}",
",",
"value",
":",
"undefined",
"}",
";",
"let",
"foundMatch",
"=",
"_",... | Tries to find the REST resource's name using the required properties in the JSON schema.
We're assuming that if the resource has a name, it'll be a required property.
@param {*} data - The parsed resource data.
@param {object} schema - The JSON schema for the data.
@returns {PropertyInfo|undefined} | [
"Tries",
"to",
"find",
"the",
"REST",
"resource",
"s",
"name",
"using",
"the",
"required",
"properties",
"in",
"the",
"JSON",
"schema",
".",
"We",
"re",
"assuming",
"that",
"if",
"the",
"resource",
"has",
"a",
"name",
"it",
"ll",
"be",
"a",
"required",
... | 7544c22045945565f6555419b678fe51ba664a1f | https://github.com/APIDevTools/swagger-express-middleware/blob/7544c22045945565f6555419b678fe51ba664a1f/lib/mock/edit-collection.js#L255-L274 |
7,206 | openaps/oref0 | lib/determine-basal/determine-basal.js | round | function round(value, digits)
{
if (! digits) { digits = 0; }
var scale = Math.pow(10, digits);
return Math.round(value * scale) / scale;
} | javascript | function round(value, digits)
{
if (! digits) { digits = 0; }
var scale = Math.pow(10, digits);
return Math.round(value * scale) / scale;
} | [
"function",
"round",
"(",
"value",
",",
"digits",
")",
"{",
"if",
"(",
"!",
"digits",
")",
"{",
"digits",
"=",
"0",
";",
"}",
"var",
"scale",
"=",
"Math",
".",
"pow",
"(",
"10",
",",
"digits",
")",
";",
"return",
"Math",
".",
"round",
"(",
"val... | Rounds value to 'digits' decimal places | [
"Rounds",
"value",
"to",
"digits",
"decimal",
"places"
] | 86f601ea56210d7dc55babcff4a5a4e906fa9476 | https://github.com/openaps/oref0/blob/86f601ea56210d7dc55babcff4a5a4e906fa9476/lib/determine-basal/determine-basal.js#L20-L25 |
7,207 | anandanand84/technicalindicators | dist/index.js | fibonacciretracement | function fibonacciretracement(start, end) {
let levels = [0, 23.6, 38.2, 50, 61.8, 78.6, 100, 127.2, 161.8, 261.8, 423.6];
let retracements;
if (start < end) {
retracements = levels.map(function (level) {
let calculated = end - Math.abs(start - end) * (level) / 100;
return ca... | javascript | function fibonacciretracement(start, end) {
let levels = [0, 23.6, 38.2, 50, 61.8, 78.6, 100, 127.2, 161.8, 261.8, 423.6];
let retracements;
if (start < end) {
retracements = levels.map(function (level) {
let calculated = end - Math.abs(start - end) * (level) / 100;
return ca... | [
"function",
"fibonacciretracement",
"(",
"start",
",",
"end",
")",
"{",
"let",
"levels",
"=",
"[",
"0",
",",
"23.6",
",",
"38.2",
",",
"50",
",",
"61.8",
",",
"78.6",
",",
"100",
",",
"127.2",
",",
"161.8",
",",
"261.8",
",",
"423.6",
"]",
";",
"... | Calcaultes the fibonacci retracements for given start and end points
If calculating for up trend start should be low and end should be high and vice versa
returns an array of retracements level containing [0 , 23.6, 38.2, 50, 61.8, 78.6, 100, 127.2, 161.8, 261.8, 423.6]
@export
@param {number} start
@param {number} ... | [
"Calcaultes",
"the",
"fibonacci",
"retracements",
"for",
"given",
"start",
"and",
"end",
"points"
] | a2097051c65fe28d24f1e834419b8dda4773fdf7 | https://github.com/anandanand84/technicalindicators/blob/a2097051c65fe28d24f1e834419b8dda4773fdf7/dist/index.js#L3829-L3845 |
7,208 | melonjs/melonJS | src/video/webgl/compositor.js | function (x, y, w, h) {
this.gl.viewport(x, y, w, h);
} | javascript | function (x, y, w, h) {
this.gl.viewport(x, y, w, h);
} | [
"function",
"(",
"x",
",",
"y",
",",
"w",
",",
"h",
")",
"{",
"this",
".",
"gl",
".",
"viewport",
"(",
"x",
",",
"y",
",",
"w",
",",
"h",
")",
";",
"}"
] | Sets the viewport
@name setViewport
@memberOf me.WebGLRenderer.Compositor
@function
@param {Number} x x position of viewport
@param {Number} y y position of viewport
@param {Number} width width of viewport
@param {Number} height height of viewport | [
"Sets",
"the",
"viewport"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/video/webgl/compositor.js#L234-L236 | |
7,209 | melonjs/melonJS | src/video/webgl/compositor.js | function (unit, image, filter, repeat, w, h, b, premultipliedAlpha) {
var gl = this.gl;
repeat = repeat || "no-repeat";
var isPOT = me.Math.isPowerOfTwo(w || image.width) && me.Math.isPowerOfTwo(h || image.height);
var texture = gl.createTexture();
var rs = ... | javascript | function (unit, image, filter, repeat, w, h, b, premultipliedAlpha) {
var gl = this.gl;
repeat = repeat || "no-repeat";
var isPOT = me.Math.isPowerOfTwo(w || image.width) && me.Math.isPowerOfTwo(h || image.height);
var texture = gl.createTexture();
var rs = ... | [
"function",
"(",
"unit",
",",
"image",
",",
"filter",
",",
"repeat",
",",
"w",
",",
"h",
",",
"b",
",",
"premultipliedAlpha",
")",
"{",
"var",
"gl",
"=",
"this",
".",
"gl",
";",
"repeat",
"=",
"repeat",
"||",
"\"no-repeat\"",
";",
"var",
"isPOT",
"... | Create a texture from an image
@name createTexture
@memberOf me.WebGLRenderer.Compositor
@function
@param {Number} unit Destination texture unit
@param {Image|Canvas|ImageData|UInt8Array[]|Float32Array[]} image Source image
@param {Number} filter gl.LINEAR or gl.NEAREST
@param {String} [repeat="no-repeat"] Image repeat... | [
"Create",
"a",
"texture",
"from",
"an",
"image"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/video/webgl/compositor.js#L254-L279 | |
7,210 | melonjs/melonJS | src/video/webgl/compositor.js | function () {
var indices = [
0, 1, 2,
2, 1, 3
];
// ~384KB index buffer
var data = new Array(MAX_LENGTH * INDICES_PER_QUAD);
for (var i = 0; i < data.length; i++) {
data[i] = indices[i % INDICES_PER_QUAD] +
... | javascript | function () {
var indices = [
0, 1, 2,
2, 1, 3
];
// ~384KB index buffer
var data = new Array(MAX_LENGTH * INDICES_PER_QUAD);
for (var i = 0; i < data.length; i++) {
data[i] = indices[i % INDICES_PER_QUAD] +
... | [
"function",
"(",
")",
"{",
"var",
"indices",
"=",
"[",
"0",
",",
"1",
",",
"2",
",",
"2",
",",
"1",
",",
"3",
"]",
";",
"// ~384KB index buffer",
"var",
"data",
"=",
"new",
"Array",
"(",
"MAX_LENGTH",
"*",
"INDICES_PER_QUAD",
")",
";",
"for",
"(",
... | Create a full index buffer for the element array
@ignore | [
"Create",
"a",
"full",
"index",
"buffer",
"for",
"the",
"element",
"array"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/video/webgl/compositor.js#L307-L321 | |
7,211 | melonjs/melonJS | src/video/webgl/compositor.js | function () {
this.sbSize <<= 1;
var stream = new Float32Array(this.sbSize * ELEMENT_SIZE * ELEMENTS_PER_QUAD);
stream.set(this.stream);
this.stream = stream;
} | javascript | function () {
this.sbSize <<= 1;
var stream = new Float32Array(this.sbSize * ELEMENT_SIZE * ELEMENTS_PER_QUAD);
stream.set(this.stream);
this.stream = stream;
} | [
"function",
"(",
")",
"{",
"this",
".",
"sbSize",
"<<=",
"1",
";",
"var",
"stream",
"=",
"new",
"Float32Array",
"(",
"this",
".",
"sbSize",
"*",
"ELEMENT_SIZE",
"*",
"ELEMENTS_PER_QUAD",
")",
";",
"stream",
".",
"set",
"(",
"this",
".",
"stream",
")",
... | Resize the stream buffer, retaining its original contents
@ignore | [
"Resize",
"the",
"stream",
"buffer",
"retaining",
"its",
"original",
"contents"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/video/webgl/compositor.js#L327-L332 | |
7,212 | melonjs/melonJS | src/video/webgl/compositor.js | function () {
if (this.length) {
var gl = this.gl;
// Copy data into stream buffer
var len = this.length * ELEMENT_SIZE * ELEMENTS_PER_QUAD;
gl.bufferData(
gl.ARRAY_BUFFER,
this.stream.subarray(0, len),
... | javascript | function () {
if (this.length) {
var gl = this.gl;
// Copy data into stream buffer
var len = this.length * ELEMENT_SIZE * ELEMENTS_PER_QUAD;
gl.bufferData(
gl.ARRAY_BUFFER,
this.stream.subarray(0, len),
... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"length",
")",
"{",
"var",
"gl",
"=",
"this",
".",
"gl",
";",
"// Copy data into stream buffer",
"var",
"len",
"=",
"this",
".",
"length",
"*",
"ELEMENT_SIZE",
"*",
"ELEMENTS_PER_QUAD",
";",
"gl",
".",
... | Flush batched texture operations to the GPU
@name flush
@memberOf me.WebGLRenderer.Compositor
@function | [
"Flush",
"batched",
"texture",
"operations",
"to",
"the",
"GPU"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/video/webgl/compositor.js#L452-L475 | |
7,213 | melonjs/melonJS | src/video/canvas/canvas_renderer.js | function (col, opaque) {
this.save();
this.resetTransform();
this.backBufferContext2D.globalCompositeOperation = opaque ? "copy" : "source-over";
this.backBufferContext2D.fillStyle = (col instanceof me.Color) ? col.toRGBA() : col;
this.fillRect(0, 0, this.back... | javascript | function (col, opaque) {
this.save();
this.resetTransform();
this.backBufferContext2D.globalCompositeOperation = opaque ? "copy" : "source-over";
this.backBufferContext2D.fillStyle = (col instanceof me.Color) ? col.toRGBA() : col;
this.fillRect(0, 0, this.back... | [
"function",
"(",
"col",
",",
"opaque",
")",
"{",
"this",
".",
"save",
"(",
")",
";",
"this",
".",
"resetTransform",
"(",
")",
";",
"this",
".",
"backBufferContext2D",
".",
"globalCompositeOperation",
"=",
"opaque",
"?",
"\"copy\"",
":",
"\"source-over\"",
... | Clears the main framebuffer with the given color
@name clearColor
@memberOf me.CanvasRenderer.prototype
@function
@param {me.Color|String} color CSS color.
@param {Boolean} [opaque=false] Allow transparency [default] or clear the surface completely [true] | [
"Clears",
"the",
"main",
"framebuffer",
"with",
"the",
"given",
"color"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/video/canvas/canvas_renderer.js#L139-L146 | |
7,214 | melonjs/melonJS | src/video/canvas/canvas_renderer.js | function (image, sx, sy, sw, sh, dx, dy, dw, dh) {
if (this.backBufferContext2D.globalAlpha < 1 / 255) {
// Fast path: don't draw fully transparent
return;
}
if (typeof sw === "undefined") {
sw = dw = image.width;
sh = ... | javascript | function (image, sx, sy, sw, sh, dx, dy, dw, dh) {
if (this.backBufferContext2D.globalAlpha < 1 / 255) {
// Fast path: don't draw fully transparent
return;
}
if (typeof sw === "undefined") {
sw = dw = image.width;
sh = ... | [
"function",
"(",
"image",
",",
"sx",
",",
"sy",
",",
"sw",
",",
"sh",
",",
"dx",
",",
"dy",
",",
"dw",
",",
"dh",
")",
"{",
"if",
"(",
"this",
".",
"backBufferContext2D",
".",
"globalAlpha",
"<",
"1",
"/",
"255",
")",
"{",
"// Fast path: don't draw... | Draw an image onto the main using the canvas api
@name drawImage
@memberOf me.CanvasRenderer.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 HTM... | [
"Draw",
"an",
"image",
"onto",
"the",
"main",
"using",
"the",
"canvas",
"api"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/video/canvas/canvas_renderer.js#L203-L235 | |
7,215 | melonjs/melonJS | src/video/canvas/canvas_renderer.js | function (x, y, w, h) {
this.strokeEllipse(x, y, w, h, true);
} | javascript | function (x, y, w, h) {
this.strokeEllipse(x, y, w, h, true);
} | [
"function",
"(",
"x",
",",
"y",
",",
"w",
",",
"h",
")",
"{",
"this",
".",
"strokeEllipse",
"(",
"x",
",",
"y",
",",
"w",
",",
"h",
",",
"true",
")",
";",
"}"
] | Fill an ellipse at the specified coordinates with given radius
@name fillEllipse
@memberOf me.CanvasRenderer.prototype
@function
@param {Number} x ellipse center point x-axis
@param {Number} y ellipse center point y-axis
@param {Number} w horizontal radius of the ellipse
@param {Number} h vertical radius of the ellipse | [
"Fill",
"an",
"ellipse",
"at",
"the",
"specified",
"coordinates",
"with",
"given",
"radius"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/video/canvas/canvas_renderer.js#L355-L357 | |
7,216 | melonjs/melonJS | src/video/canvas/canvas_renderer.js | function (poly, fill) {
var context = this.backBufferContext2D;
if (context.globalAlpha < 1 / 255) {
// Fast path: don't draw fully transparent
return;
}
this.translate(poly.pos.x, poly.pos.y);
context.beginPath();
... | javascript | function (poly, fill) {
var context = this.backBufferContext2D;
if (context.globalAlpha < 1 / 255) {
// Fast path: don't draw fully transparent
return;
}
this.translate(poly.pos.x, poly.pos.y);
context.beginPath();
... | [
"function",
"(",
"poly",
",",
"fill",
")",
"{",
"var",
"context",
"=",
"this",
".",
"backBufferContext2D",
";",
"if",
"(",
"context",
".",
"globalAlpha",
"<",
"1",
"/",
"255",
")",
"{",
"// Fast path: don't draw fully transparent",
"return",
";",
"}",
"this"... | Stroke the given me.Polygon on the screen
@name strokePolygon
@memberOf me.CanvasRenderer.prototype
@function
@param {me.Polygon} poly the shape to draw | [
"Stroke",
"the",
"given",
"me",
".",
"Polygon",
"on",
"the",
"screen"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/video/canvas/canvas_renderer.js#L404-L424 | |
7,217 | melonjs/melonJS | src/video/canvas/canvas_renderer.js | function (x, y) {
if (this.settings.subPixel === false) {
this.backBufferContext2D.translate(~~x, ~~y);
} else {
this.backBufferContext2D.translate(x, y);
}
} | javascript | function (x, y) {
if (this.settings.subPixel === false) {
this.backBufferContext2D.translate(~~x, ~~y);
} else {
this.backBufferContext2D.translate(x, y);
}
} | [
"function",
"(",
"x",
",",
"y",
")",
"{",
"if",
"(",
"this",
".",
"settings",
".",
"subPixel",
"===",
"false",
")",
"{",
"this",
".",
"backBufferContext2D",
".",
"translate",
"(",
"~",
"~",
"x",
",",
"~",
"~",
"y",
")",
";",
"}",
"else",
"{",
"... | Translates the context to the given position
@name translate
@memberOf me.CanvasRenderer.prototype
@function
@param {Number} x
@param {Number} y | [
"Translates",
"the",
"context",
"to",
"the",
"given",
"position"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/video/canvas/canvas_renderer.js#L629-L635 | |
7,218 | melonjs/melonJS | src/level/tiled/TMXTileset.js | function (renderer, dx, dy, tmxTile) {
// check if any transformation is required
if (tmxTile.flipped) {
renderer.save();
// apply the tile current transform
renderer.translate(dx, dy);
renderer.transform(tmxTile.currentTransform);... | javascript | function (renderer, dx, dy, tmxTile) {
// check if any transformation is required
if (tmxTile.flipped) {
renderer.save();
// apply the tile current transform
renderer.translate(dx, dy);
renderer.transform(tmxTile.currentTransform);... | [
"function",
"(",
"renderer",
",",
"dx",
",",
"dy",
",",
"tmxTile",
")",
"{",
"// check if any transformation is required",
"if",
"(",
"tmxTile",
".",
"flipped",
")",
"{",
"renderer",
".",
"save",
"(",
")",
";",
"// apply the tile current transform",
"renderer",
... | draw the x,y tile | [
"draw",
"the",
"x",
"y",
"tile"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/level/tiled/TMXTileset.js#L256-L295 | |
7,219 | melonjs/melonJS | tasks/jsdoc-template/publish.js | function(src, dest) {
var contents,
srcExists = fs.existsSync(src),
destExists = fs.existsSync(dest),
stats = srcExists && fs.statSync(src),
isDirectory = srcExists && stats.isDirectory();
if (srcExists) {
if (isDirectory) {
if (!destExists) {
... | javascript | function(src, dest) {
var contents,
srcExists = fs.existsSync(src),
destExists = fs.existsSync(dest),
stats = srcExists && fs.statSync(src),
isDirectory = srcExists && stats.isDirectory();
if (srcExists) {
if (isDirectory) {
if (!destExists) {
... | [
"function",
"(",
"src",
",",
"dest",
")",
"{",
"var",
"contents",
",",
"srcExists",
"=",
"fs",
".",
"existsSync",
"(",
"src",
")",
",",
"destExists",
"=",
"fs",
".",
"existsSync",
"(",
"dest",
")",
",",
"stats",
"=",
"srcExists",
"&&",
"fs",
".",
"... | Look ma, it's cp -R.
@param {string} src The path to the thing to copy.
@param {string} dest The path to the new copy. | [
"Look",
"ma",
"it",
"s",
"cp",
"-",
"R",
"."
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/tasks/jsdoc-template/publish.js#L504-L525 | |
7,220 | melonjs/melonJS | src/font/bitmaptextdata.js | function () {
var spaceCharCode = " ".charCodeAt(0);
var glyph = this.glyphs[spaceCharCode];
if (!glyph) {
glyph = new Glyph();
glyph.id = spaceCharCode;
glyph.xadvance = this._getFirstGlyph().xadvance;
this.glyphs[space... | javascript | function () {
var spaceCharCode = " ".charCodeAt(0);
var glyph = this.glyphs[spaceCharCode];
if (!glyph) {
glyph = new Glyph();
glyph.id = spaceCharCode;
glyph.xadvance = this._getFirstGlyph().xadvance;
this.glyphs[space... | [
"function",
"(",
")",
"{",
"var",
"spaceCharCode",
"=",
"\" \"",
".",
"charCodeAt",
"(",
"0",
")",
";",
"var",
"glyph",
"=",
"this",
".",
"glyphs",
"[",
"spaceCharCode",
"]",
";",
"if",
"(",
"!",
"glyph",
")",
"{",
"glyph",
"=",
"new",
"Glyph",
"("... | Creates a glyph to use for the space character
@private
@name _createSpaceGlyph
@memberOf me.BitmapTextData
@function | [
"Creates",
"a",
"glyph",
"to",
"use",
"for",
"the",
"space",
"character"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/font/bitmaptextdata.js#L103-L112 | |
7,221 | melonjs/melonJS | src/physics/body.js | function (response) {
// the overlap vector
var overlap = response.overlapV;
// FIXME: Respond proportionally to object mass
// Move out of the other object shape
this.ancestor.pos.sub(overlap);
// adjust velocity
if (overlap.x !== 0... | javascript | function (response) {
// the overlap vector
var overlap = response.overlapV;
// FIXME: Respond proportionally to object mass
// Move out of the other object shape
this.ancestor.pos.sub(overlap);
// adjust velocity
if (overlap.x !== 0... | [
"function",
"(",
"response",
")",
"{",
"// the overlap vector",
"var",
"overlap",
"=",
"response",
".",
"overlapV",
";",
"// FIXME: Respond proportionally to object mass",
"// Move out of the other object shape",
"this",
".",
"ancestor",
".",
"pos",
".",
"sub",
"(",
"ov... | the built-in function to solve the collision response
@protected
@name respondToCollision
@memberOf me.Body
@function
@param {me.collision.ResponseObject} response the collision response object | [
"the",
"built",
"-",
"in",
"function",
"to",
"solve",
"the",
"collision",
"response"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/physics/body.js#L444-L471 | |
7,222 | melonjs/melonJS | src/physics/body.js | function (vel) {
var fx = this.friction.x * me.timer.tick,
nx = vel.x + fx,
x = vel.x - fx,
fy = this.friction.y * me.timer.tick,
ny = vel.y + fy,
y = vel.y - fy;
vel.x = (
(nx < 0) ? nx :
... | javascript | function (vel) {
var fx = this.friction.x * me.timer.tick,
nx = vel.x + fx,
x = vel.x - fx,
fy = this.friction.y * me.timer.tick,
ny = vel.y + fy,
y = vel.y - fy;
vel.x = (
(nx < 0) ? nx :
... | [
"function",
"(",
"vel",
")",
"{",
"var",
"fx",
"=",
"this",
".",
"friction",
".",
"x",
"*",
"me",
".",
"timer",
".",
"tick",
",",
"nx",
"=",
"vel",
".",
"x",
"+",
"fx",
",",
"x",
"=",
"vel",
".",
"x",
"-",
"fx",
",",
"fy",
"=",
"this",
".... | apply friction to a vector
@ignore | [
"apply",
"friction",
"to",
"a",
"vector"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/physics/body.js#L555-L571 | |
7,223 | melonjs/melonJS | src/entity/draggable.js | function (e) {
if (this.dragging === false) {
this.dragging = true;
this.grabOffset.set(e.gameX, e.gameY);
this.grabOffset.sub(this.pos);
return false;
}
} | javascript | function (e) {
if (this.dragging === false) {
this.dragging = true;
this.grabOffset.set(e.gameX, e.gameY);
this.grabOffset.sub(this.pos);
return false;
}
} | [
"function",
"(",
"e",
")",
"{",
"if",
"(",
"this",
".",
"dragging",
"===",
"false",
")",
"{",
"this",
".",
"dragging",
"=",
"true",
";",
"this",
".",
"grabOffset",
".",
"set",
"(",
"e",
".",
"gameX",
",",
"e",
".",
"gameY",
")",
";",
"this",
".... | Gets called when the user starts dragging the entity
@name dragStart
@memberOf me.DraggableEntity
@function
@param {Object} x the pointer event | [
"Gets",
"called",
"when",
"the",
"user",
"starts",
"dragging",
"the",
"entity"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/entity/draggable.js#L92-L99 | |
7,224 | melonjs/melonJS | src/entity/draggable.js | function (e) {
if (this.dragging === true) {
this.pos.set(e.gameX, e.gameY, this.pos.z); //TODO : z ?
this.pos.sub(this.grabOffset);
}
} | javascript | function (e) {
if (this.dragging === true) {
this.pos.set(e.gameX, e.gameY, this.pos.z); //TODO : z ?
this.pos.sub(this.grabOffset);
}
} | [
"function",
"(",
"e",
")",
"{",
"if",
"(",
"this",
".",
"dragging",
"===",
"true",
")",
"{",
"this",
".",
"pos",
".",
"set",
"(",
"e",
".",
"gameX",
",",
"e",
".",
"gameY",
",",
"this",
".",
"pos",
".",
"z",
")",
";",
"//TODO : z ?",
"this",
... | Gets called when the user drags this entity around
@name dragMove
@memberOf me.DraggableEntity
@function
@param {Object} x the pointer event | [
"Gets",
"called",
"when",
"the",
"user",
"drags",
"this",
"entity",
"around"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/entity/draggable.js#L108-L113 | |
7,225 | melonjs/melonJS | src/utils/color.js | function (r, g, b, alpha) {
// Private initialization: copy Color value directly
if (r instanceof me.Color) {
this.glArray.set(r.glArray);
return r;
}
this.r = r;
this.g = g;
this.b = b;
this.alpha = alph... | javascript | function (r, g, b, alpha) {
// Private initialization: copy Color value directly
if (r instanceof me.Color) {
this.glArray.set(r.glArray);
return r;
}
this.r = r;
this.g = g;
this.b = b;
this.alpha = alph... | [
"function",
"(",
"r",
",",
"g",
",",
"b",
",",
"alpha",
")",
"{",
"// Private initialization: copy Color value directly",
"if",
"(",
"r",
"instanceof",
"me",
".",
"Color",
")",
"{",
"this",
".",
"glArray",
".",
"set",
"(",
"r",
".",
"glArray",
")",
";",
... | Set this color to the specified value.
@name setColor
@memberOf me.Color
@function
@param {Number} r red component [0 .. 255]
@param {Number} g green component [0 .. 255]
@param {Number} b blue component [0 .. 255]
@param {Number} [alpha=1.0] alpha value [0.0 .. 1.0]
@return {me.Color} Reference to this object for meth... | [
"Set",
"this",
"color",
"to",
"the",
"specified",
"value",
"."
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/utils/color.js#L213-L224 | |
7,226 | melonjs/melonJS | src/utils/color.js | function (color) {
if (color instanceof me.Color) {
this.glArray.set(color.glArray);
return this;
}
return this.parseCSS(color);
} | javascript | function (color) {
if (color instanceof me.Color) {
this.glArray.set(color.glArray);
return this;
}
return this.parseCSS(color);
} | [
"function",
"(",
"color",
")",
"{",
"if",
"(",
"color",
"instanceof",
"me",
".",
"Color",
")",
"{",
"this",
".",
"glArray",
".",
"set",
"(",
"color",
".",
"glArray",
")",
";",
"return",
"this",
";",
"}",
"return",
"this",
".",
"parseCSS",
"(",
"col... | Copy a color object or CSS color into this one.
@name copy
@memberOf me.Color
@function
@param {me.Color|String} color
@return {me.Color} Reference to this object for method chaining | [
"Copy",
"a",
"color",
"object",
"or",
"CSS",
"color",
"into",
"this",
"one",
"."
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/utils/color.js#L245-L252 | |
7,227 | melonjs/melonJS | src/utils/color.js | function (color) {
this.glArray[0] = me.Math.clamp(this.glArray[0] + color.glArray[0], 0, 1);
this.glArray[1] = me.Math.clamp(this.glArray[1] + color.glArray[1], 0, 1);
this.glArray[2] = me.Math.clamp(this.glArray[2] + color.glArray[2], 0, 1);
this.glArray[3] = (this.glAr... | javascript | function (color) {
this.glArray[0] = me.Math.clamp(this.glArray[0] + color.glArray[0], 0, 1);
this.glArray[1] = me.Math.clamp(this.glArray[1] + color.glArray[1], 0, 1);
this.glArray[2] = me.Math.clamp(this.glArray[2] + color.glArray[2], 0, 1);
this.glArray[3] = (this.glAr... | [
"function",
"(",
"color",
")",
"{",
"this",
".",
"glArray",
"[",
"0",
"]",
"=",
"me",
".",
"Math",
".",
"clamp",
"(",
"this",
".",
"glArray",
"[",
"0",
"]",
"+",
"color",
".",
"glArray",
"[",
"0",
"]",
",",
"0",
",",
"1",
")",
";",
"this",
... | Blend this color with the given one using addition.
@name add
@memberOf me.Color
@function
@param {me.Color} color
@return {me.Color} Reference to this object for method chaining | [
"Blend",
"this",
"color",
"with",
"the",
"given",
"one",
"using",
"addition",
"."
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/utils/color.js#L262-L269 | |
7,228 | melonjs/melonJS | src/utils/color.js | function (scale) {
scale = me.Math.clamp(scale, 0, 1);
this.glArray[0] *= scale;
this.glArray[1] *= scale;
this.glArray[2] *= scale;
return this;
} | javascript | function (scale) {
scale = me.Math.clamp(scale, 0, 1);
this.glArray[0] *= scale;
this.glArray[1] *= scale;
this.glArray[2] *= scale;
return this;
} | [
"function",
"(",
"scale",
")",
"{",
"scale",
"=",
"me",
".",
"Math",
".",
"clamp",
"(",
"scale",
",",
"0",
",",
"1",
")",
";",
"this",
".",
"glArray",
"[",
"0",
"]",
"*=",
"scale",
";",
"this",
".",
"glArray",
"[",
"1",
"]",
"*=",
"scale",
";... | Darken this color value by 0..1
@name darken
@memberOf me.Color
@function
@param {Number} scale
@return {me.Color} Reference to this object for method chaining | [
"Darken",
"this",
"color",
"value",
"by",
"0",
"..",
"1"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/utils/color.js#L279-L286 | |
7,229 | melonjs/melonJS | src/utils/color.js | function (cssColor) {
// TODO : Memoize this function by caching its input
if (cssToRGB.has(cssColor)) {
return this.setColor.apply(this, cssToRGB.get(cssColor));
}
return this.parseRGB(cssColor);
} | javascript | function (cssColor) {
// TODO : Memoize this function by caching its input
if (cssToRGB.has(cssColor)) {
return this.setColor.apply(this, cssToRGB.get(cssColor));
}
return this.parseRGB(cssColor);
} | [
"function",
"(",
"cssColor",
")",
"{",
"// TODO : Memoize this function by caching its input",
"if",
"(",
"cssToRGB",
".",
"has",
"(",
"cssColor",
")",
")",
"{",
"return",
"this",
".",
"setColor",
".",
"apply",
"(",
"this",
",",
"cssToRGB",
".",
"get",
"(",
... | Parse a CSS color string and set this color to the corresponding
r,g,b values
@name parseCSS
@memberOf me.Color
@function
@param {String} color
@return {me.Color} Reference to this object for method chaining | [
"Parse",
"a",
"CSS",
"color",
"string",
"and",
"set",
"this",
"color",
"to",
"the",
"corresponding",
"r",
"g",
"b",
"values"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/utils/color.js#L348-L356 | |
7,230 | melonjs/melonJS | src/utils/color.js | function (rgbColor) {
// TODO : Memoize this function by caching its input
var match = rgbaRx.exec(rgbColor);
if (match) {
return this.setColor(+match[1], +match[2], +match[3], +match[5]);
}
return this.parseHex(rgbColor);
} | javascript | function (rgbColor) {
// TODO : Memoize this function by caching its input
var match = rgbaRx.exec(rgbColor);
if (match) {
return this.setColor(+match[1], +match[2], +match[3], +match[5]);
}
return this.parseHex(rgbColor);
} | [
"function",
"(",
"rgbColor",
")",
"{",
"// TODO : Memoize this function by caching its input",
"var",
"match",
"=",
"rgbaRx",
".",
"exec",
"(",
"rgbColor",
")",
";",
"if",
"(",
"match",
")",
"{",
"return",
"this",
".",
"setColor",
"(",
"+",
"match",
"[",
"1"... | Parse an RGB or RGBA CSS color string
@name parseRGB
@memberOf me.Color
@function
@param {String} color
@return {me.Color} Reference to this object for method chaining | [
"Parse",
"an",
"RGB",
"or",
"RGBA",
"CSS",
"color",
"string"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/utils/color.js#L366-L375 | |
7,231 | melonjs/melonJS | src/level/tiled/TMXTiledMap.js | readLayer | function readLayer(map, data, z) {
var layer = new me.TMXLayer(data, map.tilewidth, map.tileheight, map.orientation, map.tilesets, z);
// set a renderer
layer.setRenderer(map.getRenderer());
return layer;
} | javascript | function readLayer(map, data, z) {
var layer = new me.TMXLayer(data, map.tilewidth, map.tileheight, map.orientation, map.tilesets, z);
// set a renderer
layer.setRenderer(map.getRenderer());
return layer;
} | [
"function",
"readLayer",
"(",
"map",
",",
"data",
",",
"z",
")",
"{",
"var",
"layer",
"=",
"new",
"me",
".",
"TMXLayer",
"(",
"data",
",",
"map",
".",
"tilewidth",
",",
"map",
".",
"tileheight",
",",
"map",
".",
"orientation",
",",
"map",
".",
"til... | read the layer Data
@ignore | [
"read",
"the",
"layer",
"Data"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/level/tiled/TMXTiledMap.js#L35-L40 |
7,232 | melonjs/melonJS | src/level/tiled/TMXTiledMap.js | readImageLayer | function readImageLayer(map, data, z) {
// Normalize properties
me.TMXUtils.applyTMXProperties(data.properties, data);
// create the layer
var imageLayer = me.pool.pull("me.ImageLayer",
// x/y is deprecated since 0.15 and replace by offsetx/y
+data.offsetx || +da... | javascript | function readImageLayer(map, data, z) {
// Normalize properties
me.TMXUtils.applyTMXProperties(data.properties, data);
// create the layer
var imageLayer = me.pool.pull("me.ImageLayer",
// x/y is deprecated since 0.15 and replace by offsetx/y
+data.offsetx || +da... | [
"function",
"readImageLayer",
"(",
"map",
",",
"data",
",",
"z",
")",
"{",
"// Normalize properties",
"me",
".",
"TMXUtils",
".",
"applyTMXProperties",
"(",
"data",
".",
"properties",
",",
"data",
")",
";",
"// create the layer",
"var",
"imageLayer",
"=",
"me"... | read the Image Layer Data
@ignore | [
"read",
"the",
"Image",
"Layer",
"Data"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/level/tiled/TMXTiledMap.js#L46-L67 |
7,233 | melonjs/melonJS | src/level/tiled/TMXTiledMap.js | function (data) {
if (this.initialized === true) {
return;
}
// to automatically increment z index
var zOrder = 0;
var self = this;
// Tileset information
if (!this.tilesets) {
// make sure we have a T... | javascript | function (data) {
if (this.initialized === true) {
return;
}
// to automatically increment z index
var zOrder = 0;
var self = this;
// Tileset information
if (!this.tilesets) {
// make sure we have a T... | [
"function",
"(",
"data",
")",
"{",
"if",
"(",
"this",
".",
"initialized",
"===",
"true",
")",
"{",
"return",
";",
"}",
"// to automatically increment z index",
"var",
"zOrder",
"=",
"0",
";",
"var",
"self",
"=",
"this",
";",
"// Tileset information",
"if",
... | parse the map
@ignore | [
"parse",
"the",
"map"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/level/tiled/TMXTiledMap.js#L271-L346 | |
7,234 | melonjs/melonJS | src/level/tiled/TMXTiledMap.js | function (container, flatten) {
var _sort = container.autoSort;
var _depth = container.autoDepth;
// disable auto-sort and auto-depth
container.autoSort = false;
container.autoDepth = false;
// add all layers instances
this.getLayers(... | javascript | function (container, flatten) {
var _sort = container.autoSort;
var _depth = container.autoDepth;
// disable auto-sort and auto-depth
container.autoSort = false;
container.autoDepth = false;
// add all layers instances
this.getLayers(... | [
"function",
"(",
"container",
",",
"flatten",
")",
"{",
"var",
"_sort",
"=",
"container",
".",
"autoSort",
";",
"var",
"_depth",
"=",
"container",
".",
"autoDepth",
";",
"// disable auto-sort and auto-depth",
"container",
".",
"autoSort",
"=",
"false",
";",
"c... | add all the map layers and objects to the given container
@name me.TMXTileMap#addTo
@public
@function
@param {me.Container} target container
@param {boolean} flatten if true, flatten all objects into the given container
@example
// create a new level object based on the TMX JSON object
var level = new me.TMXTileMap(lev... | [
"add",
"all",
"the",
"map",
"layers",
"and",
"objects",
"to",
"the",
"given",
"container"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/level/tiled/TMXTiledMap.js#L362-L386 | |
7,235 | melonjs/melonJS | src/video/texture.js | function (data) {
var atlas = {};
var image = data.image;
var spacing = data.spacing || 0;
var margin = data.margin || 0;
var width = image.width;
var height = image.height;
// calculate the sprite count (line, col)
var sp... | javascript | function (data) {
var atlas = {};
var image = data.image;
var spacing = data.spacing || 0;
var margin = data.margin || 0;
var width = image.width;
var height = image.height;
// calculate the sprite count (line, col)
var sp... | [
"function",
"(",
"data",
")",
"{",
"var",
"atlas",
"=",
"{",
"}",
";",
"var",
"image",
"=",
"data",
".",
"image",
";",
"var",
"spacing",
"=",
"data",
".",
"spacing",
"||",
"0",
";",
"var",
"margin",
"=",
"data",
".",
"margin",
"||",
"0",
";",
"... | build an atlas from the given spritesheet
@ignore | [
"build",
"an",
"atlas",
"from",
"the",
"given",
"spritesheet"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/video/texture.js#L210-L262 | |
7,236 | melonjs/melonJS | src/video/texture.js | function (name) {
// Get the source texture region
var region = this.getRegion(name);
if (typeof(region) === "undefined") {
// TODO: Require proper atlas regions instead of caching arbitrary region keys
var keys = name.split(","),
... | javascript | function (name) {
// Get the source texture region
var region = this.getRegion(name);
if (typeof(region) === "undefined") {
// TODO: Require proper atlas regions instead of caching arbitrary region keys
var keys = name.split(","),
... | [
"function",
"(",
"name",
")",
"{",
"// Get the source texture region",
"var",
"region",
"=",
"this",
".",
"getRegion",
"(",
"name",
")",
";",
"if",
"(",
"typeof",
"(",
"region",
")",
"===",
"\"undefined\"",
")",
"{",
"// TODO: Require proper atlas regions instead ... | return the uvs mapping for the given region
@name getUVs
@memberOf me.Renderer.Texture
@function
@param {Object} region region (or frame) name
@return {Float32Array} region Uvs | [
"return",
"the",
"uvs",
"mapping",
"for",
"the",
"given",
"region"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/video/texture.js#L381-L395 | |
7,237 | melonjs/melonJS | src/video/texture.js | function (name, settings) {
// instantiate a new sprite object
return me.pool.pull(
"me.Sprite",
0, 0,
Object.assign({
image: this,
region : name
}, settings || {})
);
} | javascript | function (name, settings) {
// instantiate a new sprite object
return me.pool.pull(
"me.Sprite",
0, 0,
Object.assign({
image: this,
region : name
}, settings || {})
);
} | [
"function",
"(",
"name",
",",
"settings",
")",
"{",
"// instantiate a new sprite object",
"return",
"me",
".",
"pool",
".",
"pull",
"(",
"\"me.Sprite\"",
",",
"0",
",",
"0",
",",
"Object",
".",
"assign",
"(",
"{",
"image",
":",
"this",
",",
"region",
":"... | Create a sprite object using the first region found using the specified name
@name createSpriteFromName
@memberOf me.Renderer.Texture
@function
@param {String} name name of the sprite
@param {Object} [settings] Additional settings passed to the {@link me.Sprite} contructor
@return {me.Sprite}
@example
// create a new t... | [
"Create",
"a",
"sprite",
"object",
"using",
"the",
"first",
"region",
"found",
"using",
"the",
"specified",
"name"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/video/texture.js#L418-L428 | |
7,238 | melonjs/melonJS | src/state/state.js | _renderFrame | function _renderFrame(time) {
var stage = _stages[_state].stage;
// update all game objects
me.game.update(time, stage);
// render all game objects
me.game.draw(stage);
// schedule the next frame update
if (_animFrameId !== -1) {
... | javascript | function _renderFrame(time) {
var stage = _stages[_state].stage;
// update all game objects
me.game.update(time, stage);
// render all game objects
me.game.draw(stage);
// schedule the next frame update
if (_animFrameId !== -1) {
... | [
"function",
"_renderFrame",
"(",
"time",
")",
"{",
"var",
"stage",
"=",
"_stages",
"[",
"_state",
"]",
".",
"stage",
";",
"// update all game objects",
"me",
".",
"game",
".",
"update",
"(",
"time",
",",
"stage",
")",
";",
"// render all game objects",
"me",... | this is only called when using requestAnimFrame stuff
@param {Number} time current timestamp in milliseconds
@ignore | [
"this",
"is",
"only",
"called",
"when",
"using",
"requestAnimFrame",
"stuff"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/state/state.js#L87-L97 |
7,239 | melonjs/melonJS | src/state/state.js | _switchState | function _switchState(state) {
// clear previous interval if any
_stopRunLoop();
// call the stage destroy method
if (_stages[_state]) {
// just notify the object
_stages[_state].stage.destroy();
}
if (_stages[stat... | javascript | function _switchState(state) {
// clear previous interval if any
_stopRunLoop();
// call the stage destroy method
if (_stages[_state]) {
// just notify the object
_stages[_state].stage.destroy();
}
if (_stages[stat... | [
"function",
"_switchState",
"(",
"state",
")",
"{",
"// clear previous interval if any",
"_stopRunLoop",
"(",
")",
";",
"// call the stage destroy method",
"if",
"(",
"_stages",
"[",
"_state",
"]",
")",
"{",
"// just notify the object",
"_stages",
"[",
"_state",
"]",
... | start the SO main loop
@ignore | [
"start",
"the",
"SO",
"main",
"loop"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/state/state.js#L113-L142 |
7,240 | melonjs/melonJS | src/renderable/colorlayer.js | function (renderer, rect) {
var color = renderer.getColor();
var vpos = me.game.viewport.pos;
renderer.setColor(this.color);
renderer.fillRect(
rect.left - vpos.x, rect.top - vpos.y,
rect.width, rect.height
);
render... | javascript | function (renderer, rect) {
var color = renderer.getColor();
var vpos = me.game.viewport.pos;
renderer.setColor(this.color);
renderer.fillRect(
rect.left - vpos.x, rect.top - vpos.y,
rect.width, rect.height
);
render... | [
"function",
"(",
"renderer",
",",
"rect",
")",
"{",
"var",
"color",
"=",
"renderer",
".",
"getColor",
"(",
")",
";",
"var",
"vpos",
"=",
"me",
".",
"game",
".",
"viewport",
".",
"pos",
";",
"renderer",
".",
"setColor",
"(",
"this",
".",
"color",
")... | draw the color layer
@ignore | [
"draw",
"the",
"color",
"layer"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/renderable/colorlayer.js#L47-L56 | |
7,241 | melonjs/melonJS | src/physics/collision.js | flattenPointsOn | function flattenPointsOn(points, normal, result) {
var min = Number.MAX_VALUE;
var max = -Number.MAX_VALUE;
var len = points.length;
for (var i = 0; i < len; i++) {
// The magnitude of the projection of the point onto the normal
var dot = points[i].dotProduct(norm... | javascript | function flattenPointsOn(points, normal, result) {
var min = Number.MAX_VALUE;
var max = -Number.MAX_VALUE;
var len = points.length;
for (var i = 0; i < len; i++) {
// The magnitude of the projection of the point onto the normal
var dot = points[i].dotProduct(norm... | [
"function",
"flattenPointsOn",
"(",
"points",
",",
"normal",
",",
"result",
")",
"{",
"var",
"min",
"=",
"Number",
".",
"MAX_VALUE",
";",
"var",
"max",
"=",
"-",
"Number",
".",
"MAX_VALUE",
";",
"var",
"len",
"=",
"points",
".",
"length",
";",
"for",
... | Flattens the specified array of points onto a unit vector axis,
resulting in a one dimensional range of the minimum and
maximum value on that axis.
@param {Array.<Vector>} points The points to flatten.
@param {Vector} normal The unit vector axis to flatten on.
@param {Array.<number>} result An array. After calling thi... | [
"Flattens",
"the",
"specified",
"array",
"of",
"points",
"onto",
"a",
"unit",
"vector",
"axis",
"resulting",
"in",
"a",
"one",
"dimensional",
"range",
"of",
"the",
"minimum",
"and",
"maximum",
"value",
"on",
"that",
"axis",
"."
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/physics/collision.js#L58-L70 |
7,242 | melonjs/melonJS | src/loader/loader.js | checkLoadStatus | function checkLoadStatus(onload) {
if (loadCount === resourceCount) {
// wait 1/2s and execute callback (cheap workaround to ensure everything is loaded)
if (onload || api.onload) {
// make sure we clear the timer
clearTimeout(timerId);... | javascript | function checkLoadStatus(onload) {
if (loadCount === resourceCount) {
// wait 1/2s and execute callback (cheap workaround to ensure everything is loaded)
if (onload || api.onload) {
// make sure we clear the timer
clearTimeout(timerId);... | [
"function",
"checkLoadStatus",
"(",
"onload",
")",
"{",
"if",
"(",
"loadCount",
"===",
"resourceCount",
")",
"{",
"// wait 1/2s and execute callback (cheap workaround to ensure everything is loaded)",
"if",
"(",
"onload",
"||",
"api",
".",
"onload",
")",
"{",
"// make s... | check the loading status
@ignore | [
"check",
"the",
"loading",
"status"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/loader/loader.js#L32-L55 |
7,243 | melonjs/melonJS | src/loader/loader.js | preloadFontFace | function preloadFontFace(data, onload, onerror) {
var font = new FontFace(data.name, data.src);
// loading promise
font.load().then(function() {
// apply the font after the font has finished downloading
document.fonts.add(font);
documen... | javascript | function preloadFontFace(data, onload, onerror) {
var font = new FontFace(data.name, data.src);
// loading promise
font.load().then(function() {
// apply the font after the font has finished downloading
document.fonts.add(font);
documen... | [
"function",
"preloadFontFace",
"(",
"data",
",",
"onload",
",",
"onerror",
")",
"{",
"var",
"font",
"=",
"new",
"FontFace",
"(",
"data",
".",
"name",
",",
"data",
".",
"src",
")",
";",
"// loading promise",
"font",
".",
"load",
"(",
")",
".",
"then",
... | load a font face
@example
preloadFontFace(
name: "'kenpixel'", type: "fontface", src: "url('data/font/kenvector_future.woff2')"
]);
@ignore | [
"load",
"a",
"font",
"face"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/loader/loader.js#L87-L100 |
7,244 | melonjs/melonJS | src/loader/loader.js | preloadJSON | function preloadJSON(data, onload, onerror) {
var xmlhttp = new XMLHttpRequest();
if (xmlhttp.overrideMimeType) {
xmlhttp.overrideMimeType("application/json");
}
xmlhttp.open("GET", data.src + api.nocache, true);
xmlhttp.withCredentials = me.... | javascript | function preloadJSON(data, onload, onerror) {
var xmlhttp = new XMLHttpRequest();
if (xmlhttp.overrideMimeType) {
xmlhttp.overrideMimeType("application/json");
}
xmlhttp.open("GET", data.src + api.nocache, true);
xmlhttp.withCredentials = me.... | [
"function",
"preloadJSON",
"(",
"data",
",",
"onload",
",",
"onerror",
")",
"{",
"var",
"xmlhttp",
"=",
"new",
"XMLHttpRequest",
"(",
")",
";",
"if",
"(",
"xmlhttp",
".",
"overrideMimeType",
")",
"{",
"xmlhttp",
".",
"overrideMimeType",
"(",
"\"application/j... | preload JSON files
@ignore | [
"preload",
"JSON",
"files"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/loader/loader.js#L207-L236 |
7,245 | melonjs/melonJS | src/shapes/poly.js | function (x, y, points) {
this.pos.set(x, y);
if (!Array.isArray(points)) {
return this;
}
// convert given points to me.Vector2d if required
if (!(points[0] instanceof me.Vector2d)) {
var _points = this.points = [];
... | javascript | function (x, y, points) {
this.pos.set(x, y);
if (!Array.isArray(points)) {
return this;
}
// convert given points to me.Vector2d if required
if (!(points[0] instanceof me.Vector2d)) {
var _points = this.points = [];
... | [
"function",
"(",
"x",
",",
"y",
",",
"points",
")",
"{",
"this",
".",
"pos",
".",
"set",
"(",
"x",
",",
"y",
")",
";",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"points",
")",
")",
"{",
"return",
"this",
";",
"}",
"// convert given points to ... | set new value to the Polygon
@name setShape
@memberOf me.Polygon.prototype
@function
@param {Number} x position of the Polygon
@param {Number} y position of the Polygon
@param {me.Vector2d[]} points array of vector defining the Polygon | [
"set",
"new",
"value",
"to",
"the",
"Polygon"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/shapes/poly.js#L94-L116 | |
7,246 | melonjs/melonJS | src/shapes/poly.js | function (x, y) {
y = typeof (y) !== "undefined" ? y : x;
var points = this.points;
var len = points.length;
for (var i = 0; i < len; i++) {
points[i].scale(x, y);
}
this.recalc();
this.updateBounds();
retur... | javascript | function (x, y) {
y = typeof (y) !== "undefined" ? y : x;
var points = this.points;
var len = points.length;
for (var i = 0; i < len; i++) {
points[i].scale(x, y);
}
this.recalc();
this.updateBounds();
retur... | [
"function",
"(",
"x",
",",
"y",
")",
"{",
"y",
"=",
"typeof",
"(",
"y",
")",
"!==",
"\"undefined\"",
"?",
"y",
":",
"x",
";",
"var",
"points",
"=",
"this",
".",
"points",
";",
"var",
"len",
"=",
"points",
".",
"length",
";",
"for",
"(",
"var",
... | Scale this Polygon by the given scalar.
@name scale
@memberOf me.Polygon.prototype
@function
@param {Number} x
@param {Number} [y=x]
@return {me.Polygon} Reference to this object for method chaining | [
"Scale",
"this",
"Polygon",
"by",
"the",
"given",
"scalar",
"."
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/shapes/poly.js#L189-L200 | |
7,247 | melonjs/melonJS | src/entity/entity.js | function (body) {
// update the entity bounds to match with the body bounds
this.getBounds().resize(body.width, body.height);
// update the bounds pos
this.updateBoundsPos(this.pos.x, this.pos.y);
} | javascript | function (body) {
// update the entity bounds to match with the body bounds
this.getBounds().resize(body.width, body.height);
// update the bounds pos
this.updateBoundsPos(this.pos.x, this.pos.y);
} | [
"function",
"(",
"body",
")",
"{",
"// update the entity bounds to match with the body bounds",
"this",
".",
"getBounds",
"(",
")",
".",
"resize",
"(",
"body",
".",
"width",
",",
"body",
".",
"height",
")",
";",
"// update the bounds pos",
"this",
".",
"updateBoun... | update the bounds position when the body is modified
@private
@name onBodyUpdate
@memberOf me.Entity
@function | [
"update",
"the",
"bounds",
"position",
"when",
"the",
"body",
"is",
"modified"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/entity/entity.js#L176-L181 | |
7,248 | melonjs/melonJS | src/shapes/rectangle.js | function () {
return (isFinite(this.pos.x) && isFinite(this.pos.y) && isFinite(this._width) && isFinite(this._height));
} | javascript | function () {
return (isFinite(this.pos.x) && isFinite(this.pos.y) && isFinite(this._width) && isFinite(this._height));
} | [
"function",
"(",
")",
"{",
"return",
"(",
"isFinite",
"(",
"this",
".",
"pos",
".",
"x",
")",
"&&",
"isFinite",
"(",
"this",
".",
"pos",
".",
"y",
")",
"&&",
"isFinite",
"(",
"this",
".",
"_width",
")",
"&&",
"isFinite",
"(",
"this",
".",
"_heigh... | determines whether all coordinates of this rectangle are finite numbers.
@name isFinite
@memberOf me.Rect.prototype
@function
@return {boolean} false if all coordinates are positive or negative Infinity or NaN; otherwise, true. | [
"determines",
"whether",
"all",
"coordinates",
"of",
"this",
"rectangle",
"are",
"finite",
"numbers",
"."
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/shapes/rectangle.js#L283-L285 | |
7,249 | melonjs/melonJS | src/level/LevelDirector.js | loadTMXLevel | function loadTMXLevel(levelId, container, flatten, setViewportBounds) {
var level = levels[levelId];
// disable auto-sort for the given container
var autoSort = container.autoSort;
container.autoSort = false;
var levelBounds = level.getBounds();
... | javascript | function loadTMXLevel(levelId, container, flatten, setViewportBounds) {
var level = levels[levelId];
// disable auto-sort for the given container
var autoSort = container.autoSort;
container.autoSort = false;
var levelBounds = level.getBounds();
... | [
"function",
"loadTMXLevel",
"(",
"levelId",
",",
"container",
",",
"flatten",
",",
"setViewportBounds",
")",
"{",
"var",
"level",
"=",
"levels",
"[",
"levelId",
"]",
";",
"// disable auto-sort for the given container",
"var",
"autoSort",
"=",
"container",
".",
"au... | Load a TMX level
@name loadTMXLevel
@memberOf me.game
@private
@param {String} level level id
@param {me.Container} target container
@param {boolean} flatten if true, flatten all objects into the given container
@param {boolean} setViewportBounds if true, set the viewport bounds to the map size
@ignore
@function | [
"Load",
"a",
"TMX",
"level"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/level/LevelDirector.js#L68-L120 |
7,250 | melonjs/melonJS | src/shapes/line.js | function (x, y) {
// translate the given coordinates,
// rather than creating temp translated vectors
x -= this.pos.x; // Cx
y -= this.pos.y; // Cy
var start = this.points[0]; // Ax/Ay
var end = this.points[1]; // Bx/By
//(Cy - Ay) * (... | javascript | function (x, y) {
// translate the given coordinates,
// rather than creating temp translated vectors
x -= this.pos.x; // Cx
y -= this.pos.y; // Cy
var start = this.points[0]; // Ax/Ay
var end = this.points[1]; // Bx/By
//(Cy - Ay) * (... | [
"function",
"(",
"x",
",",
"y",
")",
"{",
"// translate the given coordinates,",
"// rather than creating temp translated vectors",
"x",
"-=",
"this",
".",
"pos",
".",
"x",
";",
"// Cx",
"y",
"-=",
"this",
".",
"pos",
".",
"y",
";",
"// Cy",
"var",
"start",
... | check if this line segment contains the specified point
@name containsPoint
@memberOf me.Line.prototype
@function
@param {Number} x x coordinate
@param {Number} y y coordinate
@return {boolean} true if contains | [
"check",
"if",
"this",
"line",
"segment",
"contains",
"the",
"specified",
"point"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/shapes/line.js#L35-L45 | |
7,251 | melonjs/melonJS | src/font/text.js | function(context, font, stroke) {
context.font = font.font;
context.fillStyle = font.fillStyle.toRGBA();
if (stroke === true) {
context.strokeStyle = font.strokeStyle.toRGBA();
context.lineWidth = font.lineWidth;
}
context.textAlign = font.textAlign;
... | javascript | function(context, font, stroke) {
context.font = font.font;
context.fillStyle = font.fillStyle.toRGBA();
if (stroke === true) {
context.strokeStyle = font.strokeStyle.toRGBA();
context.lineWidth = font.lineWidth;
}
context.textAlign = font.textAlign;
... | [
"function",
"(",
"context",
",",
"font",
",",
"stroke",
")",
"{",
"context",
".",
"font",
"=",
"font",
".",
"font",
";",
"context",
".",
"fillStyle",
"=",
"font",
".",
"fillStyle",
".",
"toRGBA",
"(",
")",
";",
"if",
"(",
"stroke",
"===",
"true",
"... | apply the current font style to the given context
@ignore | [
"apply",
"the",
"current",
"font",
"style",
"to",
"the",
"given",
"context"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/font/text.js#L17-L26 | |
7,252 | melonjs/melonJS | src/font/text.js | function (renderer, text, x, y, stroke) {
// "hacky patch" for backward compatibilty
if (typeof this.ancestor === "undefined") {
// update text cache
this.setText(text);
// update position if changed
if (this.pos.x !== x || this.po... | javascript | function (renderer, text, x, y, stroke) {
// "hacky patch" for backward compatibilty
if (typeof this.ancestor === "undefined") {
// update text cache
this.setText(text);
// update position if changed
if (this.pos.x !== x || this.po... | [
"function",
"(",
"renderer",
",",
"text",
",",
"x",
",",
"y",
",",
"stroke",
")",
"{",
"// \"hacky patch\" for backward compatibilty",
"if",
"(",
"typeof",
"this",
".",
"ancestor",
"===",
"\"undefined\"",
")",
"{",
"// update text cache",
"this",
".",
"setText",... | draw a text at the specified coord
@name draw
@memberOf me.Text.prototype
@function
@param {me.CanvasRenderer|me.WebGLRenderer} renderer Reference to the destination renderer instance
@param {String} [text]
@param {Number} [x]
@param {Number} [y] | [
"draw",
"a",
"text",
"at",
"the",
"specified",
"coord"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/font/text.js#L332-L377 | |
7,253 | melonjs/melonJS | src/renderable/GUI.js | function (event) {
// Check if left mouse button is pressed
if (event.button === 0 && this.isClickable) {
this.updated = true;
this.released = false;
if (this.isHoldable) {
if (this.holdTimeout !== null) {
... | javascript | function (event) {
// Check if left mouse button is pressed
if (event.button === 0 && this.isClickable) {
this.updated = true;
this.released = false;
if (this.isHoldable) {
if (this.holdTimeout !== null) {
... | [
"function",
"(",
"event",
")",
"{",
"// Check if left mouse button is pressed",
"if",
"(",
"event",
".",
"button",
"===",
"0",
"&&",
"this",
".",
"isClickable",
")",
"{",
"this",
".",
"updated",
"=",
"true",
";",
"this",
".",
"released",
"=",
"false",
";",... | function callback for the pointerdown event
@ignore | [
"function",
"callback",
"for",
"the",
"pointerdown",
"event"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/renderable/GUI.js#L124-L138 | |
7,254 | melonjs/melonJS | src/renderable/GUI.js | function (event) {
if (this.released === false) {
this.released = true;
me.timer.clearTimeout(this.holdTimeout);
return this.onRelease.call(this, event);
}
} | javascript | function (event) {
if (this.released === false) {
this.released = true;
me.timer.clearTimeout(this.holdTimeout);
return this.onRelease.call(this, event);
}
} | [
"function",
"(",
"event",
")",
"{",
"if",
"(",
"this",
".",
"released",
"===",
"false",
")",
"{",
"this",
".",
"released",
"=",
"true",
";",
"me",
".",
"timer",
".",
"clearTimeout",
"(",
"this",
".",
"holdTimeout",
")",
";",
"return",
"this",
".",
... | function callback for the pointerup event
@ignore | [
"function",
"callback",
"for",
"the",
"pointerup",
"event"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/renderable/GUI.js#L197-L203 | |
7,255 | melonjs/melonJS | src/particles/emitter.js | function (count) {
for (var i = 0; i < ~~count; i++) {
// Add particle to the container
var particle = me.pool.pull("me.Particle", this);
this.container.addChild(particle);
}
} | javascript | function (count) {
for (var i = 0; i < ~~count; i++) {
// Add particle to the container
var particle = me.pool.pull("me.Particle", this);
this.container.addChild(particle);
}
} | [
"function",
"(",
"count",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"~",
"~",
"count",
";",
"i",
"++",
")",
"{",
"// Add particle to the container",
"var",
"particle",
"=",
"me",
".",
"pool",
".",
"pull",
"(",
"\"me.Particle\"",
",",... | Add count particles in the game world @ignore | [
"Add",
"count",
"particles",
"in",
"the",
"game",
"world"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/src/particles/emitter.js#L473-L479 | |
7,256 | melonjs/melonJS | dist/melonjs.js | apply_methods | function apply_methods(Class, methods, descriptor) {
Object.keys(descriptor).forEach(function (method) {
methods[method] = descriptor[method];
if (typeof(descriptor[method]) !== "function") {
throw new TypeError(
"extend: Method `" + me... | javascript | function apply_methods(Class, methods, descriptor) {
Object.keys(descriptor).forEach(function (method) {
methods[method] = descriptor[method];
if (typeof(descriptor[method]) !== "function") {
throw new TypeError(
"extend: Method `" + me... | [
"function",
"apply_methods",
"(",
"Class",
",",
"methods",
",",
"descriptor",
")",
"{",
"Object",
".",
"keys",
"(",
"descriptor",
")",
".",
"forEach",
"(",
"function",
"(",
"method",
")",
"{",
"methods",
"[",
"method",
"]",
"=",
"descriptor",
"[",
"metho... | Apply methods to the class prototype.
@ignore | [
"Apply",
"methods",
"to",
"the",
"class",
"prototype",
"."
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L233-L248 |
7,257 | melonjs/melonJS | dist/melonjs.js | angle | function angle(v) {
return Math.acos(me.Math.clamp(this.dotProduct(v) / (this.length() * v.length()), -1, 1));
} | javascript | function angle(v) {
return Math.acos(me.Math.clamp(this.dotProduct(v) / (this.length() * v.length()), -1, 1));
} | [
"function",
"angle",
"(",
"v",
")",
"{",
"return",
"Math",
".",
"acos",
"(",
"me",
".",
"Math",
".",
"clamp",
"(",
"this",
".",
"dotProduct",
"(",
"v",
")",
"/",
"(",
"this",
".",
"length",
"(",
")",
"*",
"v",
".",
"length",
"(",
")",
")",
",... | return the angle between this vector and the passed one
@name angle
@memberOf me.Vector2d
@function
@param {me.Vector2d} v
@return {Number} angle in radians | [
"return",
"the",
"angle",
"between",
"this",
"vector",
"and",
"the",
"passed",
"one"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L3697-L3699 |
7,258 | melonjs/melonJS | dist/melonjs.js | floorSelf | function floorSelf() {
return this._set(Math.floor(this.x), Math.floor(this.y), Math.floor(this.z));
} | javascript | function floorSelf() {
return this._set(Math.floor(this.x), Math.floor(this.y), Math.floor(this.z));
} | [
"function",
"floorSelf",
"(",
")",
"{",
"return",
"this",
".",
"_set",
"(",
"Math",
".",
"floor",
"(",
"this",
".",
"x",
")",
",",
"Math",
".",
"floor",
"(",
"this",
".",
"y",
")",
",",
"Math",
".",
"floor",
"(",
"this",
".",
"z",
")",
")",
"... | Floor this vector values
@name floorSelf
@memberOf me.Vector3d
@function
@return {me.Vector3d} Reference to this object for method chaining | [
"Floor",
"this",
"vector",
"values"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L4015-L4017 |
7,259 | melonjs/melonJS | dist/melonjs.js | ceil | function ceil() {
return new me.Vector3d(Math.ceil(this.x), Math.ceil(this.y), Math.ceil(this.z));
} | javascript | function ceil() {
return new me.Vector3d(Math.ceil(this.x), Math.ceil(this.y), Math.ceil(this.z));
} | [
"function",
"ceil",
"(",
")",
"{",
"return",
"new",
"me",
".",
"Vector3d",
"(",
"Math",
".",
"ceil",
"(",
"this",
".",
"x",
")",
",",
"Math",
".",
"ceil",
"(",
"this",
".",
"y",
")",
",",
"Math",
".",
"ceil",
"(",
"this",
".",
"z",
")",
")",
... | Ceil the vector values
@name ceil
@memberOf me.Vector3d
@function
@return {me.Vector3d} new me.Vector3d | [
"Ceil",
"the",
"vector",
"values"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L4026-L4028 |
7,260 | melonjs/melonJS | dist/melonjs.js | ceilSelf | function ceilSelf() {
return this._set(Math.ceil(this.x), Math.ceil(this.y), Math.ceil(this.z));
} | javascript | function ceilSelf() {
return this._set(Math.ceil(this.x), Math.ceil(this.y), Math.ceil(this.z));
} | [
"function",
"ceilSelf",
"(",
")",
"{",
"return",
"this",
".",
"_set",
"(",
"Math",
".",
"ceil",
"(",
"this",
".",
"x",
")",
",",
"Math",
".",
"ceil",
"(",
"this",
".",
"y",
")",
",",
"Math",
".",
"ceil",
"(",
"this",
".",
"z",
")",
")",
";",
... | Ceil this vector values
@name ceilSelf
@memberOf me.Vector3d
@function
@return {me.Vector3d} Reference to this object for method chaining | [
"Ceil",
"this",
"vector",
"values"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L4037-L4039 |
7,261 | melonjs/melonJS | dist/melonjs.js | setMuted | function setMuted(x, y, z) {
this._x = x;
this._y = y;
this._z = z;
return this;
} | javascript | function setMuted(x, y, z) {
this._x = x;
this._y = y;
this._z = z;
return this;
} | [
"function",
"setMuted",
"(",
"x",
",",
"y",
",",
"z",
")",
"{",
"this",
".",
"_x",
"=",
"x",
";",
"this",
".",
"_y",
"=",
"y",
";",
"this",
".",
"_z",
"=",
"z",
";",
"return",
"this",
";",
"}"
] | set the vector value without triggering the callback
@name setMuted
@memberOf me.ObservableVector3d
@function
@param {Number} x x value of the vector
@param {Number} y y value of the vector
@param {Number} z z value of the vector
@return {me.ObservableVector3d} Reference to this object for method chaining | [
"set",
"the",
"vector",
"value",
"without",
"triggering",
"the",
"callback"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L4872-L4877 |
7,262 | melonjs/melonJS | dist/melonjs.js | add | function add(v) {
return this._set(this._x + v.x, this._y + v.y, this._z + (v.z || 0));
} | javascript | function add(v) {
return this._set(this._x + v.x, this._y + v.y, this._z + (v.z || 0));
} | [
"function",
"add",
"(",
"v",
")",
"{",
"return",
"this",
".",
"_set",
"(",
"this",
".",
"_x",
"+",
"v",
".",
"x",
",",
"this",
".",
"_y",
"+",
"v",
".",
"y",
",",
"this",
".",
"_z",
"+",
"(",
"v",
".",
"z",
"||",
"0",
")",
")",
";",
"}"... | Add the passed vector to this vector
@name add
@memberOf me.ObservableVector3d
@function
@param {me.Vector2d|me.Vector3d|me.ObservableVector2d|me.ObservableVector3d} v
@return {me.ObservableVector3d} Reference to this object for method chaining | [
"Add",
"the",
"passed",
"vector",
"to",
"this",
"vector"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L4904-L4906 |
7,263 | melonjs/melonJS | dist/melonjs.js | equals | function equals(v) {
return this._x === v.x && this._y === v.y && this._z === (v.z || this._z);
} | javascript | function equals(v) {
return this._x === v.x && this._y === v.y && this._z === (v.z || this._z);
} | [
"function",
"equals",
"(",
"v",
")",
"{",
"return",
"this",
".",
"_x",
"===",
"v",
".",
"x",
"&&",
"this",
".",
"_y",
"===",
"v",
".",
"y",
"&&",
"this",
".",
"_z",
"===",
"(",
"v",
".",
"z",
"||",
"this",
".",
"_z",
")",
";",
"}"
] | return true if the two vectors are the same
@name equals
@memberOf me.ObservableVector3d
@function
@param {me.Vector2d|me.Vector3d|me.ObservableVector2d|me.ObservableVector3d} v
@return {Boolean} | [
"return",
"true",
"if",
"the",
"two",
"vectors",
"are",
"the",
"same"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L5119-L5121 |
7,264 | melonjs/melonJS | dist/melonjs.js | dotProduct | function dotProduct(v) {
return this._x * v.x + this._y * v.y + this._z * (v.z || 1);
} | javascript | function dotProduct(v) {
return this._x * v.x + this._y * v.y + this._z * (v.z || 1);
} | [
"function",
"dotProduct",
"(",
"v",
")",
"{",
"return",
"this",
".",
"_x",
"*",
"v",
".",
"x",
"+",
"this",
".",
"_y",
"*",
"v",
".",
"y",
"+",
"this",
".",
"_z",
"*",
"(",
"v",
".",
"z",
"||",
"1",
")",
";",
"}"
] | return the dot product of this vector and the passed one
@name dotProduct
@memberOf me.ObservableVector3d
@function
@param {me.Vector2d|me.Vector3d|me.ObservableVector2d|me.ObservableVector3d} v
@return {Number} The dot product. | [
"return",
"the",
"dot",
"product",
"of",
"this",
"vector",
"and",
"the",
"passed",
"one"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L5174-L5176 |
7,265 | melonjs/melonJS | dist/melonjs.js | setTransform | function setTransform() {
var a = this.val;
if (arguments.length === 9) {
a[0] = arguments[0]; // a - m00
a[1] = arguments[1]; // b - m10
a[2] = arguments[2]; // c - m20
a[3] = arguments[3]; // d - m01
a[4] = arguments[4]; // e - m11
... | javascript | function setTransform() {
var a = this.val;
if (arguments.length === 9) {
a[0] = arguments[0]; // a - m00
a[1] = arguments[1]; // b - m10
a[2] = arguments[2]; // c - m20
a[3] = arguments[3]; // d - m01
a[4] = arguments[4]; // e - m11
... | [
"function",
"setTransform",
"(",
")",
"{",
"var",
"a",
"=",
"this",
".",
"val",
";",
"if",
"(",
"arguments",
".",
"length",
"===",
"9",
")",
"{",
"a",
"[",
"0",
"]",
"=",
"arguments",
"[",
"0",
"]",
";",
"// a - m00",
"a",
"[",
"1",
"]",
"=",
... | set the matrix to the specified value
@name setTransform
@memberOf me.Matrix2d
@function
@param {Number} a
@param {Number} b
@param {Number} c
@param {Number} d
@param {Number} e
@param {Number} f
@param {Number} [g=0]
@param {Number} [h=0]
@param {Number} [i=1]
@return {me.Matrix2d} Reference to this object for method... | [
"set",
"the",
"matrix",
"to",
"the",
"specified",
"value"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L5306-L5348 |
7,266 | melonjs/melonJS | dist/melonjs.js | multiplyVectorInverse | function multiplyVectorInverse(v) {
var a = this.val,
x = v.x,
y = v.y;
var invD = 1 / (a[0] * a[4] + a[3] * -a[1]);
v.x = a[4] * invD * x + -a[3] * invD * y + (a[7] * a[3] - a[6] * a[4]) * invD;
v.y = a[0] * invD * y + -a[1] * invD * x + (-a[7] * a[0] + a[6... | javascript | function multiplyVectorInverse(v) {
var a = this.val,
x = v.x,
y = v.y;
var invD = 1 / (a[0] * a[4] + a[3] * -a[1]);
v.x = a[4] * invD * x + -a[3] * invD * y + (a[7] * a[3] - a[6] * a[4]) * invD;
v.y = a[0] * invD * y + -a[1] * invD * x + (-a[7] * a[0] + a[6... | [
"function",
"multiplyVectorInverse",
"(",
"v",
")",
"{",
"var",
"a",
"=",
"this",
".",
"val",
",",
"x",
"=",
"v",
".",
"x",
",",
"y",
"=",
"v",
".",
"y",
";",
"var",
"invD",
"=",
"1",
"/",
"(",
"a",
"[",
"0",
"]",
"*",
"a",
"[",
"4",
"]",... | Transforms the given vector using the inverted current 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",
"using",
"the",
"inverted",
"current",
"matrix",
"."
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L5474-L5482 |
7,267 | melonjs/melonJS | dist/melonjs.js | setShape | function setShape(x, y, w, h) {
var hW = w / 2;
var hH = h / 2;
this.pos.set(x, y);
this.radius = Math.max(hW, hH);
this.ratio.set(hW / this.radius, hH / this.radius);
this.radiusV.set(this.radius, this.radius).scaleV(this.ratio);
var r = this.radius * this... | javascript | function setShape(x, y, w, h) {
var hW = w / 2;
var hH = h / 2;
this.pos.set(x, y);
this.radius = Math.max(hW, hH);
this.ratio.set(hW / this.radius, hH / this.radius);
this.radiusV.set(this.radius, this.radius).scaleV(this.ratio);
var r = this.radius * this... | [
"function",
"setShape",
"(",
"x",
",",
"y",
",",
"w",
",",
"h",
")",
"{",
"var",
"hW",
"=",
"w",
"/",
"2",
";",
"var",
"hH",
"=",
"h",
"/",
"2",
";",
"this",
".",
"pos",
".",
"set",
"(",
"x",
",",
"y",
")",
";",
"this",
".",
"radius",
"... | set new value to the Ellipse shape
@name setShape
@memberOf me.Ellipse.prototype
@function
@param {Number} x position of the ellipse
@param {Number} y position of the ellipse
@param {Number} w width (diameter) of the ellipse
@param {Number} h height (diameter) of the ellipse | [
"set",
"new",
"value",
"to",
"the",
"Ellipse",
"shape"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L5760-L5771 |
7,268 | melonjs/melonJS | dist/melonjs.js | scale | function scale(x, y) {
y = typeof y !== "undefined" ? y : x;
return this.setShape(this.pos.x, this.pos.y, this.radiusV.x * 2 * x, this.radiusV.y * 2 * y);
} | javascript | function scale(x, y) {
y = typeof y !== "undefined" ? y : x;
return this.setShape(this.pos.x, this.pos.y, this.radiusV.x * 2 * x, this.radiusV.y * 2 * y);
} | [
"function",
"scale",
"(",
"x",
",",
"y",
")",
"{",
"y",
"=",
"typeof",
"y",
"!==",
"\"undefined\"",
"?",
"y",
":",
"x",
";",
"return",
"this",
".",
"setShape",
"(",
"this",
".",
"pos",
".",
"x",
",",
"this",
".",
"pos",
".",
"y",
",",
"this",
... | Scale this Ellipse by the specified scalar.
@name scale
@memberOf me.Ellipse.prototype
@function
@param {Number} x
@param {Number} [y=x]
@return {me.Ellipse} Reference to this object for method chaining | [
"Scale",
"this",
"Ellipse",
"by",
"the",
"specified",
"scalar",
"."
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L5797-L5800 |
7,269 | melonjs/melonJS | dist/melonjs.js | splitEarcut | function splitEarcut(start, triangles, dim, minX, minY, invSize) {
// look for a valid diagonal that divides the polygon into two
var a = start;
do {
var b = a.next.next;
while (b !== a.prev) {
if (a.i !== b.i && isValidDiagonal(a, b)) {
// sp... | javascript | function splitEarcut(start, triangles, dim, minX, minY, invSize) {
// look for a valid diagonal that divides the polygon into two
var a = start;
do {
var b = a.next.next;
while (b !== a.prev) {
if (a.i !== b.i && isValidDiagonal(a, b)) {
// sp... | [
"function",
"splitEarcut",
"(",
"start",
",",
"triangles",
",",
"dim",
",",
"minX",
",",
"minY",
",",
"invSize",
")",
"{",
"// look for a valid diagonal that divides the polygon into two",
"var",
"a",
"=",
"start",
";",
"do",
"{",
"var",
"b",
"=",
"a",
".",
... | try splitting polygon into two and triangulate them independently | [
"try",
"splitting",
"polygon",
"into",
"two",
"and",
"triangulate",
"them",
"independently"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L6175-L6198 |
7,270 | melonjs/melonJS | dist/melonjs.js | zOrder | function zOrder(x, y, minX, minY, invSize) {
// coords are transformed into non-negative 15-bit integer range
x = 32767 * (x - minX) * invSize;
y = 32767 * (y - minY) * invSize;
x = (x | (x << 8)) & 0x00FF00FF;
x = (x | (x << 4)) & 0x0F0F0F0F;
x = (x | (x << 2)) & 0x33333333;
... | javascript | function zOrder(x, y, minX, minY, invSize) {
// coords are transformed into non-negative 15-bit integer range
x = 32767 * (x - minX) * invSize;
y = 32767 * (y - minY) * invSize;
x = (x | (x << 8)) & 0x00FF00FF;
x = (x | (x << 4)) & 0x0F0F0F0F;
x = (x | (x << 2)) & 0x33333333;
... | [
"function",
"zOrder",
"(",
"x",
",",
"y",
",",
"minX",
",",
"minY",
",",
"invSize",
")",
"{",
"// coords are transformed into non-negative 15-bit integer range",
"x",
"=",
"32767",
"*",
"(",
"x",
"-",
"minX",
")",
"*",
"invSize",
";",
"y",
"=",
"32767",
"*... | z-order of a point given coords and inverse of the longer side of data bbox | [
"z",
"-",
"order",
"of",
"a",
"point",
"given",
"coords",
"and",
"inverse",
"of",
"the",
"longer",
"side",
"of",
"data",
"bbox"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L6366-L6382 |
7,271 | melonjs/melonJS | dist/melonjs.js | pointInTriangle | function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&
(ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&
(bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;
} | javascript | function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&
(ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&
(bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;
} | [
"function",
"pointInTriangle",
"(",
"ax",
",",
"ay",
",",
"bx",
",",
"by",
",",
"cx",
",",
"cy",
",",
"px",
",",
"py",
")",
"{",
"return",
"(",
"cx",
"-",
"px",
")",
"*",
"(",
"ay",
"-",
"py",
")",
"-",
"(",
"ax",
"-",
"px",
")",
"*",
"("... | check if a point lies within a convex triangle | [
"check",
"if",
"a",
"point",
"lies",
"within",
"a",
"convex",
"triangle"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L6397-L6401 |
7,272 | melonjs/melonJS | dist/melonjs.js | area | function area(p, q, r) {
return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
} | javascript | function area(p, q, r) {
return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
} | [
"function",
"area",
"(",
"p",
",",
"q",
",",
"r",
")",
"{",
"return",
"(",
"q",
".",
"y",
"-",
"p",
".",
"y",
")",
"*",
"(",
"r",
".",
"x",
"-",
"q",
".",
"x",
")",
"-",
"(",
"q",
".",
"x",
"-",
"p",
".",
"x",
")",
"*",
"(",
"r",
... | signed area of a triangle | [
"signed",
"area",
"of",
"a",
"triangle"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L6410-L6412 |
7,273 | melonjs/melonJS | dist/melonjs.js | splitPolygon | function splitPolygon(a, b) {
var a2 = new Node(a.i, a.x, a.y),
b2 = new Node(b.i, b.x, b.y),
an = a.next,
bp = b.prev;
a.next = b;
b.prev = a;
a2.next = an;
an.prev = a2;
b2.next = a2;
a2.prev = b2;
bp.next = b2;
b2.pre... | javascript | function splitPolygon(a, b) {
var a2 = new Node(a.i, a.x, a.y),
b2 = new Node(b.i, b.x, b.y),
an = a.next,
bp = b.prev;
a.next = b;
b.prev = a;
a2.next = an;
an.prev = a2;
b2.next = a2;
a2.prev = b2;
bp.next = b2;
b2.pre... | [
"function",
"splitPolygon",
"(",
"a",
",",
"b",
")",
"{",
"var",
"a2",
"=",
"new",
"Node",
"(",
"a",
".",
"i",
",",
"a",
".",
"x",
",",
"a",
".",
"y",
")",
",",
"b2",
"=",
"new",
"Node",
"(",
"b",
".",
"i",
",",
"b",
".",
"x",
",",
"b",... | link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; if one belongs to the outer ring and another to a hole, it merges it into a single ring | [
"link",
"two",
"polygon",
"vertices",
"with",
"a",
"bridge",
";",
"if",
"the",
"vertices",
"belong",
"to",
"the",
"same",
"ring",
"it",
"splits",
"polygon",
"into",
"two",
";",
"if",
"one",
"belongs",
"to",
"the",
"outer",
"ring",
"and",
"another",
"to",... | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L6464-L6483 |
7,274 | melonjs/melonJS | dist/melonjs.js | transform | function transform(m) {
var points = this.points;
var len = points.length;
for (var i = 0; i < len; i++) {
m.multiplyVector(points[i]);
}
this.recalc();
this.updateBounds();
return this;
} | javascript | function transform(m) {
var points = this.points;
var len = points.length;
for (var i = 0; i < len; i++) {
m.multiplyVector(points[i]);
}
this.recalc();
this.updateBounds();
return this;
} | [
"function",
"transform",
"(",
"m",
")",
"{",
"var",
"points",
"=",
"this",
".",
"points",
";",
"var",
"len",
"=",
"points",
".",
"length",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"m",
".",
"multi... | apply the given transformation matrix to this Polygon
@name transform
@memberOf me.Polygon.prototype
@function
@param {me.Matrix2d} matrix the transformation matrix
@return {me.Polygon} Reference to this object for method chaining | [
"apply",
"the",
"given",
"transformation",
"matrix",
"to",
"this",
"Polygon"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L6713-L6724 |
7,275 | melonjs/melonJS | dist/melonjs.js | clone | function clone() {
var copy = [];
this.points.forEach(function (point) {
copy.push(point.clone());
});
return new me.Polygon(this.pos.x, this.pos.y, copy);
} | javascript | function clone() {
var copy = [];
this.points.forEach(function (point) {
copy.push(point.clone());
});
return new me.Polygon(this.pos.x, this.pos.y, copy);
} | [
"function",
"clone",
"(",
")",
"{",
"var",
"copy",
"=",
"[",
"]",
";",
"this",
".",
"points",
".",
"forEach",
"(",
"function",
"(",
"point",
")",
"{",
"copy",
".",
"push",
"(",
"point",
".",
"clone",
"(",
")",
")",
";",
"}",
")",
";",
"return",... | clone this Polygon
@name clone
@memberOf me.Polygon.prototype
@function
@return {me.Polygon} new Polygon | [
"clone",
"this",
"Polygon"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L6992-L6998 |
7,276 | melonjs/melonJS | dist/melonjs.js | setShape | function setShape(x, y, w, h) {
var points = w; // assume w is an array by default
if (arguments.length === 4) {
points = this.points;
points[0].set(0, 0); // 0, 0
points[1].set(w, 0); // 1, 0
points[2].set(w, h); // 1, 1
points[3].set(0, h); ... | javascript | function setShape(x, y, w, h) {
var points = w; // assume w is an array by default
if (arguments.length === 4) {
points = this.points;
points[0].set(0, 0); // 0, 0
points[1].set(w, 0); // 1, 0
points[2].set(w, h); // 1, 1
points[3].set(0, h); ... | [
"function",
"setShape",
"(",
"x",
",",
"y",
",",
"w",
",",
"h",
")",
"{",
"var",
"points",
"=",
"w",
";",
"// assume w is an array by default",
"if",
"(",
"arguments",
".",
"length",
"===",
"4",
")",
"{",
"points",
"=",
"this",
".",
"points",
";",
"p... | set new value to the rectangle shape
@name setShape
@memberOf me.Rect.prototype
@function
@param {Number} x position of the Rectangle
@param {Number} y position of the Rectangle
@param {Number|Array} w|points width of the rectangle, or an array of vector defining the rectangle
@param {Number} [h] height of the rectangl... | [
"set",
"new",
"value",
"to",
"the",
"rectangle",
"shape"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L7044-L7066 |
7,277 | melonjs/melonJS | dist/melonjs.js | setPoints | function setPoints(points) {
var x = Infinity,
y = Infinity,
right = -Infinity,
bottom = -Infinity;
points.forEach(function (point) {
x = Math.min(x, point.x);
y = Math.min(y, point.y);
right = Math.max(right, point.x);
... | javascript | function setPoints(points) {
var x = Infinity,
y = Infinity,
right = -Infinity,
bottom = -Infinity;
points.forEach(function (point) {
x = Math.min(x, point.x);
y = Math.min(y, point.y);
right = Math.max(right, point.x);
... | [
"function",
"setPoints",
"(",
"points",
")",
"{",
"var",
"x",
"=",
"Infinity",
",",
"y",
"=",
"Infinity",
",",
"right",
"=",
"-",
"Infinity",
",",
"bottom",
"=",
"-",
"Infinity",
";",
"points",
".",
"forEach",
"(",
"function",
"(",
"point",
")",
"{",... | resize the rectangle to contain all the given points coordinates.
@name setPoints
@memberOf me.Rect.prototype
@function
@param {me.Vector2d[]} points array of vector defining a shape
@return {me.Rect} this shape bounding box Rectangle object | [
"resize",
"the",
"rectangle",
"to",
"contain",
"all",
"the",
"given",
"points",
"coordinates",
"."
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L7102-L7115 |
7,278 | melonjs/melonJS | dist/melonjs.js | copy | function copy(rect) {
return this.setShape(rect.pos.x, rect.pos.y, rect._width, rect._height);
} | javascript | function copy(rect) {
return this.setShape(rect.pos.x, rect.pos.y, rect._width, rect._height);
} | [
"function",
"copy",
"(",
"rect",
")",
"{",
"return",
"this",
".",
"setShape",
"(",
"rect",
".",
"pos",
".",
"x",
",",
"rect",
".",
"pos",
".",
"y",
",",
"rect",
".",
"_width",
",",
"rect",
".",
"_height",
")",
";",
"}"
] | copy the position and size of the given rectangle into this one
@name copy
@memberOf me.Rect.prototype
@function
@param {me.Rect} rect Source rectangle
@return {me.Rect} new rectangle | [
"copy",
"the",
"position",
"and",
"size",
"of",
"the",
"given",
"rectangle",
"into",
"this",
"one"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L7163-L7165 |
7,279 | melonjs/melonJS | dist/melonjs.js | union | function union(
/** {me.Rect} */
r) {
var x1 = Math.min(this.left, r.left);
var y1 = Math.min(this.top, r.top);
this.resize(Math.max(this.right, r.right) - x1, Math.max(this.bottom, r.bottom) - y1);
this.pos.set(x1, y1);
return this;
} | javascript | function union(
/** {me.Rect} */
r) {
var x1 = Math.min(this.left, r.left);
var y1 = Math.min(this.top, r.top);
this.resize(Math.max(this.right, r.right) - x1, Math.max(this.bottom, r.bottom) - y1);
this.pos.set(x1, y1);
return this;
} | [
"function",
"union",
"(",
"/** {me.Rect} */",
"r",
")",
"{",
"var",
"x1",
"=",
"Math",
".",
"min",
"(",
"this",
".",
"left",
",",
"r",
".",
"left",
")",
";",
"var",
"y1",
"=",
"Math",
".",
"min",
"(",
"this",
".",
"top",
",",
"r",
".",
"top",
... | merge this rectangle with another one
@name union
@memberOf me.Rect.prototype
@function
@param {me.Rect} rect other rectangle to union with
@return {me.Rect} the union(ed) rectangle | [
"merge",
"this",
"rectangle",
"with",
"another",
"one"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L7202-L7210 |
7,280 | melonjs/melonJS | dist/melonjs.js | containsPoint | function containsPoint(x, y) {
return x >= this.left && x <= this.right && y >= this.top && y <= this.bottom;
} | javascript | function containsPoint(x, y) {
return x >= this.left && x <= this.right && y >= this.top && y <= this.bottom;
} | [
"function",
"containsPoint",
"(",
"x",
",",
"y",
")",
"{",
"return",
"x",
">=",
"this",
".",
"left",
"&&",
"x",
"<=",
"this",
".",
"right",
"&&",
"y",
">=",
"this",
".",
"top",
"&&",
"y",
"<=",
"this",
".",
"bottom",
";",
"}"
] | check if this rectangle contains the specified point
@name containsPoint
@memberOf me.Rect.prototype
@function
@param {Number} x x coordinate
@param {Number} y y coordinate
@return {boolean} true if contains | [
"check",
"if",
"this",
"rectangle",
"contains",
"the",
"specified",
"point"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L7245-L7247 |
7,281 | melonjs/melonJS | dist/melonjs.js | equals | function equals(r) {
return r.left === this.left && r.right === this.right && r.top === this.top && r.bottom === this.bottom;
} | javascript | function equals(r) {
return r.left === this.left && r.right === this.right && r.top === this.top && r.bottom === this.bottom;
} | [
"function",
"equals",
"(",
"r",
")",
"{",
"return",
"r",
".",
"left",
"===",
"this",
".",
"left",
"&&",
"r",
".",
"right",
"===",
"this",
".",
"right",
"&&",
"r",
".",
"top",
"===",
"this",
".",
"top",
"&&",
"r",
".",
"bottom",
"===",
"this",
"... | check if this rectangle is identical to the specified one
@name equals
@memberOf me.Rect.prototype
@function
@param {me.Rect} rect
@return {boolean} true if equals | [
"check",
"if",
"this",
"rectangle",
"is",
"identical",
"to",
"the",
"specified",
"one"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L7257-L7259 |
7,282 | melonjs/melonJS | dist/melonjs.js | removeShape | function removeShape(shape) {
me.utils.array.remove(this.shapes, shape); // update the body bounds to take in account the removed shape
this.updateBounds(); // return the length of the shape list
return this.shapes.length;
} | javascript | function removeShape(shape) {
me.utils.array.remove(this.shapes, shape); // update the body bounds to take in account the removed shape
this.updateBounds(); // return the length of the shape list
return this.shapes.length;
} | [
"function",
"removeShape",
"(",
"shape",
")",
"{",
"me",
".",
"utils",
".",
"array",
".",
"remove",
"(",
"this",
".",
"shapes",
",",
"shape",
")",
";",
"// update the body bounds to take in account the removed shape",
"this",
".",
"updateBounds",
"(",
")",
";",
... | remove the specified shape from the body shape list
@name removeShape
@memberOf me.Body
@public
@function
@param {me.Polygon|me.Line|me.Ellipse} shape a shape object
@return {Number} the shape array length | [
"remove",
"the",
"specified",
"shape",
"from",
"the",
"body",
"shape",
"list"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L7944-L7950 |
7,283 | melonjs/melonJS | dist/melonjs.js | computeVelocity | function computeVelocity(vel) {
// apply fore if defined
if (this.force.x) {
vel.x += this.force.x * me.timer.tick;
}
if (this.force.y) {
vel.y += this.force.y * me.timer.tick;
} // apply friction
if (this.friction.x || this.friction.y) {
... | javascript | function computeVelocity(vel) {
// apply fore if defined
if (this.force.x) {
vel.x += this.force.x * me.timer.tick;
}
if (this.force.y) {
vel.y += this.force.y * me.timer.tick;
} // apply friction
if (this.friction.x || this.friction.y) {
... | [
"function",
"computeVelocity",
"(",
"vel",
")",
"{",
"// apply fore if defined",
"if",
"(",
"this",
".",
"force",
".",
"x",
")",
"{",
"vel",
".",
"x",
"+=",
"this",
".",
"force",
".",
"x",
"*",
"me",
".",
"timer",
".",
"tick",
";",
"}",
"if",
"(",
... | compute the new velocity value
@ignore | [
"compute",
"the",
"new",
"velocity",
"value"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L8120-L8155 |
7,284 | melonjs/melonJS | dist/melonjs.js | QT_ARRAY_POP | function QT_ARRAY_POP(bounds, max_objects, max_levels, level) {
if (QT_ARRAY.length > 0) {
var _qt = QT_ARRAY.pop();
_qt.bounds = bounds;
_qt.max_objects = max_objects || 4;
_qt.max_levels = max_levels || 4;
_qt.level = level || 0;
return _qt;
} else ... | javascript | function QT_ARRAY_POP(bounds, max_objects, max_levels, level) {
if (QT_ARRAY.length > 0) {
var _qt = QT_ARRAY.pop();
_qt.bounds = bounds;
_qt.max_objects = max_objects || 4;
_qt.max_levels = max_levels || 4;
_qt.level = level || 0;
return _qt;
} else ... | [
"function",
"QT_ARRAY_POP",
"(",
"bounds",
",",
"max_objects",
",",
"max_levels",
",",
"level",
")",
"{",
"if",
"(",
"QT_ARRAY",
".",
"length",
">",
"0",
")",
"{",
"var",
"_qt",
"=",
"QT_ARRAY",
".",
"pop",
"(",
")",
";",
"_qt",
".",
"bounds",
"=",
... | will pop a quadtree object from the array
or create a new one if the array is empty | [
"will",
"pop",
"a",
"quadtree",
"object",
"from",
"the",
"array",
"or",
"create",
"a",
"new",
"one",
"if",
"the",
"array",
"is",
"empty"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L8214-L8226 |
7,285 | melonjs/melonJS | dist/melonjs.js | scale | function scale(x, y) {
var _x = x,
_y = typeof y === "undefined" ? _x : y; // set the scaleFlag
this.currentTransform.scale(_x, _y); // resize the bounding box
this.getBounds().resize(this.width * _x, this.height * _y);
return this;
} | javascript | function scale(x, y) {
var _x = x,
_y = typeof y === "undefined" ? _x : y; // set the scaleFlag
this.currentTransform.scale(_x, _y); // resize the bounding box
this.getBounds().resize(this.width * _x, this.height * _y);
return this;
} | [
"function",
"scale",
"(",
"x",
",",
"y",
")",
"{",
"var",
"_x",
"=",
"x",
",",
"_y",
"=",
"typeof",
"y",
"===",
"\"undefined\"",
"?",
"_x",
":",
"y",
";",
"// set the scaleFlag",
"this",
".",
"currentTransform",
".",
"scale",
"(",
"_x",
",",
"_y",
... | scale the renderable around his anchor point. Scaling actually applies changes
to the currentTransform member wich is used by the renderer to scale the object
when rendering. It does not scale the object itself. For example if the renderable
is an image, the image.width and image.height properties are unaltered but ... | [
"scale",
"the",
"renderable",
"around",
"his",
"anchor",
"point",
".",
"Scaling",
"actually",
"applies",
"changes",
"to",
"the",
"currentTransform",
"member",
"wich",
"is",
"used",
"by",
"the",
"renderer",
"to",
"scale",
"the",
"object",
"when",
"rendering",
"... | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L9890-L9899 |
7,286 | melonjs/melonJS | dist/melonjs.js | resize | function resize(w, h) {
this._super(me.Renderable, "resize", [this.repeatX ? Infinity : w, this.repeatY ? Infinity : h]);
} | javascript | function resize(w, h) {
this._super(me.Renderable, "resize", [this.repeatX ? Infinity : w, this.repeatY ? Infinity : h]);
} | [
"function",
"resize",
"(",
"w",
",",
"h",
")",
"{",
"this",
".",
"_super",
"(",
"me",
".",
"Renderable",
",",
"\"resize\"",
",",
"[",
"this",
".",
"repeatX",
"?",
"Infinity",
":",
"w",
",",
"this",
".",
"repeatY",
"?",
"Infinity",
":",
"h",
"]",
... | resize the Image Layer to match the given size
@name resize
@memberOf me.ImageLayer.prototype
@function
@param {Number} w new width
@param {Number} h new height | [
"resize",
"the",
"Image",
"Layer",
"to",
"match",
"the",
"given",
"size"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L10448-L10450 |
7,287 | melonjs/melonJS | dist/melonjs.js | onDeactivateEvent | function onDeactivateEvent() {
// cancel all event subscriptions
me.event.unsubscribe(this.vpChangeHdlr);
me.event.unsubscribe(this.vpResizeHdlr);
me.event.unsubscribe(this.vpLoadedHdlr);
} | javascript | function onDeactivateEvent() {
// cancel all event subscriptions
me.event.unsubscribe(this.vpChangeHdlr);
me.event.unsubscribe(this.vpResizeHdlr);
me.event.unsubscribe(this.vpLoadedHdlr);
} | [
"function",
"onDeactivateEvent",
"(",
")",
"{",
"// cancel all event subscriptions",
"me",
".",
"event",
".",
"unsubscribe",
"(",
"this",
".",
"vpChangeHdlr",
")",
";",
"me",
".",
"event",
".",
"unsubscribe",
"(",
"this",
".",
"vpResizeHdlr",
")",
";",
"me",
... | called when the layer is removed from the game world or a container | [
"called",
"when",
"the",
"layer",
"is",
"removed",
"from",
"the",
"game",
"world",
"or",
"a",
"container"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L10542-L10547 |
7,288 | melonjs/melonJS | dist/melonjs.js | reverseAnimation | function reverseAnimation(name) {
if (typeof name !== "undefined" && typeof this.anim[name] !== "undefined") {
this.anim[name].frames.reverse();
} else {
this.anim[this.current.name].frames.reverse();
}
return this;
} | javascript | function reverseAnimation(name) {
if (typeof name !== "undefined" && typeof this.anim[name] !== "undefined") {
this.anim[name].frames.reverse();
} else {
this.anim[this.current.name].frames.reverse();
}
return this;
} | [
"function",
"reverseAnimation",
"(",
"name",
")",
"{",
"if",
"(",
"typeof",
"name",
"!==",
"\"undefined\"",
"&&",
"typeof",
"this",
".",
"anim",
"[",
"name",
"]",
"!==",
"\"undefined\"",
")",
"{",
"this",
".",
"anim",
"[",
"name",
"]",
".",
"frames",
"... | reverse the given or current animation if none is specified
@name reverseAnimation
@memberOf me.Sprite.prototype
@function
@param {String} [name] animation id
@return {me.Sprite} Reference to this object for method chaining
@see me.Sprite#animationspeed | [
"reverse",
"the",
"given",
"or",
"current",
"animation",
"if",
"none",
"is",
"specified"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L10958-L10966 |
7,289 | melonjs/melonJS | dist/melonjs.js | setRegion | function setRegion(region) {
if (this.source !== null) {
// set the source texture for the given region
this.image = this.source.getTexture(region);
} // set the sprite offset within the texture
this.current.offset.setV(region.offset); // set angle if defined
... | javascript | function setRegion(region) {
if (this.source !== null) {
// set the source texture for the given region
this.image = this.source.getTexture(region);
} // set the sprite offset within the texture
this.current.offset.setV(region.offset); // set angle if defined
... | [
"function",
"setRegion",
"(",
"region",
")",
"{",
"if",
"(",
"this",
".",
"source",
"!==",
"null",
")",
"{",
"// set the source texture for the given region",
"this",
".",
"image",
"=",
"this",
".",
"source",
".",
"getTexture",
"(",
"region",
")",
";",
"}",
... | change the current texture atlas region for this sprite
@see me.Texture.getRegion
@name setRegion
@memberOf me.Sprite.prototype
@function
@param {Object} region typically returned through me.Texture.getRegion()
@return {me.Sprite} Reference to this object for method chaining
@example
// change the sprite to "shadedDark... | [
"change",
"the",
"current",
"texture",
"atlas",
"region",
"for",
"this",
"sprite"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L10996-L11015 |
7,290 | melonjs/melonJS | dist/melonjs.js | setAnimationFrame | function setAnimationFrame(idx) {
this.current.idx = (idx || 0) % this.current.length;
return this.setRegion(this.getAnimationFrameObjectByIndex(this.current.idx));
} | javascript | function setAnimationFrame(idx) {
this.current.idx = (idx || 0) % this.current.length;
return this.setRegion(this.getAnimationFrameObjectByIndex(this.current.idx));
} | [
"function",
"setAnimationFrame",
"(",
"idx",
")",
"{",
"this",
".",
"current",
".",
"idx",
"=",
"(",
"idx",
"||",
"0",
")",
"%",
"this",
".",
"current",
".",
"length",
";",
"return",
"this",
".",
"setRegion",
"(",
"this",
".",
"getAnimationFrameObjectByI... | force the current animation frame index.
@name setAnimationFrame
@memberOf me.Sprite.prototype
@function
@param {Number} [index=0] animation frame index
@return {me.Sprite} Reference to this object for method chaining
@example
// reset the current animation to the first frame
this.setAnimationFrame(); | [
"force",
"the",
"current",
"animation",
"frame",
"index",
"."
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L11028-L11031 |
7,291 | melonjs/melonJS | dist/melonjs.js | onAnchorUpdate | function onAnchorUpdate(newX, newY) {
// since the callback is called before setting the new value
// manually update the anchor point (required for updateBoundsPos)
this.anchorPoint.setMuted(newX, newY); // then call updateBouds
this.updateBoundsPos(this.pos.x, this.pos.y);
... | javascript | function onAnchorUpdate(newX, newY) {
// since the callback is called before setting the new value
// manually update the anchor point (required for updateBoundsPos)
this.anchorPoint.setMuted(newX, newY); // then call updateBouds
this.updateBoundsPos(this.pos.x, this.pos.y);
... | [
"function",
"onAnchorUpdate",
"(",
"newX",
",",
"newY",
")",
"{",
"// since the callback is called before setting the new value",
"// manually update the anchor point (required for updateBoundsPos)",
"this",
".",
"anchorPoint",
".",
"setMuted",
"(",
"newX",
",",
"newY",
")",
... | called when the anchor point value is changed
@private
@name onAnchorUpdate
@memberOf me.Sprite.prototype
@function | [
"called",
"when",
"the",
"anchor",
"point",
"value",
"is",
"changed"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L11131-L11137 |
7,292 | melonjs/melonJS | dist/melonjs.js | update | function update(dt) {
// call the parent constructor
var updated = this._super(me.Sprite, "update", [dt]); // check if the button was updated
if (this.updated) {
// clear the flag
if (!this.released) {
this.updated = false;
}
return ... | javascript | function update(dt) {
// call the parent constructor
var updated = this._super(me.Sprite, "update", [dt]); // check if the button was updated
if (this.updated) {
// clear the flag
if (!this.released) {
this.updated = false;
}
return ... | [
"function",
"update",
"(",
"dt",
")",
"{",
"// call the parent constructor",
"var",
"updated",
"=",
"this",
".",
"_super",
"(",
"me",
".",
"Sprite",
",",
"\"update\"",
",",
"[",
"dt",
"]",
")",
";",
"// check if the button was updated",
"if",
"(",
"this",
".... | return true if the object has been clicked
@ignore | [
"return",
"true",
"if",
"the",
"object",
"has",
"been",
"clicked"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L11292-L11308 |
7,293 | melonjs/melonJS | dist/melonjs.js | leave | function leave(event) {
this.hover = false;
this.release.call(this, event);
return this.onOut.call(this, event);
} | javascript | function leave(event) {
this.hover = false;
this.release.call(this, event);
return this.onOut.call(this, event);
} | [
"function",
"leave",
"(",
"event",
")",
"{",
"this",
".",
"hover",
"=",
"false",
";",
"this",
".",
"release",
".",
"call",
"(",
"this",
",",
"event",
")",
";",
"return",
"this",
".",
"onOut",
".",
"call",
"(",
"this",
",",
"event",
")",
";",
"}"
... | function callback for the pointerLeave event
@ignore | [
"function",
"callback",
"for",
"the",
"pointerLeave",
"event"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L11374-L11378 |
7,294 | melonjs/melonJS | dist/melonjs.js | onActivateEvent | function onActivateEvent() {
// register pointer events
me.input.registerPointerEvent("pointerdown", this, this.clicked.bind(this));
me.input.registerPointerEvent("pointerup", this, this.release.bind(this));
me.input.registerPointerEvent("pointercancel", this, this.release.bind(this)... | javascript | function onActivateEvent() {
// register pointer events
me.input.registerPointerEvent("pointerdown", this, this.clicked.bind(this));
me.input.registerPointerEvent("pointerup", this, this.release.bind(this));
me.input.registerPointerEvent("pointercancel", this, this.release.bind(this)... | [
"function",
"onActivateEvent",
"(",
")",
"{",
"// register pointer events",
"me",
".",
"input",
".",
"registerPointerEvent",
"(",
"\"pointerdown\"",
",",
"this",
",",
"this",
".",
"clicked",
".",
"bind",
"(",
"this",
")",
")",
";",
"me",
".",
"input",
".",
... | function called when added to the game world or a container
@ignore | [
"function",
"called",
"when",
"added",
"to",
"the",
"game",
"world",
"or",
"a",
"container"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L11444-L11451 |
7,295 | melonjs/melonJS | dist/melonjs.js | onDeactivateEvent | function onDeactivateEvent() {
// release pointer events
me.input.releasePointerEvent("pointerdown", this);
me.input.releasePointerEvent("pointerup", this);
me.input.releasePointerEvent("pointercancel", this);
me.input.releasePointerEvent("pointerenter", this);
me.i... | javascript | function onDeactivateEvent() {
// release pointer events
me.input.releasePointerEvent("pointerdown", this);
me.input.releasePointerEvent("pointerup", this);
me.input.releasePointerEvent("pointercancel", this);
me.input.releasePointerEvent("pointerenter", this);
me.i... | [
"function",
"onDeactivateEvent",
"(",
")",
"{",
"// release pointer events",
"me",
".",
"input",
".",
"releasePointerEvent",
"(",
"\"pointerdown\"",
",",
"this",
")",
";",
"me",
".",
"input",
".",
"releasePointerEvent",
"(",
"\"pointerup\"",
",",
"this",
")",
";... | function called when removed from the game world or a container
@ignore | [
"function",
"called",
"when",
"removed",
"from",
"the",
"game",
"world",
"or",
"a",
"container"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L11457-L11465 |
7,296 | melonjs/melonJS | dist/melonjs.js | getChildAt | function getChildAt(index) {
if (index >= 0 && index < this.children.length) {
return this.children[index];
} else {
throw new Error("Index (" + index + ") Out Of Bounds for getChildAt()");
}
} | javascript | function getChildAt(index) {
if (index >= 0 && index < this.children.length) {
return this.children[index];
} else {
throw new Error("Index (" + index + ") Out Of Bounds for getChildAt()");
}
} | [
"function",
"getChildAt",
"(",
"index",
")",
"{",
"if",
"(",
"index",
">=",
"0",
"&&",
"index",
"<",
"this",
".",
"children",
".",
"length",
")",
"{",
"return",
"this",
".",
"children",
"[",
"index",
"]",
";",
"}",
"else",
"{",
"throw",
"new",
"Err... | Returns the Child at the specified index
@name getChildAt
@memberOf me.Container.prototype
@function
@param {Number} index | [
"Returns",
"the",
"Child",
"at",
"the",
"specified",
"index"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L11782-L11788 |
7,297 | melonjs/melonJS | dist/melonjs.js | getNextChild | function getNextChild(child) {
var index = this.children.indexOf(child) - 1;
if (index >= 0 && index < this.children.length) {
return this.getChildAt(index);
}
return undefined;
} | javascript | function getNextChild(child) {
var index = this.children.indexOf(child) - 1;
if (index >= 0 && index < this.children.length) {
return this.getChildAt(index);
}
return undefined;
} | [
"function",
"getNextChild",
"(",
"child",
")",
"{",
"var",
"index",
"=",
"this",
".",
"children",
".",
"indexOf",
"(",
"child",
")",
"-",
"1",
";",
"if",
"(",
"index",
">=",
"0",
"&&",
"index",
"<",
"this",
".",
"children",
".",
"length",
")",
"{",... | Returns the next child within the container or undefined if none
@name getNextChild
@memberOf me.Container
@function
@param {me.Renderable} child | [
"Returns",
"the",
"next",
"child",
"within",
"the",
"container",
"or",
"undefined",
"if",
"none"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L11808-L11816 |
7,298 | melonjs/melonJS | dist/melonjs.js | getChildByType | function getChildByType(_class) {
var objList = [];
for (var i = this.children.length - 1; i >= 0; i--) {
var obj = this.children[i];
if (obj instanceof _class) {
objList.push(obj);
}
if (obj instanceof me.Container) {
objList = ... | javascript | function getChildByType(_class) {
var objList = [];
for (var i = this.children.length - 1; i >= 0; i--) {
var obj = this.children[i];
if (obj instanceof _class) {
objList.push(obj);
}
if (obj instanceof me.Container) {
objList = ... | [
"function",
"getChildByType",
"(",
"_class",
")",
"{",
"var",
"objList",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"this",
".",
"children",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"var",
"obj",
"=",
"this"... | returns the list of childs with the specified class type
@name getChildByType
@memberOf me.Container.prototype
@public
@function
@param {Object} class type
@return {me.Renderable[]} Array of children | [
"returns",
"the",
"list",
"of",
"childs",
"with",
"the",
"specified",
"class",
"type"
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L11892-L11908 |
7,299 | melonjs/melonJS | dist/melonjs.js | updateChildBounds | function updateChildBounds() {
this.childBounds.pos.set(Infinity, Infinity);
this.childBounds.resize(-Infinity, -Infinity);
var childBounds;
for (var i = this.children.length, child; i--, child = this.children[i];) {
if (child.isRenderable) {
if (child instan... | javascript | function updateChildBounds() {
this.childBounds.pos.set(Infinity, Infinity);
this.childBounds.resize(-Infinity, -Infinity);
var childBounds;
for (var i = this.children.length, child; i--, child = this.children[i];) {
if (child.isRenderable) {
if (child instan... | [
"function",
"updateChildBounds",
"(",
")",
"{",
"this",
".",
"childBounds",
".",
"pos",
".",
"set",
"(",
"Infinity",
",",
"Infinity",
")",
";",
"this",
".",
"childBounds",
".",
"resize",
"(",
"-",
"Infinity",
",",
"-",
"Infinity",
")",
";",
"var",
"chi... | resizes the child bounds rectangle, based on children bounds.
@name updateChildBounds
@memberOf me.Container.prototype
@function
@return {me.Rect} updated child bounds | [
"resizes",
"the",
"child",
"bounds",
"rectangle",
"based",
"on",
"children",
"bounds",
"."
] | 6c1823cc245df7c958db243a0531506eb838d72c | https://github.com/melonjs/melonJS/blob/6c1823cc245df7c958db243a0531506eb838d72c/dist/melonjs.js#L11949-L11971 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.