示例#1
0
 public void Key(byte key, int x, int y)
 {
     if (key == 27)
     {
         Glut.glutLeaveGameMode();
         Glut.glutDestroyWindow(_windowCode);
     }
     _keyboardState.KeyPress(key);
 }
示例#2
0
 void CloseWindow()
 {
     Glut.glutLeaveGameMode();
     Glut.glutDestroyWindow(_windowCode);
 }
示例#3
0
文件: Boxes.cs 项目: retahc/old-code
        private static void Keyboard(byte key, int x, int y)
        {
            switch (key)
            {
            case (byte)'1':
                Al.alSourcePlay(source[0]);
                break;

            case (byte)'2':
                Al.alSourcePlay(source[1]);
                break;

            case (byte)'3':
                Al.alSourcePlay(source[2]);
                break;

            case (byte)'4':
                Al.alSourceStop(source[0]);
                break;

            case (byte)'5':
                Al.alSourceStop(source[1]);
                break;

            case (byte)'6':
                Al.alSourceStop(source[2]);
                break;

            case (byte)'w':
            case (byte)'W':
                listenerPosition[2] -= 0.1f;
                Al.alListenerfv(Al.AL_POSITION, listenerPosition);
                break;

            case (byte)'a':
            case (byte)'A':
                listenerPosition[0] -= 0.1f;
                Al.alListenerfv(Al.AL_POSITION, listenerPosition);
                break;

            case (byte)'s':
            case (byte)'S':
                listenerPosition[2] += 0.1f;
                Al.alListenerfv(Al.AL_POSITION, listenerPosition);
                break;

            case (byte)'d':
            case (byte)'D':
                listenerPosition[0] += 0.1f;
                Al.alListenerfv(Al.AL_POSITION, listenerPosition);
                break;

            case 27:
                Al.alSourceStop(source[2]);
                Al.alSourceStop(source[1]);
                Al.alSourceStop(source[0]);
                Alut.alutExit();
                Glut.glutDestroyWindow(window);
                Environment.Exit(0);
                break;

            default:
                break;
            }
            Glut.glutPostRedisplay();
        }