|
|
发表于 2006-7-20 08:17:00
|
显示全部楼层
Re: 谁有鼠标滚轮缩放图形和键盘响应的资料没?
那么久还没找到答案呀?
以下是GLUT的滚轮响应。
- /**当用户在窗口中按下或释放鼠标键时,调用此函数
- *@param int button 哪个按键
- *- GLUT_LEFT_BUTTON 鼠标左键
- *- GLUT_RIGHT_BUTTON 鼠标右键
- *- GLUT_WHEEL_UT 中键向上滚
- *- GLUT_WHEEL_DOUW 中键下滚
- *@param int state
- *- GLUT_UP 放开
- *- GLUT_DOWN 按下
- *@param int x,int y = 鼠标位置
- */
- void Sim_ProcessMouse(int button, int state, int x, int y) {
- if(state == GLUT_DOWN)
- {
-
- if(button == GLUT_LEFT_BUTTON)
- {
-
- isClicked = true;
- }
- else if(button == GLUT_RIGHT_BUTTON)
- {
-
- isRClicked = true;
- }
- }
- if (state == GLUT_UP )
- {
- [color=#FF6699]
- if ( button == GLUT_WHEEL_UP )
- {
- zSimTranslation += 1.0f;
- }
- else if( button == GLUT_WHEEL_DOWN )
- {
- zSimTranslation -= 1.0f;
- }
- [/color]
- else if(button == GLUT_LEFT_BUTTON)
- {
-
- isClicked = false;
- }
- else if(button == GLUT_RIGHT_BUTTON)
- {
-
- isRClicked = false;
- }
- }
- nSimSpecialKey = glutGetModifiers();
- /// if both a mouse button, and the ALT key, are pressed then
- if ((state == GLUT_DOWN) && (nSimSpecialKey == GLUT_ACTIVE_ALT)) {
- }
- }
复制代码 |
|