Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Muhammad Ahmed mahmed8003

🎯
Focusing
Block or report user

Report or block mahmed8003

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View flatteningarray.js
/**
* Converts nested arrays into one-dimensional flattening array (recursively)
* @param {Array} arr Input nested arrays
* @param {Array} result Output one-dimensional flattening array
* @return Output one-dimensional flattening array
*/
function flattenNestedArrays(arr, result = []) {
const length = arr.length;
for (let i = 0; i < length; i++) {
@mahmed8003
mahmed8003 / debugdraw.js
Created Feb 8, 2016
Pixi.js and Box2D debug draw demo
View debugdraw.js
// Credit goes to https://gist.github.com/cbranch/260224a7e4699552d2dc
// Gets a JSDraw instance which renders to a PIXI graphics object.
// graphics: an instance of PIXI.Graphics
// scale: the scaling factor to convert from Box2D coordinates to screen pixels
function getPIXIDebugDraw(graphics, scale) {
function getColorFromDebugDrawCallback(color) {
var col = Box2D.wrapPointer(color, Box2D.b2Color);
var red = (col.get_r() * 255 * 255 * 255)|0;
var green = (col.get_g() * 255 * 255)|0;
var blue = (col.get_b() * 255)|0;
You can’t perform that action at this time.