Fixed issue with function definition mismatch. Created a basic timer; starting work on issue #1

This commit is contained in:
Joe Adams 2017-12-11 11:37:17 +00:00
parent f08b0d5b75
commit c2bb045d5e
2 changed files with 14 additions and 2 deletions

Binary file not shown.

View File

@ -19,7 +19,7 @@ typedef struct colour {
void updateBall(double *ballX, double *ballY, double *ballVX, double *ballVY, double paddleX, int paddleWidth, int winWidth, int winHeight); void updateBall(double *ballX, double *ballY, double *ballVX, double *ballVY, double paddleX, int paddleWidth, int winWidth, int winHeight);
void drawPaddle(double paddleX, int paddleWidth, int paddleHeight, colour *c); void drawPaddle(double paddleX, int paddleWidth, int winWidth, int winHeight, colour *c);
void drawBall(double ballX, double ballY, colour *c); void drawBall(double ballX, double ballY, colour *c);
void drawBg(int winWidth, int winHeight, colour *c1, colour *c2); void drawBg(int winWidth, int winHeight, colour *c1, colour *c2);
@ -135,9 +135,21 @@ int main(void) {
* Let's go! * Let's go!
* ---------------- * ----------------
*/ */
go=1; go=1;
while(go) { while(go) {
/* ----------------
* Timing control
* ----------------
*
*/
Uint32 tickspassed=SDL_GetTicks()-timer;
timer=SDL_GetTicks();
int fps=1000/(tickspassed+1);
printf("Time to draw: %u, fps: %i \r", tickspassed, fps); fflush(stdout);
/* /*
* ---------------- * ----------------