diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/Makefile | 11 | ||||
-rw-r--r-- | apps/plugins/SOURCES | 1 | ||||
-rw-r--r-- | apps/plugins/clock.c | 12 | ||||
-rw-r--r-- | apps/plugins/credits.c | 154 | ||||
-rw-r--r-- | apps/plugins/credits.pl | 13 |
5 files changed, 184 insertions, 7 deletions
diff --git a/apps/plugins/Makefile b/apps/plugins/Makefile index 1f1c309bd2..96e57d3c76 100644 --- a/apps/plugins/Makefile +++ b/apps/plugins/Makefile | |||
@@ -50,6 +50,15 @@ endif | |||
50 | .PHONY: $(SUBDIRS) | 50 | .PHONY: $(SUBDIRS) |
51 | all: $(BUILDDIR)/libplugin.a $(ROCKS) $(SUBDIRS) $(DEPFILE) | 51 | all: $(BUILDDIR)/libplugin.a $(ROCKS) $(SUBDIRS) $(DEPFILE) |
52 | 52 | ||
53 | $(BUILDDIR)/credits.raw: $(DOCSDIR)/CREDITS | ||
54 | @echo "create credits.raw" | ||
55 | @perl credits.pl < $< > $@ | ||
56 | |||
57 | $(OBJDIR)/credits.o: credits.c $(BUILDDIR)/credits.raw | ||
58 | @mkdir -p `dirname $@` | ||
59 | @echo "CC $<" | ||
60 | @$(CC) $(CFLAGS) -c $< -o $@ | ||
61 | |||
53 | ifndef SIMVER | 62 | ifndef SIMVER |
54 | $(OBJDIR)/%.elf: $(OBJDIR)/%.o $(LINKFILE) $(BUILDDIR)/libplugin.a | 63 | $(OBJDIR)/%.elf: $(OBJDIR)/%.o $(LINKFILE) $(BUILDDIR)/libplugin.a |
55 | $(SILENT)(file=`basename $@`; \ | 64 | $(SILENT)(file=`basename $@`; \ |
@@ -117,7 +126,7 @@ $(SUBDIRS): | |||
117 | clean: | 126 | clean: |
118 | @echo "cleaning plugins" | 127 | @echo "cleaning plugins" |
119 | @rm -f $(ROCKS) $(LINKFILE) $(OBJDIR)/*.rock $(DEPFILE) $(ELFS) \ | 128 | @rm -f $(ROCKS) $(LINKFILE) $(OBJDIR)/*.rock $(DEPFILE) $(ELFS) \ |
120 | $(OBJS) $(DEFS) | 129 | $(BUILDDIR)/credits.raw $(OBJS) $(DEFS) |
121 | @$(MAKE) -C lib clean OBJDIR=$(OBJDIR)/lib | 130 | @$(MAKE) -C lib clean OBJDIR=$(OBJDIR)/lib |
122 | @$(MAKE) -C rockboy clean OBJDIR=$(OBJDIR)/rockboy | 131 | @$(MAKE) -C rockboy clean OBJDIR=$(OBJDIR)/rockboy |
123 | @$(MAKE) -C searchengine clean OBJDIR=$(OBJDIR)/searchengine | 132 | @$(MAKE) -C searchengine clean OBJDIR=$(OBJDIR)/searchengine |
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES index cf62ee7203..254324164a 100644 --- a/apps/plugins/SOURCES +++ b/apps/plugins/SOURCES | |||
@@ -1,6 +1,7 @@ | |||
1 | /* plugins common to all models */ | 1 | /* plugins common to all models */ |
2 | battery_test.c | 2 | battery_test.c |
3 | chessclock.c | 3 | chessclock.c |
4 | credits.c | ||
4 | cube.c | 5 | cube.c |
5 | favorites.c | 6 | favorites.c |
6 | firmware_flash.c | 7 | firmware_flash.c |
diff --git a/apps/plugins/clock.c b/apps/plugins/clock.c index 6830c74d53..6b06b1a74e 100644 --- a/apps/plugins/clock.c +++ b/apps/plugins/clock.c | |||
@@ -91,7 +91,7 @@ Original release, featuring analog / digital modes and a few options. | |||
91 | /************ | 91 | /************ |
92 | * Prototypes | 92 | * Prototypes |
93 | ***********/ | 93 | ***********/ |
94 | void show_logo(bool animate, bool show_clock_text); | 94 | void show_clock_logo(bool animate, bool show_clock_text); |
95 | void exit_logo(void); | 95 | void exit_logo(void); |
96 | void save_settings(bool interface); | 96 | void save_settings(bool interface); |
97 | 97 | ||
@@ -461,7 +461,7 @@ void save_settings(bool interface) | |||
461 | rb->snprintf(buf, sizeof(buf), "Saving Settings"); | 461 | rb->snprintf(buf, sizeof(buf), "Saving Settings"); |
462 | rb->lcd_getstringsize(buf, &buf_w, &buf_h); | 462 | rb->lcd_getstringsize(buf, &buf_w, &buf_h); |
463 | rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf); | 463 | rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf); |
464 | show_logo(true, true); | 464 | show_clock_logo(true, true); |
465 | 465 | ||
466 | rb->lcd_update(); | 466 | rb->lcd_update(); |
467 | } | 467 | } |
@@ -523,7 +523,7 @@ void load_settings(void) | |||
523 | rb->snprintf(buf, sizeof(buf), "Loading Settings"); | 523 | rb->snprintf(buf, sizeof(buf), "Loading Settings"); |
524 | rb->lcd_getstringsize(buf, &buf_w, &buf_h); | 524 | rb->lcd_getstringsize(buf, &buf_w, &buf_h); |
525 | rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf); | 525 | rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf); |
526 | show_logo(true, true); | 526 | show_clock_logo(true, true); |
527 | rb->lcd_update(); | 527 | rb->lcd_update(); |
528 | 528 | ||
529 | if(fd >= 0) /* does file exist? */ | 529 | if(fd >= 0) /* does file exist? */ |
@@ -1020,7 +1020,7 @@ void binary(int hour, int minute, int second) | |||
1020 | /**************** | 1020 | /**************** |
1021 | * Shows the logo | 1021 | * Shows the logo |
1022 | ***************/ | 1022 | ***************/ |
1023 | void show_logo(bool animate, bool show_clock_text) | 1023 | void show_clock_logo(bool animate, bool show_clock_text) |
1024 | { | 1024 | { |
1025 | int y_position; | 1025 | int y_position; |
1026 | 1026 | ||
@@ -1151,7 +1151,7 @@ bool roll_credits(void) | |||
1151 | { | 1151 | { |
1152 | rb->lcd_clear_display(); | 1152 | rb->lcd_clear_display(); |
1153 | 1153 | ||
1154 | show_logo(false, false); | 1154 | show_clock_logo(false, false); |
1155 | 1155 | ||
1156 | rb->snprintf(elapsednames, sizeof(elapsednames), "[Credits] %02d/%02d", j+1, numnames); | 1156 | rb->snprintf(elapsednames, sizeof(elapsednames), "[Credits] %02d/%02d", j+1, numnames); |
1157 | rb->lcd_putsxy(credits_pos-1, 0, elapsednames); | 1157 | rb->lcd_putsxy(credits_pos-1, 0, elapsednames); |
@@ -1299,7 +1299,7 @@ bool show_credits(void) | |||
1299 | rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf); | 1299 | rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf); |
1300 | 1300 | ||
1301 | /* show the logo with an animation and the clock version text */ | 1301 | /* show the logo with an animation and the clock version text */ |
1302 | show_logo(true, true); | 1302 | show_clock_logo(true, true); |
1303 | 1303 | ||
1304 | rb->lcd_update(); | 1304 | rb->lcd_update(); |
1305 | 1305 | ||
diff --git a/apps/plugins/credits.c b/apps/plugins/credits.c new file mode 100644 index 0000000000..f172cc6c18 --- /dev/null +++ b/apps/plugins/credits.c | |||
@@ -0,0 +1,154 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Robert Hak <rhak at ramapo.edu> | ||
11 | * | ||
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. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "plugin.h" | ||
20 | |||
21 | void roll_credits(void); | ||
22 | const char* const credits[] = { | ||
23 | #include "credits.raw" /* generated list of names from docs/CREDITS */ | ||
24 | }; | ||
25 | |||
26 | static struct plugin_api* rb; | ||
27 | |||
28 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | ||
29 | { | ||
30 | int j = 0; | ||
31 | int btn; | ||
32 | |||
33 | TEST_PLUGIN_API(api); | ||
34 | (void)parameter; | ||
35 | rb = api; | ||
36 | |||
37 | rb->show_logo(); | ||
38 | #ifdef HAVE_LCD_CHARCELLS | ||
39 | rb->lcd_double_height(false); | ||
40 | #endif | ||
41 | |||
42 | for (j = 0; j < 10; j++) { | ||
43 | rb->sleep((HZ*2)/10); | ||
44 | |||
45 | btn = rb->button_get(false); | ||
46 | if (btn != BUTTON_NONE && !(btn & BUTTON_REL)) | ||
47 | return PLUGIN_OK; | ||
48 | } | ||
49 | |||
50 | roll_credits(); | ||
51 | |||
52 | return PLUGIN_OK; | ||
53 | } | ||
54 | |||
55 | #ifdef HAVE_LCD_CHARCELLS | ||
56 | void roll_credits(void) | ||
57 | { | ||
58 | int numnames = sizeof(credits)/sizeof(char*); | ||
59 | int curr_name = 0; | ||
60 | int curr_len = rb->strlen(credits[0]); | ||
61 | int curr_index = 0; | ||
62 | int curr_line = 0; | ||
63 | int name, len, new_len, line, x; | ||
64 | |||
65 | while (1) | ||
66 | { | ||
67 | rb->lcd_clear_display(); | ||
68 | |||
69 | name = curr_name; | ||
70 | x = -curr_index; | ||
71 | len = curr_len; | ||
72 | line = curr_line; | ||
73 | |||
74 | while (x < 11) | ||
75 | { | ||
76 | int x2; | ||
77 | |||
78 | if (x < 0) | ||
79 | rb->lcd_puts(0, line, credits[name] - x); | ||
80 | else | ||
81 | rb->lcd_puts(x, line, credits[name]); | ||
82 | |||
83 | if (++name >= numnames) | ||
84 | break; | ||
85 | line ^= 1; | ||
86 | |||
87 | x2 = x + len/2; | ||
88 | if ((unsigned)x2 < 11) | ||
89 | rb->lcd_putc(x2, line, '*'); | ||
90 | |||
91 | new_len = rb->strlen(credits[name]); | ||
92 | x += MAX(len/2 + 2, len - new_len/2 + 1); | ||
93 | len = new_len; | ||
94 | } | ||
95 | /* abort on keypress */ | ||
96 | if (rb->button_get_w_tmo(HZ/8) & BUTTON_REL) | ||
97 | return; | ||
98 | |||
99 | if (++curr_index >= curr_len) | ||
100 | { | ||
101 | if (++curr_name >= numnames) | ||
102 | break; | ||
103 | new_len = rb->strlen(credits[curr_name]); | ||
104 | curr_index -= MAX(curr_len/2 + 2, curr_len - new_len/2 + 1); | ||
105 | curr_len = new_len; | ||
106 | curr_line ^= 1; | ||
107 | } | ||
108 | } | ||
109 | } | ||
110 | #else | ||
111 | |||
112 | void roll_credits(void) | ||
113 | { | ||
114 | int i; | ||
115 | int line = 0; | ||
116 | int numnames = sizeof(credits)/sizeof(char*); | ||
117 | char buffer[40]; | ||
118 | |||
119 | int y=LCD_HEIGHT; | ||
120 | |||
121 | int height; | ||
122 | int width; | ||
123 | |||
124 | rb->lcd_setfont(FONT_UI); | ||
125 | |||
126 | rb->lcd_getstringsize("A", &width, &height); | ||
127 | |||
128 | while(1) { | ||
129 | rb->lcd_clear_display(); | ||
130 | for ( i=0; i <= (LCD_HEIGHT-y)/height; i++ ) | ||
131 | rb->lcd_putsxy(0, i*height+y, line+i<numnames?credits[line+i]:""); | ||
132 | rb->snprintf(buffer, sizeof(buffer), " [Credits] %2d/%2d ", | ||
133 | line+1, numnames); | ||
134 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
135 | rb->lcd_fillrect(0, 0, LCD_WIDTH, height); | ||
136 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
137 | rb->lcd_putsxy(0, 0, buffer); | ||
138 | rb->lcd_update(); | ||
139 | |||
140 | if (rb->button_get_w_tmo(HZ/20) & BUTTON_REL) | ||
141 | return; | ||
142 | |||
143 | y--; | ||
144 | |||
145 | if(y<0) { | ||
146 | line++; | ||
147 | if(line >= numnames) | ||
148 | break; | ||
149 | y+=height; | ||
150 | } | ||
151 | |||
152 | } | ||
153 | } | ||
154 | #endif | ||
diff --git a/apps/plugins/credits.pl b/apps/plugins/credits.pl new file mode 100644 index 0000000000..942a96b99f --- /dev/null +++ b/apps/plugins/credits.pl | |||
@@ -0,0 +1,13 @@ | |||
1 | # __________ __ ___. | ||
2 | # Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
3 | # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
4 | # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
5 | # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
6 | # \/ \/ \/ \/ \/ | ||
7 | # $Id$ | ||
8 | # | ||
9 | while (<STDIN>) { | ||
10 | if(($_ =~ /^([A-Z]+[\S ]+)/) && ($_ !~ /^People/)) { | ||
11 | print "\"$1\",\n"; | ||
12 | } | ||
13 | } | ||