Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

parazyte

Mouse / Joypad

This topic is 5557 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
I assume you''re using WinProc?

Try this:

// Mouse
case 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 )

Share this post


Link to post
Share on other sites
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


Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!