func visible(vis int) { if vis == glut.VISIBLE { if !paused { glut.IdleFunc(idle) } } else { glut.IdleFunc(nil) } }
func key(key byte, px, py int) { switch key { case 27: os.Exit(0) case 'A', 'a': thrust = true thrustTime = glut.Get(glut.ELAPSED_TIME) case 'S', 's': shield = true case 'C', 'c': cursor = !cursor if cursor { glut.SetCursor(glut.CURSOR_INHERIT) } else { glut.SetCursor(glut.CURSOR_NONE) } case 'Z', 'z': x = 20 y = 20 xv = 0 yv = 0 case 'f': glut.GameModeString("640x480:32@60") glut.EnterGameMode() initWindow() case 'g': glut.GameModeString("800x600:32@60") glut.EnterGameMode() initWindow() case 'l': if originalWindow != 0 && currentWindow != originalWindow { glut.LeaveGameMode() currentWindow = originalWindow } case 'P', 'p': paused = !paused if paused { glut.IdleFunc(nil) } else { glut.IdleFunc(idle) resuming = true } case 'Q', 'q', ' ': shotBullet() } }
func visible(vis int) { //if vis == glut.visible { //if !paused { glut.IdleFunc(idle) //} //} else { // glut.idlefunc(nil) //} }