Added SDL2 Experiment 6, and fixed a bad yank that got copied

- Added Experiment 6, which is a modified version of experiment 5 using delta-time scaling.
- Removed the double SDL initialization, which is a no-op, but for the sake of betterment.
This commit is contained in:
2023-02-02 14:59:06 +00:00
parent 360513f31e
commit 2f434471c2
6 changed files with 184 additions and 26 deletions

View File

@ -60,11 +60,6 @@ int main(int argc, char ** argv)
printf("SDL Initialization Error: %s\n", SDL_GetError());
}
if (SDL_Init(SDL_INIT_EVERYTHING) != 0)
{
printf("SDL Initialization Error: %s\n", SDL_GetError());
}
// Create an SDL window and rendering context in that window:
SDL_Window * window = SDL_CreateWindow("SDL_TEST", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 640, 0);
SDL_Renderer * renderer = SDL_CreateRenderer(window, -1, rendererFlags);
@ -105,7 +100,7 @@ int main(int argc, char ** argv)
gravityY /= gravityMagnitude;
// Calculate the gravity between them and scale the vector:
if(gravityMagnitude > 15)
if(gravityMagnitude > 15)
{
gravityAcceleration = 2 * (2500 / pow(gravityMagnitude, 2));
gravityX *= gravityAcceleration;