SDL keyboard event

Hi community

I am just starting to learn SDL and Linux Ubuntu using (WSL). I wrote a small program in c++ to render a picture to the screen or window and also move the picture around in the window. The program compiles and runs successfully, but when I try to move the image around I get no response or a delayed response. I am using Vcxsrv Xlaunch to run the program. Please any kind of help will be appreciated.

Do you use a loop to handle all pending events every frame?

SDL_Event event;
while (SDL_PollEvent(&event))
{
    ...
}

Iā€™m asking because I have seen a few people recently who have used if instead of while here which have lead do similar problems as you describe.

1 Like