Computer Science Canada

Mouse Input

Author:  Mr.Begebies [ Mon Oct 20, 2003 4:31 pm ]
Post subject:  Mouse Input

I'm confused on how to exactly read mouse input using console functions. Can anyone give a brief example?

Thanks. Very Happy

Author:  Tony [ Mon Oct 20, 2003 4:54 pm ]
Post subject: 

I doubt you can even read mouse input using console functions Confused but I could be wrong.

Author:  Mr.Begebies [ Mon Oct 20, 2003 6:39 pm ]
Post subject: 

I figured out how to do it in opengl. Heres the code for anyone who has a similar question:

code:

LRESULT CALLBACK WndProc (HWND hWnd, UINT message,
                          WPARAM wParam, LPARAM lParam)
{

    switch (message)
    {
    case WM_CREATE:
        return 0;
    case WM_CLOSE:
        PostQuitMessage (0);
        return 0;

    case WM_DESTROY:
        return 0;
       
    //***Monitors mouse click***
    //Ex: WM_LBUTTONDOWN       
    case WM_MOUSEWHEEL:
        //*Actions go here*
        return 0;
   //***

    case WM_KEYDOWN:
        switch (wParam)
        {
        case VK_ESCAPE:
            PostQuitMessage(0);
            return 0;
        }
        return 0;

    default:
        return DefWindowProc (hWnd, message, wParam, lParam);
    }
}


This function is found near the bottom of your opengl file, you just need to add the part in the commented area. As for 'WM_MOUSEWHEEL' part, thats just the code indicating the mouse event.

A good website, and really, the only website to find a full documentation of C++ and opengl commands, is at http://msdn.microsoft.com/library/

Author:  Dan [ Mon Oct 20, 2003 10:08 pm ]
Post subject: 

you can get mouse input in console but you need speicale lib file. i think one comes with the borad land comiplers.


: