mirror of
https://github.com/liabru/matter-js.git
synced 2025-03-14 00:38:41 -04:00
Updated Rendering (markdown)
parent
1b5f7fedc4
commit
c1da7adbec
1 changed files with 16 additions and 15 deletions
31
Rendering.md
31
Rendering.md
|
@ -3,6 +3,7 @@
|
|||
1. [Using a built in renderer](#using-a-built-in-renderer)
|
||||
1. [Matter.Render](#matterrender)
|
||||
1. [Matter.RenderPixi](#matterrenderpixi)
|
||||
1. [Render options](#render-options)
|
||||
1. [Using a custom renderer](#using-a-custom-renderer)
|
||||
|
||||
## Using a built in renderer
|
||||
|
@ -15,6 +16,21 @@ When you use `Engine.create(element)` a `Matter.Render` instance will be created
|
|||
|
||||
Following this calling `Engine.run(engine)` will spawn the built in game loop routine, which will automatically manage updating the engine and calling the renderer at the appropriate times.
|
||||
|
||||
#### Matter.RenderPixi
|
||||
|
||||
An alternate renderer [Matter.RenderPixi](http://brm.io/matter-js-docs/classes/RenderPixi.html) is provided as an example of using [Pixi.js](http://www.pixijs.com/) to render a world using WebGL and a scene graph. The features available should match those of `Matter.Render` although sometimes there may be implementation differences.
|
||||
|
||||
To make use of this module you must pass it to your engine at its creation:
|
||||
|
||||
```js
|
||||
Engine.create({
|
||||
render: {
|
||||
element: document.body,
|
||||
controller: Matter.RenderPixi
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
#### Render options
|
||||
|
||||
A number of options may be passed to the renderer:
|
||||
|
@ -46,21 +62,6 @@ Engine.create({
|
|||
})
|
||||
```
|
||||
|
||||
#### Matter.RenderPixi
|
||||
|
||||
An alternate renderer [Matter.RenderPixi](http://brm.io/matter-js-docs/classes/RenderPixi.html) is provided as an example of using [Pixi.js](http://www.pixijs.com/) to render a world using WebGL and a scene graph. The features available should match those of `Matter.Render` although sometimes there may be implementation differences.
|
||||
|
||||
To make use of this module you must pass it to your engine at its creation:
|
||||
|
||||
```js
|
||||
Engine.create({
|
||||
render: {
|
||||
element: document.body,
|
||||
controller: Matter.RenderPixi
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## Using a custom renderer
|
||||
|
||||
While the built in renderers are useful for early development, if you need to do any kind of complex rendering effects you will need a custom renderer.
|
||||
|
|
Loading…
Add table
Reference in a new issue