problem with movement
HI, so I have just a simple game loop in SDL when I press W, nothing happens, the character is not moving uKeyDown; is created outside the loop everything was working fine before I added the switch key handling, so there is probably some stupid mistake in that switch statement. // main game loop while (isRunning) { while (SDL_PollEvent(&event)) { switch (event.type) { case SDL_QUIT: // close on X isRunning = 0; break; case SDL_KEYDOWN: // KEYDOWN switch (event.key.keysym.scancode) { case SDL_SCANCODE_W: // W press upKeyDown = 1; break; } case SDL_KEYUP: // KEYUP switch (event.key.keysym.scancode) { case SDL_SCANCODE_W: upKeyDown = 0; break; } } } printf("y = %d\n", dest.y); printf("x = %d\n", dest.x); // clear the window SDL_RenderClear(renderer); // set the y position in the struct dest.y = (int)y_pos; // draw the image to the window SDL_RenderCopy(renderer, tex, NULL, &dest); SDL_RenderPresent(renderer); if (upKeyDown == 1) { y_pos -= (float)2; } printf("dest.w = %d\n", &dest.w); // wait 1/60th of a second SDL_Delay(1000 / 60); }