Mercurial > hg > index.fcgi > lj > lj046
diff src/pcdebrief.c @ 0:c84446dfb3f5
initial add
author | paulo@localhost |
---|---|
date | Fri, 13 Mar 2009 00:39:12 -0700 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/pcdebrief.c Fri Mar 13 00:39:12 2009 -0700 1.3 @@ -0,0 +1,72 @@ 1.4 +#include "ljpc.h" 1.5 + 1.6 +void debriefDrawPage(const char *page, size_t pageNumber) { 1.7 + int y = 40; 1.8 + char line[256]; 1.9 + int linePos = 0; 1.10 + int done = 0; 1.11 + 1.12 + acquire_screen(); 1.13 + clear_to_color(screen, bgColor); 1.14 + textout_centre_ex(screen, aver32, "GAME OVER", 1.15 + SCREEN_W / 2, y, fgColor, -1); 1.16 + textprintf_right_ex(screen, aver32, 1.17 + SCREEN_W - 40, y, fgColor, -1, 1.18 + "Page %u", (unsigned int)pageNumber + 1); 1.19 + textout_centre_ex(screen, aver32, 1.20 + "Left/Right: Change; Rotate: close", 1.21 + SCREEN_W / 2, SCREEN_H - 40, fgColor, -1); 1.22 + 1.23 + while (!done) { 1.24 + int c = *page++; 1.25 + 1.26 + // Break at newline and at end of text 1.27 + if (c == '\n' || c == 0) { 1.28 + 1.29 + // Draw blank and parenthetical lines in smaller font 1.30 + const FONT *f = (linePos == 0 || line[0] == '(') 1.31 + ? aver16 1.32 + : aver32; 1.33 + int lineH = text_height(f); 1.34 + 1.35 + // Terminate the line of text and print it 1.36 + line[linePos] = 0; 1.37 + textout_ex(screen, f, line, 40, y, fgColor, -1); 1.38 + 1.39 + linePos = 0; // Carriage return 1.40 + y += lineH * 6 / 5; // Line feed 1.41 + } else { 1.42 + if (linePos + 2 < sizeof(line)) { 1.43 + line[linePos++] = c; 1.44 + } 1.45 + } 1.46 + if (c == 0) { 1.47 + done = 1; 1.48 + } 1.49 + } 1.50 + release_screen(); 1.51 +} 1.52 + 1.53 +extern volatile char redrawWholeScreen; 1.54 + 1.55 +LJBits debriefHandleKeys(void) { 1.56 + int keys = menuReadPad(); 1.57 + 1.58 + while (keypressed()) { 1.59 + int scancode; 1.60 + ureadkey(&scancode); 1.61 + 1.62 + if (scancode == KEY_PRTSCR) { 1.63 + saveScreen(-1); 1.64 + } 1.65 + } 1.66 + 1.67 + if (wantsClose) { 1.68 + keys |= VKEY_ROTL; 1.69 + } 1.70 + 1.71 + if (!(keys & (VKEY_ROTL | VKEY_ROTR))) { 1.72 + rest(30); 1.73 + } 1.74 + return keys; 1.75 +}