1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

tetris improvements

added getexepath() to os module
added some wrapper functions to glfw
removed hardcored path in gg module
better tetris example exit and resource loading
This commit is contained in:
aguspiza
2019-06-27 22:17:13 +02:00
committed by Alexander Medvednikov
parent 84f5d7e64b
commit bed7440ebb
4 changed files with 44 additions and 1 deletions

View File

@ -131,6 +131,11 @@ fn main() {
game.draw_scene()
window.swap_buffers()
glfw.wait_events()
if window.should_close() {
window.destroy()
glfw.terminate()
exit(0)
}
}
}
@ -322,6 +327,8 @@ fn key_down(wnd voidptr, key, code, action, mods int) {
// Fetch the game object stored in the user pointer
mut game := &Game(glfw.get_window_user_pointer(wnd))
switch key {
case glfw.KEY_ESCAPE:
glfw.set_should_close(wnd, true)
case glfw.KeyUp:
// Rotate the tetro
game.rotation_idx++