0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2025-01-05 15:18:39 -05:00
liabru-matter-js/src/body/World.js

67 lines
No EOL
1.8 KiB
JavaScript

/**
* See [Demo.js](https://github.com/liabru/matter-js/blob/master/demo/js/Demo.js)
* and [DemoMobile.js](https://github.com/liabru/matter-js/blob/master/demo/js/DemoMobile.js) for usage examples.
*
* @class World
*/
var World = {};
(function() {
/**
* Description
* @method create
* @constructor
* @param {} options
* @return {world} A new world
*/
World.create = function(options) {
var composite = Composite.create();
var defaults = {
gravity: { x: 0, y: 1 },
bounds: {
min: { x: 0, y: 0 },
max: { x: 800, y: 600 }
}
};
return Common.extend(composite, defaults, options);
};
// World is a Composite body
// see src/module/Outro.js for these aliases:
/**
* An alias for Composite.clear since World is also a Composite (see Outro.js)
* @method clear
* @param {world} world
* @param {boolean} keepStatic
*/
/**
* An alias for Composite.add since World is also a Composite (see Outro.js)
* @method addComposite
* @param {world} world
* @param {composite} composite
* @return {world} The original world with the objects from composite added
*/
/**
* An alias for Composite.addBody since World is also a Composite (see Outro.js)
* @method addBody
* @param {world} world
* @param {body} body
* @return {world} The original world with the body added
*/
/**
* An alias for Composite.addConstraint since World is also a Composite (see Outro.js)
* @method addConstraint
* @param {world} world
* @param {constraint} constraint
* @return {world} The original world with the constraint added
*/
})();