Skip to content

Instantly share code, notes, and snippets.

@joskuijpers
Last active August 29, 2015 13:57
Show Gist options
  • Save joskuijpers/9734243 to your computer and use it in GitHub Desktop.
Save joskuijpers/9734243 to your computer and use it in GitHub Desktop.
Game.init = function() {
Screen.drawRect(10,10,Screen.width-20,Screen.height-20,Color.RED);
Screen.flip()
}
Game.loop = function() {
// something with statemanager or so
}
Game.states["load"] = function() {
if(Input.Keyboard.getKey() != Input.Keyboard.KEY_NONE) {
// Switch state to "menu"
}
}
=============================================
game() {
put something on screen
GetKey();
while(inMenu) {
draw menu
getkey
process key
if(key == enter) // enter the game
break;
}
while(1) {
process input with isKeyPressed
do rendering
flip()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment