- Timestamp:
- 2006-06-02T21:53:26Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 59ed572f
- Parents:
- 2408969
- Location:
- tetris
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tetris/input.c
r2408969 r86029498 42 42 #include <sys/types.h> 43 43 #include <sys/time.h> 44 #include <stdio.h> 44 45 45 46 #include <errno.h> … … 91 92 int rc; 92 93 93 #define NILTZ ((struct timezone *)0)94 95 94 /* 96 95 * Someday, select() will do this for us. … … 99 98 */ 100 99 if (tvp) { 101 (void) gettimeofday(&starttv, N ILTZ);100 (void) gettimeofday(&starttv, NULL); 102 101 endtv = *tvp; 103 102 s = &endtv; … … 108 107 if (!getchar_inprog) 109 108 getchar_inprog = async_send_2(1,CONSOLE_GETCHAR,0,0,&charcall); 110 if (async_wait_timeout(getchar_inprog, &rc, s->tv_usec) == ETIMEOUT) { 109 if (!s) 110 async_wait_for(getchar_inprog, &rc); 111 else if (async_wait_timeout(getchar_inprog, &rc, s->tv_usec) == ETIMEOUT) { 111 112 tvp->tv_sec = 0; 112 113 tvp->tv_usec = 0; … … 121 122 if (tvp) { 122 123 /* since there is input, we may not have timed out */ 123 (void) gettimeofday(&endtv, N ILTZ);124 (void) gettimeofday(&endtv, NULL); 124 125 TV_SUB(&endtv, &starttv); 125 126 TV_SUB(tvp, &endtv); /* adjust *tvp by elapsed time */ -
tetris/screen.c
r2408969 r86029498 160 160 char smallscr[55]; 161 161 162 (void)snprintf(smallscr, sizeof(smallscr),162 snprintf(smallscr, sizeof(smallscr), 163 163 "the screen is too small (must be at least %dx%d)", 164 164 MINROWS, MINCOLS); … … 204 204 if (score != curscore) { 205 205 moveto(0, 0); 206 (void)printf("Score: %d", score);206 printf("Score: %d", score); 207 207 curscore = score; 208 208 } … … 252 252 *sp = so; 253 253 if (i != ccol) { 254 if (cur_so) { 255 resume_normal(); 256 cur_so = 0; 257 } 254 258 moveto(RTOD(j), CTOD(i)); 255 259 } … … 262 266 } 263 267 putstr(" "); 268 264 269 ccol = i + 1; 265 270 /* … … 282 287 } 283 288 } 284 resume_normal();285 289 if (cur_so) 290 resume_normal(); 286 291 fflush(); 287 292 }
Note:
See TracChangeset
for help on using the changeset viewer.
