From 1f714742e2dc53445f9979980e4b2e74c5bdcf8f Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Thu, 5 Jun 2008 20:02:57 +0000 Subject: Fix a few warnings from icc. Remove an unneeded function git-svn-id: svn://mattst88.com/svn/glpong/trunk@17 449aeecc-241a-0410-943f-e2f883e2d7a2 --- ball.c | 20 +++----------------- glpong.c | 15 ++++++++++----- glpong.h | 7 ++++--- 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/ball.c b/ball.c index 1ae80fe..20c7f2f 100644 --- a/ball.c +++ b/ball.c @@ -57,9 +57,9 @@ GLPong_BallAdd(Ball_t ** balls) { newball->y = 100.0f; newball->xv = 2.0f; newball->yv = 2.0f; - newball->r = rand() % 255; - newball->g = rand() % 255; - newball->b = rand() % 255; + newball->r = (GLubyte)(rand() % 255); + newball->g = (GLubyte)(rand() % 255); + newball->b = (GLubyte)(rand() % 255); newball->a = SDL_ALPHA_OPAQUE; *balls = newball; @@ -70,20 +70,6 @@ GLPong_BallAdd(Ball_t ** balls) { } } -void -GLPong_BallDelete(Ball_t * from, Ball_t * ball) { - Ball_t * temp = NULL; - while (from) { - if (from == ball) { - temp = ball; - from->next = ball->next; - free(ball); - break; - } - from = from->next; - } -} - void GLPong_BallDeleteAll(Ball_t * list) { if (list) { diff --git a/glpong.c b/glpong.c index 921420a..a31829e 100644 --- a/glpong.c +++ b/glpong.c @@ -59,6 +59,9 @@ int main(int argc, char * argv[]) { case GLPONG_ADDBALL: /* add another ball */ GLPong_BallAdd(&GLPong.balls); break; + case GLPONG_DELETEBALL: +/* GLPong_BallDelete(GLPong.balls, GLPong.balls);*/ + break; } GLPong_BallMoveAll(&GLPong.balls); @@ -137,10 +140,10 @@ GLPong_Init(GLPong_t * GLPong) { glClearColor(0.0f, 0.0f, 0.0f, 0.0f); - printf("OpenGL Vendor: %s\n", glGetString(GL_VENDOR)); - printf("OpenGL Renderer: %s\n", glGetString(GL_RENDERER)); - printf("OpenGL Version: %s\n", glGetString(GL_VERSION)); - printf("OpenGL Extensions: %s\n", glGetString(GL_EXTENSIONS)); + printf("OpenGL Vendor: %s\n", (const char *)glGetString(GL_VENDOR)); + printf("OpenGL Renderer: %s\n", (const char *)glGetString(GL_RENDERER)); + printf("OpenGL Version: %s\n", (const char *)glGetString(GL_VERSION)); + printf("OpenGL Extensions: %s\n", (const char *)glGetString(GL_EXTENSIONS)); ball_texture = SDL_GL_NPOTSurfaceToTexture(temp, NULL, NULL); SDL_FreeSurface(temp); @@ -168,7 +171,9 @@ GLPong_HandleEvents(void) { return GLPONG_EXIT; } if (Event.type == SDL_KEYDOWN) { - if (Event.key.keysym.sym == SDLK_ESCAPE) { + if (Event.key.keysym.sym == SDLK_d) { + return GLPONG_DELETEBALL; + } else if (Event.key.keysym.sym == SDLK_ESCAPE) { return GLPONG_EXIT; } else if (Event.key.keysym.sym == SDLK_SPACE) { return GLPONG_ADDBALL; diff --git a/glpong.h b/glpong.h index b665ffa..2cec198 100644 --- a/glpong.h +++ b/glpong.h @@ -10,9 +10,10 @@ #define GLPONG_WIDTH 640.0f #define GLPONG_HEIGHT 480.0f -#define GLPONG_NOACTION 0 -#define GLPONG_EXIT 1 -#define GLPONG_ADDBALL 2 +#define GLPONG_NOACTION 0 +#define GLPONG_EXIT 1 +#define GLPONG_ADDBALL 2 +#define GLPONG_DELETEBALL 3 #if SDL_BYTEORDER == SDL_BIG_ENDIAN #define RMASK 0xff000000 -- cgit v1.2.3