Changeset 5339 for anuga_work/development/anugavis/src/events.c
- Timestamp:
- May 16, 2008, 4:17:15 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/development/anugavis/src/events.c
r5330 r5339 19 19 #include "height_quantity.h" 20 20 21 #define MIN(a, b) ((a) < (b) ? (a) : (b)) 22 #define MAX(a, b) ((a) > (b) ? (a) : (b)) 23 21 24 int AnugaVis_Step(void){ 25 static Uint32 ticks = 0; 26 static Uint32 lastframe; 22 27 GLfloat lightpos[4]; 23 28 int i; … … 25 30 int more = 1; 26 31 struct height_quantity_simple *height; 32 33 /* Animation. */ 34 /* FIXME needs to respect pause. */ 35 if(ticks == 0) lastframe = ticks = SDL_GetTicks(); 36 else ticks = SDL_GetTicks(); 37 if(ticks - lastframe >= FRAME_INTERVAL){ 38 lastframe = ticks; 39 if(anugavis.current_frame < (signed int)anugavis.number_of_timesteps - 1){ 40 if(!anugavis.paused) anugavis.current_frame++; 41 }else 42 anugavis.paused = 1; 43 } 27 44 28 45 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); … … 35 52 if(anugavis.keys[KEY_FORWARD]) camera_track(-CAMERA_TRACK_STEP); 36 53 if(anugavis.keys[KEY_BACKWARD]) camera_track(CAMERA_TRACK_STEP); 54 if(anugavis.keys[KEY_STRAFE_LEFT]) camera_strafe(CAMERA_STRAFE_STEP); 55 if(anugavis.keys[KEY_STRAFE_RIGHT]) camera_strafe(-CAMERA_STRAFE_STEP); 37 56 gluLookAt(anugavis.eye[0], anugavis.eye[1], anugavis.eye[2], 38 57 anugavis.focus[0], anugavis.focus[1], anugavis.focus[2], … … 57 76 } 58 77 else switch(event.key.keysym.sym){ 59 case SDLK_b: 78 case SDLK_z: 79 anugavis.current_frame = MAX(anugavis.current_frame - 10, 0); 80 break; 81 case SDLK_x: 60 82 if(anugavis.current_frame > 0) anugavis.current_frame--; 61 83 break; 62 case SDLK_f: 63 if(anugavis.current_frame < anugavis.number_of_timesteps - 1) 84 case SDLK_c: 85 case SDLK_SPACE: anugavis.paused = !anugavis.paused; break; 86 case SDLK_v: 87 if(anugavis.current_frame < 88 (signed int)anugavis.number_of_timesteps - 1) 64 89 anugavis.current_frame++; 90 break; 91 case SDLK_b: 92 anugavis.current_frame = MIN(anugavis.current_frame + 10, 93 (signed int)anugavis.number_of_timesteps 94 - 1); 65 95 break; 66 96 case SDLK_ESCAPE: more = 0; break;
Note: See TracChangeset
for help on using the changeset viewer.