Tag Info

New answers tagged

1

simple solution using a uniform vector: float dx = target->x - x; float dy = target->y - y; float dist = std::sqrt(dx*dx+dy*dy); if (dist > speed * delta) { dx /= dist; dy /= dist; x += dx * speed * delta; y += dy * speed * delta; } else { x = target->x; y = target->y; }


1

The new function is SDL_GL_SwapWindow() and it takes your window pointer.


1

sizeof(_curKeys)/sizeof(Uint8) does not give you the size of the array, because it's just a pointer from compiler's point of view. Instead of passing NULL as an argument to SDL_GetKeyboardState();, pass a pointer to an integer and the function will write the length of the array to that integer. See documentation. Use that value for both allocating _oldKeys ...



Top 50 recent answers are included