Skip to content

Instantly share code, notes, and snippets.

@talgautb
Created March 4, 2014 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save talgautb/9345251 to your computer and use it in GitHub Desktop.
Save talgautb/9345251 to your computer and use it in GitHub Desktop.
Don't forget to remove the name of the scene and unnecessary buttons
Scene.prototype.handleKeyDown = function (keyCode) {
switch (keyCode) {
case sf.key.LEFT:
this.keyLeft();
break;
case sf.key.RIGHT:
this.keyRight();
break;
case sf.key.UP:
this.keyUp();
break;
case sf.key.DOWN:
this.keyDown();
break;
case sf.key.ENTER:
this.keyEnter();
break;
case sf.key.RED:
this.keyRed();
break;
case sf.key.RETURN:
// to close the application and return to SmartHub
widgetAPI.sendReturnEvent();
this.keyReturn();
break;
case sf.key.EXIT:
// to close the application and return to broadcast signal
widgetAPI.sendExitEvent();
break;
}
};
// KEYS
//---------------------------------
Scene.prototype.keyDown = function() {
};
Scene.prototype.keyUp = function() {
};
Scene.prototype.keyLeft = function() {
};
Scene.prototype.keyRight = function() {
};
Scene.prototype.keyReturn = function() {
};
Scene.prototype.keyEnter = function() {
};
// FUNCTIONS
//---------------------------------
// DECORATION
//---------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment