Thread: opengl mouse

  1. #1
    Flash Animator, OF DOOOOM bluehead's Avatar
    Join Date
    Nov 2001
    Posts
    269

    opengl mouse

    how can you read how much the mouse moves on the x and y axis?

    and then, how do you position the mouse back to the center?

    (for fps specifically)
    Code:
    #if _emo
      #define stereo_type_i_dislike
    #endif

  2. #2
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    Code:
    SetCursorPos(midx,midy);
    To set the cursor position

    Code:
    POINT mouse;
    GetCursorPos(&mouse);
    To get the mouse position.

    In FPS's, it's best to grab the mouse position, figure out the offset from the "center" (which you have to define yourself, usually by finding the height and width of the window and shifting them to the right once). Then, using that offset you use that as your displacement amount (usually in camera rotation). Once you've gotten these values, set the mouse position back to the center and voila, there you go.

  3. #3
    Flash Animator, OF DOOOOM bluehead's Avatar
    Join Date
    Nov 2001
    Posts
    269
    k, and how do i make my window non-resizable?
    Code:
    #if _emo
      #define stereo_type_i_dislike
    #endif

  4. #4
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    Code:
    	case WM_WINDOWPOSCHANGING:
    		{
    			LPWINDOWPOS lpwp=(LPWINDOWPOS)lParam;
    
    			if(lpwp->cx!=500)	lpwp->cx=500;
    			if(lpwp->cy!=400)	lpwp->cy=400;
    		}
    		break;
    To make your window always be 500x400. Change those values as you see fit. That should be in your window's proc function.

  5. #5
    Flash Animator, OF DOOOOM bluehead's Avatar
    Join Date
    Nov 2001
    Posts
    269
    what's a CASE that i can use to detect mouse movement in the wndproc procedure?

    *edit* nevermind i figured out how to do it
    Last edited by bluehead; 04-02-2005 at 06:12 PM.
    Code:
    #if _emo
      #define stereo_type_i_dislike
    #endif

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Mouse Input - OpenGL
    By IdioticCreation in forum Game Programming
    Replies: 3
    Last Post: 07-10-2007, 02:56 PM
  2. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  3. opengl question. mouse location vs gluperspective
    By revelation437 in forum Game Programming
    Replies: 1
    Last Post: 10-19-2004, 07:18 PM
  4. Mouse 'control' prob in OpenGL
    By gazsux in forum Game Programming
    Replies: 5
    Last Post: 04-17-2003, 10:00 AM
  5. Mouse in OpenGL?
    By TheGr8one in forum Game Programming
    Replies: 0
    Last Post: 11-01-2001, 07:19 PM