Changeset 76
- Timestamp:
- Nov 9, 2003, 12:26:08 PM (19 years ago)
- Location:
- ttyvaders/trunk
- Files:
-
- 1 added
- 5 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
ttyvaders/trunk/doc/shapes.txt
r42 r76 151 151 ####### 152 152 153 ####### 154 ### ### 155 ## ## 156 # # 157 # # 158 # # 159 ## ## 160 ### ### 161 ####### 162 153 163 _______ 154 164 ,-'_______`-. -
ttyvaders/trunk/libee/ee.c
r74 r76 4 4 * All Rights Reserved 5 5 * 6 * $Id : graphics.c,v 1.6 2002/12/23 16:21:38 sam Exp$6 * $Id$ 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify … … 25 25 #include <stdlib.h> 26 26 #include <unistd.h> 27 #include <sys/time.h> 28 #include <time.h> 27 29 28 30 #include "common.h" … … 52 54 53 55 SLsmg_cls(); 56 SLtt_set_cursor_visibility( 0 ); 54 57 SLsmg_refresh(); 55 58 #elif USE_NCURSES … … 61 64 noecho(); 62 65 nodelay(stdscr, TRUE); 66 curs_set( 0 ); 63 67 #else 64 68 /* Dummy driver */ … … 136 140 } 137 141 138 void gfx_delay( void ) 139 { 140 #ifdef USE_SLANG 141 usleep(40000); 142 #elif USE_NCURSES 143 usleep(40000); 144 #else 145 /* Use dummy driver */ 146 #endif 147 } 148 149 void clear_graphics( void ) 150 { 151 #ifdef USE_SLANG 152 SLsmg_cls(); 153 #elif USE_NCURSES 154 clear(); 155 #else 156 /* Use dummy driver */ 157 #endif 158 } 142 void clear_graphics( game *g ) 143 { 144 #ifdef USE_SLANG 145 //SLsmg_cls(); 146 int y; 147 for( y = 0; y < g->h; y++ ) 148 { 149 gfx_goto( 0, y ); 150 gfx_putstr( " " ); 151 } 152 #elif USE_NCURSES 153 //clear(); 154 int y; 155 for( y = 0; y < g->h; y++ ) 156 { 157 gfx_goto( 0, y ); 158 gfx_putstr( " " ); 159 } 160 #else 161 /* Use dummy driver */ 162 #endif 163 } 164 165 static int64_t local_time(void) 166 { 167 struct timeval tv; 168 int64_t now; 169 170 gettimeofday(&tv, NULL); 171 now = tv.tv_sec; 172 now *= 1000000; 173 now += tv.tv_usec; 174 return now; 175 } 176 177 #define DELAY 40000 159 178 160 179 void refresh_graphics( void ) 161 180 { 181 static int64_t local_clock = 0; 182 int64_t now; 183 162 184 gfx_goto( 0, 0 ); 185 186 if( !local_clock ) 187 { 188 /* Initialize local_clock */ 189 local_clock = local_time(); 190 } 191 192 if( local_time() > local_clock + 10000 ) 193 { 194 /* If we are late, we shouldn't display anything */ 195 } 196 163 197 #ifdef USE_SLANG 164 198 SLsmg_refresh(); … … 168 202 /* Use dummy driver */ 169 203 #endif 204 205 now = local_time(); 206 207 if( now < local_clock + DELAY - 10000 ) 208 { 209 usleep( local_clock + DELAY - 10000 - now ); 210 } 211 212 local_clock += DELAY; 170 213 } 171 214 … … 173 216 { 174 217 #ifdef USE_SLANG 218 SLtt_set_cursor_visibility( 1 ); 175 219 SLang_reset_tty(); 176 220 SLsmg_reset_smg(); 177 221 #elif USE_NCURSES 222 curs_set( 1 ); 178 223 endwin(); 179 224 #else -
ttyvaders/trunk/src/Makefile.am
r70 r76 27 27 common.h \ 28 28 explosions.c \ 29 graphics.c \29 ../libee/ee.c \ 30 30 main.c \ 31 31 math.c \ -
ttyvaders/trunk/src/ceo.c
r72 r76 4 4 * All Rights Reserved 5 5 * 6 * $Id : ceo.c,v 1.5 2002/12/23 10:06:27 sam Exp$6 * $Id$ 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify … … 28 28 #include "common.h" 29 29 30 void ceo_alert( void)30 void ceo_alert( game *g ) 31 31 { 32 32 int end = 0; … … 34 34 while( !end ) 35 35 { 36 clear_graphics( );36 clear_graphics( g ); 37 37 38 38 if( get_key() == '\t' ) -
ttyvaders/trunk/src/common.h
r72 r76 4 4 * All Rights Reserved 5 5 * 6 * $Id : common.h,v 1.16 2003/02/09 11:17:40 sam Exp$6 * $Id$ 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify … … 50 50 # define gfx_putstr(x) SLsmg_write_string(x) 51 51 #elif USE_NCURSES 52 #define box box_other 52 53 # include <curses.h> 54 #undef box 53 55 # define gfx_color(x) attrset(COLOR_PAIR(x)) 54 56 # define gfx_goto(x,y) move(y,x) … … 200 202 * From ceo.c 201 203 */ 202 void ceo_alert( void);204 void ceo_alert( game *g ); 203 205 204 206 /* … … 223 225 void init_game( game *g ); 224 226 char get_key( void ); 225 void gfx_delay( void ); 226 void clear_graphics( void ); 227 void clear_graphics( game *g ); 227 228 void refresh_graphics( void ); 228 229 void end_graphics( void ); -
ttyvaders/trunk/src/main.c
r72 r76 4 4 * All Rights Reserved 5 5 * 6 * $Id : main.c,v 1.17 2003/02/09 11:17:40 sam Exp$6 * $Id$ 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify … … 104 104 break; 105 105 case '\t': 106 ceo_alert( );106 ceo_alert( g ); 107 107 poz = 1; 108 108 break; … … 177 177 } 178 178 179 gfx_delay();180 181 179 if( !poz || skip ) 182 180 { … … 217 215 218 216 /* Clear screen */ 219 clear_graphics( );217 clear_graphics( g ); 220 218 221 219 /* Print starfield, tunnel, aliens, player and explosions */
Note: See TracChangeset
for help on using the changeset viewer.