Created
March 11, 2015 19:17
-
-
Save fowlmouth/2862a0569295102e21e5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type | |
App* = ref object of RootObj | |
vt*: AppVT | |
AppVT = object | |
draw*: proc(my:App) | |
update*: proc(my:App, dt:float) | |
var defaultVT = AppVT( | |
draw: (proc(my:App) = discard), | |
update: (proc(my:App, dt:float) = discard) | |
) | |
## accessors | |
proc draw* (my:App) {.inline.} = my.vt.draw(my) | |
## to implement your game state | |
var myVT = defaultVT | |
myVT.draw = ... | |
myVT.update = ... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment