Class: Driver

Sketch. Driver

The driver class for the sketch module. Initialise via Sketch.createSketch(...) for default configs.

new Driver(canvas)

Parameters:
Name Type Description
canvas HTMLCanvasElement The canvas element that sketch will be targeting.
Author:
  • FelixMcFelix (Kyle S.)
Source:

Members

<protected, readonly> canvas :HTMLCanvasElement

The module's attached canvas.
Type:
  • HTMLCanvasElement
Source:

<protected, readonly> codeGen :Object

The module's reference to the code generator.
Type:
  • Object
Source:

<protected, readonly> context :WebGLRenderingContext

The module's attached context.
Type:
  • WebGLRenderingContext
Source:

<protected, readonly> parser :Parser

A reference to the parser.
Type:
  • Parser
Source:

<protected, readonly> shaderManager :Palette.Manager

The module's reference to the shader manager.
Type:
Source:

<protected, readonly> vm :MVM

The module's reference to the VM.
Type:
Source:

Methods

addShader(text)

Add a shader from an already-resolved JSON String.
Parameters:
Name Type Description
text String the JSON string for a shader object.
Source:

addShaderURL(url)

Add a shader from a URL.
Parameters:
Name Type Description
url String the URL string leading to a shader object.
Source:

compile(text)

Compile and execute a Sketch program.
Parameters:
Name Type Description
text String the source code for a Sketch program.
Source:
Returns:
boolean - will fail either on error, or if shaders are still being added.