Skip to content

Commit

Permalink
decouple Matter.RenderPixi
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Apr 26, 2016
1 parent de823eb commit 72f90b9
Show file tree
Hide file tree
Showing 4 changed files with 562 additions and 546 deletions.
5 changes: 0 additions & 5 deletions demo/js/Demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,6 @@

World.add(demo.engine.world, demo.mouseConstraint);
});

// need to rebind mouse on render change
Events.on(demo.gui, 'setRenderer', function() {
Mouse.setElement(demo.mouseConstraint.mouse, demo.render.canvas);
});
}

// create a Matter.Inspector
Expand Down
18 changes: 1 addition & 17 deletions demo/js/lib/matter-tools/matter-tools-dev.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* matter-tools-dev.min.js 0.5.0-dev 2016-04-24
* matter-tools-dev.min.js 0.5.0-dev 2016-04-26
* https://github.com/liabru/matter-tools
* License: MIT
*/
Expand Down Expand Up @@ -202,9 +202,6 @@
physics.add(runner, "enabled");
physics.open();
var render = datGui.addFolder("Render");
render.add(gui, "renderer", [ "canvas", "webgl" ]).onFinishChange(function(value) {
_setRenderer(gui, value);
});
render.add(gui.render.options, "wireframes");
render.add(gui.render.options, "showDebug");
render.add(gui.render.options, "showPositions");
Expand All @@ -223,19 +220,6 @@
render.add(gui.render.options, "enabled");
render.open();
};
var _setRenderer = function(gui, rendererName) {
var engine = gui.engine, controller;
if (rendererName === "canvas") controller = Render;
if (rendererName === "webgl") controller = RenderPixi;
gui.render.element.removeChild(gui.render.canvas);
var options = gui.render.options;
gui.render = controller.create({
element:gui.render.element,
options:options
});
gui.render = options;
Events.trigger(gui, "setRenderer");
};
var _addBody = function(gui) {
var engine = gui.engine;
var options = {
Expand Down
Loading

0 comments on commit 72f90b9

Please sign in to comment.