Recommended Posts

Hi,
I am fiddling around with SDL 1.2.13 and trying to control the camera look at with the mouse. Using the mouse to look around.
If i use window's library i get no probs. But getting the mouse position with SDL_GetMouseState always returns 0 on both coordinates.
I also have tried only using the window's GetCursosPos function and SDL_WarpMouse to set the position, but it seems that this one does not work properly as well.
Can some one help me?
I don't mind losing SDL, but i would like to make the the "look around" with mouse multiplataform and i only know how to do it in windows.

0

Share this post

Link to post

Share on other sites

I just use a "handle input" type function like so (this is just the 'skeleton' version of the function, without any functionality filled in except for the mouse position handling which you asked about).

I am not sure if you already have an event handling loop in yr SDL app, but it should be only run once per frame. [I assume you already know this; I am just including this for completeness.]

Here is more of a complete (skeleton) event handling loop to see the overall context:

int Player::handle_input(SDL_Event event){// This function is the event handler function. It takes the user's input and// sets the appropriate input member variable flags.// Processing should not be performed here; only flag setting is permitted.