我有这个pixi.js代码,它做了它应该做的事情:绘制一个矩形.
var stage,renderer,graphics; (function () { // init PIXI // create an new instance of a pixi stage stage = new PIXI.Stage(0x66FF99); // create a renderer instance. renderer = PIXI.autoDetectRenderer(400,300); $('#pixi-area').append(renderer.view); graphics = new PIXI.Graphics(); graphics.beginFill(0xFFFFFF); graphics.lineStyle(1,0xFF0000); graphics.drawRect(20,20,150,150); stage.addChild(graphics); renderer.render(stage); }());
但是,在控制台中我得到了声明
You do not need to use a PIXI Stage any more,you can simply render any container.
如果不使用PIXI.Stage(),我该如何做同样的事情?
解决方法
我其实刚遇到同样的问题!我最终找到了PIXI的新文档,可以在这里找到
http://pixijs.github.io/docs/index.html.
它们引用的容器是为替换Stage对象而引入的新对象. http://pixijs.github.io/docs/PIXI.Container.html#toc1
stage = new PIXI.Stage(0x66FF99)
now becomes,
var container = new PIXI.Container();
希望这可以帮助!