summaryrefslogtreecommitdiff
path: root/glpong.c
diff options
context:
space:
mode:
Diffstat (limited to 'glpong.c')
-rw-r--r--glpong.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/glpong.c b/glpong.c
index cca1238..a1d9b53 100644
--- a/glpong.c
+++ b/glpong.c
@@ -5,9 +5,11 @@
#include "SDL.h"
#include "SDL_opengl.h"
#include "SDL_image.h"
+#include <GL/glc.h>
#include "glpong.h"
#include "text.h"
+#include "fps.h"
static int GLPong_Init(GLPong_t * GLPong);
static void GLPong_Deinit(GLPong_t * GLPong);
@@ -25,8 +27,6 @@ int main(int argc, char * argv[]) {
GLPONG_HEIGHT
};
- clock_t start;
- GLfloat fps;
unsigned int frames = 0;
int action;
int done = 0;
@@ -48,7 +48,7 @@ int main(int argc, char * argv[]) {
printf("%d balls\n", length(GLPong.balls));
#endif
- start = SDL_GetTicks();
+ GLPong_FPSInit();
while ( !done ) {
action = GLPong_HandleEvents();
@@ -69,14 +69,14 @@ int main(int argc, char * argv[]) {
SDL_GL_SwapBuffers();
/* end drawing */
-
+
frames++;
if (frames == 10) {
- fps = (GLfloat) frames / (SDL_GetTicks() - start) * 1000;
+ GLPong_FPSCount();
frames = 0;
- start = SDL_GetTicks();
- //printf("%.2f frames per second\n", GLPong.fps);
+ GLPong_FPSPrint();
}
+
SDL_Delay(10);
}