mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 06:23:37 -05:00
commit
32b4374a56
2 changed files with 23 additions and 15 deletions
30
vm.js
30
vm.js
|
@ -63,9 +63,8 @@
|
|||
* Handles connections between blocks, stage, and extensions.
|
||||
*
|
||||
* @author Andrew Sliwinski <ascii@media.mit.edu>
|
||||
* @param {!RenderWebGL} renderer Renderer for the VM
|
||||
*/
|
||||
function VirtualMachine (renderer) {
|
||||
function VirtualMachine () {
|
||||
var instance = this;
|
||||
// Bind event emitter and runtime to VM instance
|
||||
EventEmitter.call(instance);
|
||||
|
@ -73,7 +72,7 @@
|
|||
* VM runtime, to store blocks, I/O devices, sprites/targets, etc.
|
||||
* @type {!Runtime}
|
||||
*/
|
||||
instance.runtime = new Runtime(renderer);
|
||||
instance.runtime = new Runtime();
|
||||
/**
|
||||
* The "currently editing"/selected target ID for the VM.
|
||||
* Block events from any Blockly workspace are routed to this target.
|
||||
|
@ -216,6 +215,14 @@
|
|||
this.emitWorkspaceUpdate();
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the renderer for the VM/runtime
|
||||
* @param {!RenderWebGL} renderer The renderer to attach
|
||||
*/
|
||||
VirtualMachine.prototype.attachRenderer = function (renderer) {
|
||||
this.runtime.attachRenderer(renderer);
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle a Blockly event for the current editing target.
|
||||
* @param {!Blockly.Event} e Any Blockly event.
|
||||
|
@ -1437,20 +1444,13 @@
|
|||
|
||||
/**
|
||||
* 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>}
|
||||
|
@ -1624,6 +1624,14 @@
|
|||
this._edgeActivatedHatValues = {};
|
||||
};
|
||||
|
||||
/**
|
||||
* Attach the renderer
|
||||
* @param {!RenderWebGL} renderer The renderer to attach
|
||||
*/
|
||||
Runtime.prototype.attachRenderer = function (renderer) {
|
||||
this.renderer = renderer;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
|
8
vm.min.js
vendored
8
vm.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue