Strip trailing directory slash
[kugel-rb.git] / apps / credits.c
blob190a77edcdc795ea9acfdb57bba171d835087198
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Robert Hak <rhak at ramapo.edu>
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #include "credits.h"
21 #include "lcd.h"
22 #include "font.h"
23 #include "kernel.h"
24 #include "button.h"
25 #include "sprintf.h"
27 const char* const credits[] = {
28 #include "credits.raw" /* generated list of names from docs/CREDITS */
31 #ifdef HAVE_LCD_BITMAP
32 #define MAX_LINES 7
33 #define DISPLAY_TIME HZ*2
34 #else
35 #define MAX_LINES 2
36 #define DISPLAY_TIME HZ
37 #endif
39 #ifdef HAVE_LCD_CHARCELLS
40 void roll_credits(void)
42 int i;
43 int line = 0;
44 int numnames = sizeof(credits)/sizeof(char*);
46 lcd_clear_display();
48 for ( i=0; i < numnames; i += MAX_LINES )
50 lcd_clear_display();
51 for(line = 0;line < MAX_LINES && line+i < numnames;line++)
53 lcd_puts(0, line, credits[line+i]);
56 /* abort on keypress */
57 if (button_get_w_tmo(DISPLAY_TIME) & BUTTON_REL)
58 return;
60 return;
62 #else
64 void roll_credits(void)
66 int i;
67 int line = 0;
68 int numnames = sizeof(credits)/sizeof(char*);
69 char buffer[40];
71 int y=LCD_HEIGHT;
73 int height;
74 int width;
76 lcd_setfont(FONT_UI);
78 lcd_getstringsize("A", &width, &height);
80 while(1) {
81 lcd_clear_display();
82 for ( i=0; i <= (LCD_HEIGHT-y)/height; i++ )
83 lcd_putsxy(0, i*height+y, line+i<numnames?credits[line+i]:"");
84 snprintf(buffer, sizeof(buffer), " [Credits] %2d/%2d ",
85 line+1, numnames);
86 lcd_clearrect(0, 0, LCD_WIDTH, height);
87 lcd_putsxy(0, 0, buffer);
88 lcd_update();
90 if (button_get_w_tmo(HZ/20) & BUTTON_REL)
91 return;
93 y--;
95 if(y<0) {
96 line++;
97 if(line >= numnames)
98 break;
99 y+=height;
103 return;
105 #endif