view src/pcdebrief.c @ 0:c84446dfb3f5

initial add
author paulo@localhost
date Fri, 13 Mar 2009 00:39:12 -0700
parents
children
line source
1 #include "ljpc.h"
3 void debriefDrawPage(const char *page, size_t pageNumber) {
4 int y = 40;
5 char line[256];
6 int linePos = 0;
7 int done = 0;
9 acquire_screen();
10 clear_to_color(screen, bgColor);
11 textout_centre_ex(screen, aver32, "GAME OVER",
12 SCREEN_W / 2, y, fgColor, -1);
13 textprintf_right_ex(screen, aver32,
14 SCREEN_W - 40, y, fgColor, -1,
15 "Page %u", (unsigned int)pageNumber + 1);
16 textout_centre_ex(screen, aver32,
17 "Left/Right: Change; Rotate: close",
18 SCREEN_W / 2, SCREEN_H - 40, fgColor, -1);
20 while (!done) {
21 int c = *page++;
23 // Break at newline and at end of text
24 if (c == '\n' || c == 0) {
26 // Draw blank and parenthetical lines in smaller font
27 const FONT *f = (linePos == 0 || line[0] == '(')
28 ? aver16
29 : aver32;
30 int lineH = text_height(f);
32 // Terminate the line of text and print it
33 line[linePos] = 0;
34 textout_ex(screen, f, line, 40, y, fgColor, -1);
36 linePos = 0; // Carriage return
37 y += lineH * 6 / 5; // Line feed
38 } else {
39 if (linePos + 2 < sizeof(line)) {
40 line[linePos++] = c;
41 }
42 }
43 if (c == 0) {
44 done = 1;
45 }
46 }
47 release_screen();
48 }
50 extern volatile char redrawWholeScreen;
52 LJBits debriefHandleKeys(void) {
53 int keys = menuReadPad();
55 while (keypressed()) {
56 int scancode;
57 ureadkey(&scancode);
59 if (scancode == KEY_PRTSCR) {
60 saveScreen(-1);
61 }
62 }
64 if (wantsClose) {
65 keys |= VKEY_ROTL;
66 }
68 if (!(keys & (VKEY_ROTL | VKEY_ROTR))) {
69 rest(30);
70 }
71 return keys;
72 }