From fb9b032bd8e18e3f99841bf3da5e0cab793b3ca9 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Thu, 7 Sep 2006 00:55:52 +0000 Subject: Updated to QuesoGLC 0.4.1. Minor stuff. git-svn-id: svn://mattst88.com/svn/glpong3d/trunk@14 4dd1920e-271a-0410-bca0-81b404a81564 --- Makefile | 2 +- glpong3d.c | 36 +++++++++++++----------------------- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 79011fa..b1b5fe6 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ WARN=-Wall -W -ansi -pedantic CFLAGS=-Os -pipe -std=c99 ${WARN} LDFLAGS=-Wl,-O1,-s INCLUDES=`sdl-config --cflags` -LIBRARIES=`sdl-config --libs` -lSDL_image -lSDL_net -lGL -lGLU -lGLC +LIBRARIES=`sdl-config --libs` -lSDL_image -lSDL_net -lGL -lGLU -lglc32 EXT=.exe EXE=glpong3d${EXT} diff --git a/glpong3d.c b/glpong3d.c index 1bc1d02..c918f7b 100644 --- a/glpong3d.c +++ b/glpong3d.c @@ -31,7 +31,7 @@ int main(int argc, char * argv[]) { last = now; frames = 0; } - /*printf("now: %ld, last %ld, frames: %u, fps: %u\n", now, last, frames, GLPong.fps);*/ + printf("now: %ld, last %ld, frames: %u, fps: %u\n", now, last, frames, GLPong.fps); GLPong_Draw(); SDL_Delay(10); } @@ -103,10 +103,9 @@ void GLPong_Init() { atexit(SDLNet_Quit); SDL_WM_SetCaption("glpong3d", "glpong3d"); - temp = IMG_Load("ball.png"); + /*temp = IMG_Load("ball.png"); SDL_WM_SetIcon(temp, NULL); - SDL_FreeSurface(temp); - temp = NULL; + SDL_FreeSurface(temp);*/ SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); @@ -144,7 +143,7 @@ void GLPong_Init() { background = SDL_GL_SurfaceToTexture(temp); SDL_FreeSurface(temp); } - temp = IMG_Load("ball-blur.png"); + temp = IMG_Load("ball.png"); ball_texture = SDL_GL_SurfaceToTexture(temp); SDL_FreeSurface(temp); temp = IMG_Load("paddle-skyos.png"); @@ -174,23 +173,6 @@ void GLPong_HandleEvents() { if (GLPong.Event.key.keysym.sym == SDLK_ESCAPE) { GLPong.done = 1; return; - } else if (GLPong.Event.key.keysym.sym == SDLK_p) { - for (;;) { - SDL_Delay(10); - if (SDL_PollEvent(&GLPong.Event) != 0) { - if (GLPong.Event.type == SDL_QUIT) { - GLPong.done = 1; - return; - } else if (GLPong.Event.type == SDL_KEYDOWN){ - if (GLPong.Event.key.keysym.sym == SDLK_ESCAPE) { - GLPong.done = 1; - return; - } else if (GLPong.Event.key.keysym.sym == SDLK_p) { - break; - } - } - } - } } } } @@ -355,6 +337,7 @@ void GLPong_CleanUp() { __inline__ unsigned int NextPow2(unsigned int value) { unsigned int x; +#ifdef __i386__ __asm("dec %1\n\t" "movl $2,%0\n\t" "bsr %1,%1\n\t" @@ -362,6 +345,12 @@ __inline__ unsigned int NextPow2(unsigned int value) { : "=r" (x) : "c" (value) ); +#else + x = 1; + while (x < value) { + x *= 2; + } +#endif return x; } @@ -398,7 +387,8 @@ GLuint SDL_GL_SurfaceToTexture(SDL_Surface * surface) { glBindTexture(GL_TEXTURE_2D, texture); SDL_LockSurface(surface); - glTexImage2D(GL_TEXTURE_2D, 0, surface->format->BytesPerPixel, surface->w, surface->h, 0, format, GL_UNSIGNED_BYTE, surface->pixels); + glTexImage2D(GL_TEXTURE_2D, 0, surface->format->BytesPerPixel, surface->w, + surface->h, 0, format, GL_UNSIGNED_BYTE, surface->pixels); SDL_UnlockSurface(surface); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); -- cgit v1.2.3