annotate src/pcdebrief.c @ 3:17286938e22a

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