diff options
Diffstat (limited to 'glpong.c')
-rw-r--r-- | glpong.c | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -14,7 +14,7 @@ static int GLPong_Init(GLPong_t * GLPong); static void GLPong_Deinit(GLPong_t * GLPong); static int GLPong_HandleEvents(); - +static INLINE unsigned int NextPow2(unsigned int value); static GLuint SDL_GL_SurfaceToTexture(SDL_Surface * surface); static GLuint SDL_GL_NPOTSurfaceToTexture(SDL_Surface * surface, GLfloat * wratio, GLfloat * hratio); @@ -67,15 +67,16 @@ int main(int argc, char * argv[]) { GLPong_BallDrawAll(GLPong.balls); - SDL_GL_SwapBuffers(); - /* end drawing */ - frames++; - if (frames == 10) { - GLPong_FPSCount(); + if (frames == 30) { frames = 0; - GLPong_FPSPrint(); } + GLPong_TextDrawFPS(GLPong_FPSCount()); + + SDL_GL_SwapBuffers(); + /* end drawing */ + + SDL_Delay(10); } @@ -194,7 +195,7 @@ GLPong_HandleEvents() { static INLINE unsigned int NextPow2(unsigned int value) { -#if (defined __i386__ || defined __amd64__ || defined __x86_64__) \ +#if (defined __i386__ || defined __x86_64__) \ && (defined __GNUC__) unsigned int x; __asm( @@ -253,8 +254,8 @@ static GLuint SDL_GL_NPOTSurfaceToTexture(SDL_Surface * surface, GLfloat * wratio, GLfloat * hratio) { SDL_Surface * pow2 = NULL; - unsigned int w = NextPow2(surface->w); - unsigned int h = NextPow2(surface->h); + int w = NextPow2(surface->w); + int h = NextPow2(surface->h); if (wratio) { *wratio = (GLfloat)surface->w / (GLfloat)h; |