Class: KeyboardController

Controller#KeyboardController(options:Object)

new KeyboardController(options:Object)

implements keyboard charcodes as controllerevents
Keyboard Example on codepen:
codepen

This controller converts keyboard listeners to a Controller. Events are triggered through keyboard charcodes
It's mainly purposed as an identical interface to the other controllers. Nothing stops you from implementing your own keyboardlisteners

Parameters:
Name Type Description
options:Object
Implements:
Author:
  • Sense Studios
Source:
Example
var keyboard = new KeyboardController( renderer, {});
 keyboard.init();
 keyboard.render();

 // enter button, should return [13, 1] on keydown and [13,0] on keyup
 keyboard.addEventListener( 13, function(_arr) { console.log(_arr) })

Members

debug :boolean

Type:
  • boolean
Source:

debug :boolean

Type:
  • boolean
Source:

debug :boolean

Type:
  • boolean
Source:

debug :boolean

Type:
  • boolean
Source:

(inner) debug :boolean

Type:
  • boolean
Source:

(inner) debug :object

Type:
  • object
Source:

Methods

addEventListener(_target, _callback)

addEventListener

Parameters:
Name Type Description
_target integer

the number of controller being pressed keyboard charcodes as controllerevents

_callback function

the callback to be executed

Source:
Example
function doSomething( _arr ) {
   console.log('pressed1', arr);
 }
 keyboard.addEventListener(1, function( _arr ) { console.log( _arr ) } );

getNodes()

getNodes, helper, shows current nodes

Source:

removeEventListener(_target)

removeEventListener

Parameters:
Name Type Description
_target integer

the number of controller being pressed

Source:
Example
keyboard.removeEventListener(1)

(inner) dispatchkeyboardEvent()

Source:

(inner) dispatchMidiEvent {event}()

Source:

(inner) dispatchMidiEvent {event}()

Source:

(inner) failure {object}()

Source:

(inner) init()

init, should be automatic, but you can always call my_keyboard.init()

Source:

(inner) init()

Source:

(inner) onMIDIMessage {event}()

Source:

(inner) render()

render, should be automatic, but you can always call my_keyboard.render()

Source:

(inner) success {object}()

Source:

(inner) update()

update, should be automatic, but you can always call my_keyboard.update()

Source:

(inner) update()

Source: