I tried to use SDL to move mouse in game. The function works fine only in menu, when I join a game, the function does not work. I checked coordinates with SDL_GetGlobalMouseState(&dx, &dy), they changed for a short time and then reverted back. I used MouseMeat to check if my app sends movements, but I didn't see anything. Before I was using mouse_event, it worked fine but it's not a solution

mouse_event( 0x1, x, y, 0, 0 );

My application works with another separate game Broken code:


void Mouse::move(int x, int y)
    SDL_WarpMouseGlobal(x, y);


        printf("error SDL_Init: %s\n", SDL_GetError());

How do I fix the problem?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.