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': case 'a': thrust = true thrustTime = glut.Get(glut.ELAPSED_TIME) case 'S': case 's': shield = true case 'C': case 'c': cursor = !cursor if cursor { glut.SetCursor(glut.CURSOR_INHERIT) } else { glut.SetCursor(glut.CURSOR_NONE) } case 'z': case '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': case 'p': paused = !paused if paused { glut.IdleFunc(nil) } else { glut.IdleFunc(idle) resuming = true } case 'Q': case 'q': case ' ': shotBullet() } }