SDL_MOUSEMOTION Problem

Started by
0 comments, last by Kylotan 16 years, 2 months ago
Hello, In my program : switch (event.type) { case SDL_QUIT: bQuit = true; break; case SDL_MOUSEMOTION: newx = event.motion.x; // get x and y value from mouse newy = event.motion.y; break; case SDL_KEYDOWN: keyboard(&(event.key)); if (event.key.keysym.sym == SDLK_ESCAPE) bQuit = true; The problem is: When I press a key on the keyboard, then newx and newy get an input that is not their actually place on the screen. This input can be 20000 .... -2 or something, anything. Why is this happening? Greetings RenRan
Advertisement
Probably because (a) you don't have a 'break' after your key handling code, and (b) something else in your switch statement after that point does something with newx and newy. Unfortunately you didn't post the whole statement so I can only guess.

This topic is closed to new replies.

Advertisement