Skip to content

Commit

Permalink
Abstract version of the API
Browse files Browse the repository at this point in the history
  • Loading branch information
martijndeb committed Jan 9, 2018
1 parent 98acb15 commit e7f23a3
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion controllers/vmcontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,22 @@ class VMController
}

resetSandbox() {
let matrixSize = this.driver.getSize();

this.sandbox = {
'matrix': this.driver,
'WIDTH': matrixSize.width,
'HEIGHT': matrixSize.height,

'setBrightness': this.driver.setBrightness.bind( this.driver ),
'getBrightness': this.driver.getBrightness.bind( this.driver ),
'setPixel': this.driver.setPixel.bind( this.driver ),
'getPixel': this.driver.getPixel.bind( this.driver ),
'drawLine': this.driver.drawLine.bind( this.driver ),
'drawRect': this.driver.drawRect.bind( this.driver ),
'drawRectFilled': this.driver.drawRectFilled.bind( this.driver ),
'drawCircle': this.driver.drawCircle.bind( this.driver ),
'write': this.driver.write.bind( this.driver ),

'delta': this.getDelta.bind( this )
};
}
Expand Down

0 comments on commit e7f23a3

Please sign in to comment.