Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

17 lines (16 sloc) 0.575 kb
An.object().from(Widget).named('Key').has('letter','A').has('width',48).has('height',48).has('x',100).has('y',100).has('font','24 Arial').
does('draw', function() {
Screen.save().as(this).blue().frame().
this.font.use()
Screen.at(this.x() + this.width()/2 - this.font().size()/4, this.y() + this.height()/2 + this.font().size()/4).print(this.letter())
return this
}).
does('down', function(E) {
if (!E.on(this)) return;
E.has('key',this.letter())
Keyboard.dispatch('press',E)
}).
does('up', function(E) {
E.has('key',this.letter())
Keyboard.dispatch('release',E)
})
Jump to Line
Something went wrong with that request. Please try again.