   [SDL] Getting and Setting the mouse Cursor
  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.   
  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.  <br><br>Here is a small snippet with all other event handling not included:<br><pre><br>while( SDL_PollEvent( &event ) )<br>    {<br>   if( event.type == SDL_MOUSEMOTION )<br>   {<br>  xMouse = event.motion.x; // (x/y)Mouse variables are member<br>  yMouse = event.motion.y; // variables of the player class<br>  // that tracks mouse movement.<br>   }<br>    }<br></pre><br><br><br>Here is more of a complete (skeleton) event handling loop to see the overall context:<br><!–STARTSCRIPT–><!–source lang="cpp"–><div class="source"><pre><br><span class="cpp-keyword">int</span> Player::handle_input(SDL_Event event)<br>{<br>    <span class="cpp-comment">// This function is the event handler function.  It takes the user's input and</span><br>    <span class="cpp-comment">// sets the appropriate input member variable flags.</span><br>    <span class="cpp-comment">// Processing should not be performed here; only flag setting is permitted.</span><br><br>    <span class="cpp-comment">//If a key was pressed</span><br>    <span class="cpp-keyword">int</span> event_return = <span class="cpp-number">1</span>;<br><br>    <span class="cpp-keyword">while</span>( SDL_PollEvent( &amp;event ) )<br>    {<br><br>   <span class="cpp-keyword">if</span>( event.type == SDL_QUIT )<br>  { <span class="cpp-comment">//Quit the program</span><br>  event_return = <span class="cpp-number">0</span>;<br>  }<br><br>   <span class="cpp-keyword">if</span>( event.type == SDL_KEYDOWN )<br>   { <span class="cpp-comment">//Adjust the player coordinates</span><br>  <span class="cpp-keyword">switch</span>( event.key.keysym.sym )<br>  {<br><span class="cpp-comment">//</span><br>  }<br>   }<br><br>   <span class="cpp-keyword">if</span>( event.type == SDL_KEYUP )<br>   { <span class="cpp-comment">//Adjust the player coordinates</span><br>  <span class="cpp-keyword">switch</span>( event.key.keysym.sym )<br>  {<br>  <span class="cpp-comment">//</span><br>  }<br>   }<br><br><br>   <span class="cpp-keyword">if</span>( event.type == SDL_MOUSEBUTTONDOWN )<br>   {<br>  <span class="cpp-keyword">if</span> ( event.button.button == SDL_BUTTON_WHEELUP )<br>  {<br> <span class="cpp-comment">//</span><br>  }<br><br>  <span class="cpp-keyword">if</span> ( event.button.button == SDL_BUTTON_WHEELDOWN )<br>  {<br> <span class="cpp-comment">//</span><br>  }<br><br>  <span class="cpp-keyword">if</span> ( event.button.button == SDL_BUTTON_LEFT )<br>  {<br> <span class="cpp-comment">//</span><br>  }<br><br>  <span class="cpp-keyword">if</span> ( event.button.button == SDL_BUTTON_MIDDLE )<br>  {<br><span class="cpp-comment">//</span><br>  }<br><br>  <span class="cpp-keyword">if</span> ( event.button.button == SDL_BUTTON_RIGHT )<br>  {<br> <span class="cpp-comment">//</span><br>  }<br><br>   }<br><br><br>   <span class="cpp-keyword">if</span>( event.type == SDL_MOUSEBUTTONUP  )<br>   {<br>  <span class="cpp-keyword">if</span> ( event.button.button == SDL_BUTTON_LEFT )<br>  {<br> <span class="cpp-comment">//</span><br>  }<br><br>  <span class="cpp-keyword">if</span> ( event.button.button == SDL_BUTTON_MIDDLE )<br>  {<br> <span class="cpp-comment">//</span><br>  }<br><br>  <span class="cpp-keyword">if</span> ( event.button.button == SDL_BUTTON_RIGHT )<br>  {<br> <span class="cpp-comment">//</span><br>  }<br>   }<br><br>   <span class="cpp-keyword">if</span>( event.type == SDL_MOUSEMOTION )<br>   {<br>  xMouse = event.motion.x;<br>  yMouse = event.motion.y;<br><br>   }<br><br>    }<br>    <span class="cpp-keyword">return</span> event_return;<br>}<br><br></pre></div><!–ENDSCRIPT–> 