#include <stdbool.h>
#include "timestep.h"
+typedef struct Vec2d {
+ int x;
+ int y;
+} Vec2d;
+
typedef struct Colour {
Uint8 r;
Uint8 g;
static SDL_Renderer *renderer = NULL;
static const Vec2d windowSize = { 1920, 1080 };
static bool quit = false;
-static const float speed = 5.f;
+static const float speed = 20.f;
static const Colour bgClr = { 0x1c, 0x1c, 0x1c, 0xff };
Box pad, ball;
return false;
}
- renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
+ renderer = SDL_CreateRenderer(window, -1,
+ SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
if(renderer == NULL) {
COUT_ERR("Couldn't create renderer! SDL_Error: %s", SDL_GetError());
int nPhysUpdates = 0;
const Uint8 *keyStates = SDL_GetKeyboardState(NULL);
- ts_update();
while(SDL_PollEvent(&e) != 0){
if(e.type == SDL_QUIT) { quit = true; }
}
+ ts_update();
+
while(ts_phys_required(nPhysUpdates)){
paddle_update(keyStates, 1.f);
nPhysUpdates++;