Rect pack/unpack for BinaryPacker.js
npm install uupaa.binarypacker0x0001.js
Rect pack/unpack for BinaryPacker.js
- BinaryPacker0x0001.js wiki
- WebModule
- Slide
- Development
``js
var formatID = 0x0001; // RECT
var source = { x: 0, y: 0, w: 100, h: 100 };
var bp = new BinaryPacker();
var packed = bp.pack(source, formatID);
var result = bp.unpack(packed);
if ( object.x === result.x &&
object.y === result.y &&
object.w === result.w &&
object.h === result.h) {
console.log("OK");
} else {
console.log("ERROR");
}
`
`js
importScripts("lib/BinaryPacker.js");
importScripts("lib/BinaryPacker0x0001.js");
...
`
`js
var BinaryPacker = require("lib/BinaryPacker.js");
var BinaryPacker0x0001 = require("lib/BinaryPacker0x0001.js");
...
``