diff options
Diffstat (limited to 'sdl/pyramid.c')
| -rw-r--r-- | sdl/pyramid.c | 20 | 
1 files changed, 9 insertions, 11 deletions
| diff --git a/sdl/pyramid.c b/sdl/pyramid.c index 1e14ebb..ff8a03f 100644 --- a/sdl/pyramid.c +++ b/sdl/pyramid.c @@ -31,9 +31,6 @@  #include "sdltools.h"  #include "window.h" -/* globals */ -struct platform p; -  /* sane defaults, these are overwritable by config.lua */  int program_running = 1;  unsigned int xres_w = 640; @@ -49,7 +46,7 @@ unsigned int maxfps_w  = 60;  static int client_init(struct client *);  static int client_destroy(struct client *);  static inline void process_events(void); -static void render(void); +static void render(struct platform *);  static int client_init(struct client *p)  { @@ -90,7 +87,7 @@ static inline void process_events(void)      sdl_process_events();  } -static void render(void) +static void render(struct platform *p)  {      /* clear the window with current clearing color */      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -98,17 +95,17 @@ static void render(void)      /* save the matrix state and do the rotations */      glPushMatrix();          /* apply camera transform, and draw the ground */ -        glframe_apply_camera_transform(&p.camera, 1); -        glCallList(p.c->ground_list); +        glframe_apply_camera_transform(&p->camera, 1); +        glCallList(p->c->ground_list);          glPushMatrix();          /* move object back and do in place rotation */          glTranslatef(0.0f, 0.2f, -3.5f); -        glRotatef(p.c->xrot, 1.0f, 0.0f, 0.0f); -        glRotatef(p.c->yrot, 0.0f, 1.0f, 0.0f); +        glRotatef(p->c->xrot, 1.0f, 0.0f, 0.0f); +        glRotatef(p->c->yrot, 0.0f, 1.0f, 0.0f);          /* draw the pyramid */ -        glCallList(p.c->triangle_list); +        glCallList(p->c->triangle_list);          glPopMatrix();          /* draw a snowman */ @@ -127,6 +124,7 @@ static void render(void)  int main(int argc, char **argv)  { +    struct platform p;      memset(&p, 0, sizeof(p));      /* setup client platform */ @@ -148,7 +146,7 @@ int main(int argc, char **argv)          startclock = SDL_GetTicks();          process_events(); -        render(); +        render(&p);          sdlFrameControl(startclock);      } | 
