mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-01 08:59:51 -04:00
Use attachRenderer rather than the constructor
This makes the renderer optional as well as making the order of instantiation flexible.
This commit is contained in:
parent
fa10a2279a
commit
4e547556a8
3 changed files with 27 additions and 17 deletions
src/engine
|
@ -19,20 +19,13 @@ var defaultBlockPackages = {
|
|||
|
||||
/**
|
||||
* Manages targets, scripts, and the sequencer.
|
||||
* @param {!RenderWebGL} renderer Renderer for the VM
|
||||
*/
|
||||
function Runtime (renderer) {
|
||||
function Runtime () {
|
||||
// Bind event emitter
|
||||
EventEmitter.call(this);
|
||||
|
||||
// State for the runtime
|
||||
|
||||
/**
|
||||
* Renderer
|
||||
* @type {!RenderWebGL}
|
||||
*/
|
||||
this.renderer = renderer;
|
||||
|
||||
/**
|
||||
* Target management and storage.
|
||||
* @type {Array.<!Target>}
|
||||
|
@ -206,6 +199,14 @@ Runtime.prototype.clearEdgeActivatedValues = function () {
|
|||
this._edgeActivatedHatValues = {};
|
||||
};
|
||||
|
||||
/**
|
||||
* Attach the renderer
|
||||
* @param {!RenderWebGL} renderer The renderer to attach
|
||||
*/
|
||||
Runtime.prototype.attachRenderer = function (renderer) {
|
||||
this.renderer = renderer;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue