Advertisement

Mouse / Joypad

Started by April 02, 2003 09:00 AM
1 comment, last by parazyte 21 years, 11 months ago
Can anyone direct me to a good doc on input in openGL? I guess I know the keyboard, but would like to master the mouse as well. Of course, a tutorial on the gamepad would rock too! Yea... So if you know how it works maybe you''d like to show me the page where you learned it? Thanks a lot
I assume you''re using WinProc?

Try this:
// Mousecase WM_LBUTTONDOWN:{    meGL::mouseL = true;    return 0;									// Jump Back}case WM_MBUTTONDOWN:{    meGL::mouseM = true;    return 0;									// Jump Back}case WM_RBUTTONDOWN:{    meGL::mouseR = true;    return 0;									// Jump Back}case WM_LBUTTONUP:{    meGL::mouseL = false;    return 0;									// Jump Back}case WM_MBUTTONUP:{    meGL::mouseM = false;    return 0;									// Jump Back}case WM_RBUTTONUP:{    meGL::mouseR = false;    return 0;									// Jump Back}case WM_MOUSEMOVE:{    meGL::SetNewMouse((int)LOWORD(lParam), (int)HIWORD(lParam));    return 0;} 


With GLuT it''s a simple manner ok registering the right callback -- look in GL/glut.h

- Scott "me22" McMurray
( email/MSN me22@fastmail.ca ICQ 37213887 )
Advertisement
if you are using Nehe.CPP and Nehe.H do this to the Nehe.CPP file( in the WindowProc function:

case WM_KEYDOWN:
case WM_LBUTTONDOWN: //add this
case WM_RBUTTONDOWN: //and this
if ((wParam >= 0) && (wParam <= 255))
{
window->keys->keyDown [wParam] = TRUE;
return 0;
}
break;
case WM_KEYUP:
case WM_LBUTTONUP: //add this
case WM_RBUTTONUP: //and this
if ((wParam >= 0) && (wParam <= 255))
{
window->keys->keyDown [wParam] = FALSE;
return 0;
}
break; // Break


This topic is closed to new replies.

Advertisement