Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a simple SDL application that tracks the relative change in mouse position

But for some reason, the motion.xrel and motion.yrel give back massive numbers!

my code: SDL_WM_GrabInput(SDL_GRAB_ON); SDL_ShowCursor(false);

while(!quit){
// Draw the scene

if (invalidated == 1){
  on_render();
  invalidated = 0;
}

// And poll for events
SDL_PumpEvents();
SDL_Event event;
while ( SDL_PollEvent(&event) ) {
  switch (event.type) {
    case SDL_KEYDOWN:
    case SDL_KEYUP:
      on_key(event.key);
      break;

    case SDL_MOUSEMOTION:
      std::cerr << event.motion.xrel << ":" << event.motion.yrel << std::endl;
      invalidated = 1;
      break;

    ...

and the printed results are ridiculous:

400:300
-11297:1705
-11215:1268
-10969:940
-10314:-43
-9986:-698
-9331:-1681
-9003:-2227
-8593:-2664
-8020:-3538
-7774:-3647
-7365:-4193
-7283:-4302
-7119:0

any idea why?? System is Ubuntu 12 running in virtual box

share|improve this question
1  
I've seen problems with relative movement when there's a utilities like Synergy running. Virtual machines sometimes employ utilities for the mouse to detect when a mouse pointer leaves the virtual machine and enters the host desktop. Have you tried the same application in a native environment? –  Byte56 Nov 16 '12 at 17:08
    
ya i think you are right... sigh.. my dev environment is in virtual box :( but thanks anyways –  zaftcoAgeiha Nov 16 '12 at 20:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.