summaryrefslogtreecommitdiff
path: root/apps/plugins/clock.c
diff options
context:
space:
mode:
authorZakk Roberts <midk@rockbox.org>2004-07-18 12:14:05 +0000
committerZakk Roberts <midk@rockbox.org>2004-07-18 12:14:05 +0000
commit97d1d15bd82d1e40cc41e839610fa79c2ba05384 (patch)
treebf5ec22242e7e2fffaffd80e5d7b30bb79623733 /apps/plugins/clock.c
parent7e5e568678f1888bcef4bac018d4cca221c76aac (diff)
downloadrockbox-97d1d15bd82d1e40cc41e839610fa79c2ba05384.tar.gz
rockbox-97d1d15bd82d1e40cc41e839610fa79c2ba05384.zip
Fixed credits roll, and improved animations. Revised the release notes as well.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4893 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/clock.c')
-rw-r--r--apps/plugins/clock.c178
1 files changed, 67 insertions, 111 deletions
diff --git a/apps/plugins/clock.c b/apps/plugins/clock.c
index 58a42cd4e0..1c8c621ec5 100644
--- a/apps/plugins/clock.c
+++ b/apps/plugins/clock.c
@@ -5,7 +5,7 @@
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id: clock.c,v 2.0 2003/12/8 8 * $Id: clock.c,v 2.31 2003/12/8
9 * 9 *
10 * Copyright (C) 2003 Zakk Roberts 10 * Copyright (C) 2003 Zakk Roberts
11 * 11 *
@@ -17,89 +17,51 @@
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19 19
20/******************************** 20/*****************************
21RELEASE NOTES ******************* 21 * RELEASE NOTES
22********************************* 22
23 23***** VERSION 2.31 **
24********************************* 24Fixed credits roll - now displays all names. Features
25VERSION 2.3 * STABLE ************ 25improved animations. Also revised release notes.
26********************************* 26
27Tab indentation removed 27***** VERSION 2.30 **
28Counter screen added at ON+F2, with countdown options 28Tab indentation removed, and -Counter screen added
29 29at ON+F2, with countdown options
30********************************* 30
31VERSION 2.22 * STABLE *********** 31***** VERSION 2.22 **
32*********************************
33Fixed two bugs: 32Fixed two bugs:
34Digital settings are now independent of LCD settings 33Digital settings are now independent of LCD settings
3512/24h "Analog" settings are now displayed correctly. 3412/24h "Analog" settings are now displayed correctly.
36 35
37********************************* 36***** VERSION 2.21 **
38VERSION 2.21 * STABLE *********** 37-Changed the behaviour of F2
39********************************* 38
40Changed the behaviour of F2 39***** VERSION 2.20 **
41 40Few small bugs taken care of. New features: -New binary mode,
42******************************** 41-new mode selector, -new feature, "counter", and -redesigned help screen.
43VERSION 2.2 * STABLE *********** 42
44******************************** 43***** VERSION 2.10 **
45Few small bugs taken care of. 44New bug fixes, and some new features: -an LCD imitation mode, and
46Release version. 45-American and European date modes are an option.
47 46
48Features: 47***** VERSION 2.00 [BETA] **
49-New mode, "Binary" 48Major update, lots of bugfixes and new features.
50-New mode selector - access via PLAY 49New Features: -Fullscreen mode introduced, -modes have independent
51-New feature, "Counter" - F2 to start/stop, Hold F2 to reset. 50settings, -credit roll added, -options screen reworked, -logo selector,
52-New redesigned 9-page help screen. 51and -much- cleaner code. Analog changes include: -removed border option,
53-Small bugs fixed. 52and -added both 12/24h time readouts. Digital changes include: -centered
54 53second and date readouts and also -introduced two new additional ways
55********************************* 54of graphically conveying second progress: a bar, and a LCD-invert mode.
56VERSION 2.1 * STABLE ************ 55
57********************************* 56***** VERSION 1.0 **
58Even more bugs fixed. Almost bug-free :) 57Original release, featuring analog / digital modes and a few options.
59 58*****************************/
60Features:
61-Another new mode!! LCD imitation (similar to Digital)
62-American/European date modes added
63-lots of bugs fixed
64
65*********************************
66VERSION 2.0: * BETA *************
67*********************************
68
69Major update. Code pretty much rewritten. Lots of bugs fixed.
70
71New Features: *******************
72-New mode, Fullscreen!
73-Seperate settings for each mode
74-Credits at F2
75-Options at F3
76-Startup / Shutdown logo (choose one by hitting ON)
77-CLEANER code!
78
79Analog specific changes: ********
80-removed outer border option
81-added 12/24h readout (and am/pm bitmaps for 12h mode)
82
83Digital specific changes: *******
84-now centers date and second readouts
85-second readout options, "Digital" (text), "Bar" (progressbar), "Inverse" (inverts the display as the seconds go by)
86-12/24h modes as well here (and of course the am/pm bitmaps)
87
88********************************
89VERSION 1.0 * "ALPHA" (STABLE) *
90********************************
91Release Version.
92
93Features analog / digital modes,
94and a few options.
95********************************/
96
97#include "plugin.h" 59#include "plugin.h"
98#include "time.h" 60#include "time.h"
99 61
100#ifdef HAVE_LCD_BITMAP 62#ifdef HAVE_LCD_BITMAP
101 63
102#define CLOCK_VERSION "2.3" 64#define CLOCK_VERSION "2.31"
103 65
104/* prototypes */ 66/* prototypes */
105void show_logo(bool animate, bool show_clock_text); 67void show_logo(bool animate, bool show_clock_text);
@@ -619,7 +581,7 @@ void save_settings(void)
619 *********************************/ 581 *********************************/
620void load_settings(void) 582void load_settings(void)
621{ 583{
622 /* open the settings file */ 584 /* open the settings file */
623 int fd; 585 int fd;
624 fd = rb->open(default_filename, O_RDONLY); 586 fd = rb->open(default_filename, O_RDONLY);
625 587
@@ -1096,17 +1058,9 @@ void binary(int hour, int minute, int second)
1096void show_logo(bool animate, bool show_clock_text) 1058void show_logo(bool animate, bool show_clock_text)
1097{ 1059{
1098 int x_position; 1060 int x_position;
1099 unsigned char *clogo = 0;
1100 1061
1101 /* decide which logo we're using - usually #4 */ 1062 unsigned char *clogo = 0;
1102 if(logo == 1) 1063 clogo = (unsigned char *)clocklogo_4;
1103 clogo = (unsigned char *)clocklogo_1;
1104 else if(logo == 2)
1105 clogo = (unsigned char *)clocklogo_2;
1106 else if(logo == 3)
1107 clogo = (unsigned char *)clocklogo_3;
1108 else
1109 clogo = (unsigned char *)clocklogo_4;
1110 1064
1111 /* animate logo */ 1065 /* animate logo */
1112 if(animate) 1066 if(animate)
@@ -1157,15 +1111,7 @@ void exit_logo(void)
1157 int x_position; 1111 int x_position;
1158 1112
1159 unsigned char *clogo = 0; 1113 unsigned char *clogo = 0;
1160 1114 clogo = (unsigned char *)clocklogo_4;
1161 if(logo == 1)
1162 clogo = (unsigned char *)clocklogo_1;
1163 else if(logo == 2)
1164 clogo = (unsigned char *)clocklogo_2;
1165 else if(logo == 3)
1166 clogo = (unsigned char *)clocklogo_3;
1167 else
1168 clogo = (unsigned char *)clocklogo_4;
1169 1115
1170 /* fly downwards */ 1116 /* fly downwards */
1171 for(x_position = 20; x_position <= 128; x_position++) 1117 for(x_position = 20; x_position <= 128; x_position++)
@@ -1176,9 +1122,9 @@ void exit_logo(void)
1176 } 1122 }
1177} 1123}
1178 1124
1179/******************* 1125/********************
1180 * Rolls the credits 1126 * Rolls the credits
1181 ******************/ 1127 ********************/
1182/* The following function is pretty confusing, so 1128/* The following function is pretty confusing, so
1183 * it's extra well commented. */ 1129 * it's extra well commented. */
1184bool roll_credits(void) 1130bool roll_credits(void)
@@ -1203,7 +1149,7 @@ bool roll_credits(void)
1203 1149
1204 show_logo(false, false); 1150 show_logo(false, false);
1205 1151
1206 rb->snprintf(elapsednames, sizeof(elapsednames), "[Credits] %d/%d", j+1, numnames); 1152 rb->snprintf(elapsednames, sizeof(elapsednames), "[Credits] %02d/%02d", j+1, numnames);
1207 rb->lcd_puts(0, 0, elapsednames); 1153 rb->lcd_puts(0, 0, elapsednames);
1208 1154
1209 /* used to center the text */ 1155 /* used to center the text */
@@ -1213,10 +1159,10 @@ bool roll_credits(void)
1213 rb->lcd_getstringsize(job, &job_w, &job_h); 1159 rb->lcd_getstringsize(job, &job_w, &job_h);
1214 1160
1215 /* line 1 flies in */ 1161 /* line 1 flies in */
1216 for (namepos=0; namepos < LCD_WIDTH/2-name_w/2; namepos++) 1162 for (namepos=0-name_w; namepos < (LCD_WIDTH/2)-(name_w/2)-2; namepos++)
1217 { 1163 {
1218 rb->lcd_clearrect(0, 48, 112, 8); /* clear any trails left behind */ 1164 rb->lcd_clearrect(0, 48, 112, 8); /* clear any trails left behind */
1219 rb->lcd_putsxy(namepos, 48, name); /* show their name */ 1165 rb->lcd_putsxy(namepos, 48, name);
1220 rb->lcd_update(); 1166 rb->lcd_update();
1221 1167
1222 /* exit on keypress */ 1168 /* exit on keypress */
@@ -1226,10 +1172,10 @@ bool roll_credits(void)
1226 } 1172 }
1227 1173
1228 /* now line 2 flies in */ 1174 /* now line 2 flies in */
1229 for(jobpos=LCD_WIDTH; jobpos > LCD_WIDTH/2-(job_w+2)/2; jobpos--) /* we use (job_w+2) to ensure it fits on the LCD */ 1175 for(jobpos=LCD_WIDTH; jobpos > (LCD_WIDTH/2)-(job_w+2)/2; jobpos--) /* we use (job_w+2) to ensure it fits on the LCD */
1230 { 1176 {
1231 rb->lcd_clearrect(0, 56, 112, 8); /* clear trails */ 1177 rb->lcd_clearrect(0, 56, 112, 8); /* clear trails */
1232 rb->lcd_putsxy(jobpos, 56, job); /* show their job */ 1178 rb->lcd_putsxy(jobpos, 56, job);
1233 rb->lcd_update(); 1179 rb->lcd_update();
1234 1180
1235 /* exit on keypress */ 1181 /* exit on keypress */
@@ -1243,14 +1189,22 @@ bool roll_credits(void)
1243 { 1189 {
1244 rb->sleep((HZ*2)/10); /* wait a moment */ 1190 rb->sleep((HZ*2)/10); /* wait a moment */
1245 1191
1192 namepos++;
1193 jobpos--;
1194
1195 rb->lcd_clearrect(0, 48, 112, 16);
1196 rb->lcd_putsxy(namepos, 48, name);
1197 rb->lcd_putsxy(jobpos, 56, job);
1198 rb->lcd_update();
1199
1246 btn = rb->button_get(false); 1200 btn = rb->button_get(false);
1247 if (btn != BUTTON_NONE && !(btn & BUTTON_REL)) 1201 if (btn != BUTTON_NONE && !(btn & BUTTON_REL))
1248 return false; 1202 return false;
1249 } 1203 }
1250 1204
1251 /* fly out both lines at same time */ 1205 /* fly out both lines at same time */
1252 namepos=(LCD_WIDTH/2-name_w/2)+5; 1206 namepos=((LCD_WIDTH/2)-(name_w/2))+8;
1253 jobpos=(LCD_WIDTH/2-(job_w+2)/2)-5; 1207 jobpos=((LCD_WIDTH/2)-(job_w+2)/2)-8;
1254 while(namepos<LCD_WIDTH || jobpos > 0-job_w) 1208 while(namepos<LCD_WIDTH || jobpos > 0-job_w)
1255 { 1209 {
1256 rb->lcd_clearrect(0, 48, 112, 16); /* clear trails */ 1210 rb->lcd_clearrect(0, 48, 112, 16); /* clear trails */
@@ -1267,14 +1221,16 @@ bool roll_credits(void)
1267 jobpos--; 1221 jobpos--;
1268 } 1222 }
1269 1223
1270 /* pause (.5s) */ 1224 /* pause (.2s) */
1271 rb->sleep(HZ/2); 1225 rb->sleep(HZ/2);
1272 1226
1273 /* and scan for button presses */ 1227 /* and scan for button presses */
1274 btn = rb->button_get(false); 1228 btn = rb->button_get(false);
1275 if ( (!btn) && (!(btn&BUTTON_REL)) ) 1229 if (btn != BUTTON_NONE && !(btn & BUTTON_REL))
1276 return false; 1230 return false;
1277 } 1231 }
1232 exit_logo();
1233
1278 return true; 1234 return true;
1279} 1235}
1280 1236
@@ -1288,11 +1244,11 @@ bool show_credits(void)
1288 1244
1289 rb->lcd_clear_display(); 1245 rb->lcd_clear_display();
1290 1246
1247 rb->lcd_puts(0, 7, "Credit Roll...");
1248
1291 /* show the logo with an animation and the clock version text */ 1249 /* show the logo with an animation and the clock version text */
1292 show_logo(true, true); 1250 show_logo(true, true);
1293 1251
1294 rb->lcd_puts(0, 7, "Credit Roll...");
1295
1296 rb->lcd_update(); 1252 rb->lcd_update();
1297 1253
1298 /* pause while button scanning */ 1254 /* pause while button scanning */
@@ -2174,7 +2130,7 @@ void counter_finished(void)
2174 2130
2175 while(!done) 2131 while(!done)
2176 { 2132 {
2177 rb->lcd_clear_display(); 2133 rb->lcd_clear_display();
2178 2134
2179 /* draw "TIME'S UP" text */ 2135 /* draw "TIME'S UP" text */
2180 rb->lcd_bitmap(times_up, 0, xpos, 112, 50, true); 2136 rb->lcd_bitmap(times_up, 0, xpos, 112, 50, true);
@@ -2251,7 +2207,7 @@ void show_counter(void)
2251 } 2207 }
2252 if(remaining_h < 0) 2208 if(remaining_h < 0)
2253 { 2209 {
2254 /* reset modes */ 2210 /* reset modes */
2255 counting = false; 2211 counting = false;
2256 counting_up = true; 2212 counting_up = true;
2257 2213
@@ -2419,7 +2375,7 @@ void counter_options(void)
2419 { 2375 {
2420 cursorpos = 2; 2376 cursorpos = 2;
2421 counting_up = false; 2377 counting_up = false;
2422 } 2378 }
2423 break; 2379 break;
2424 } 2380 }
2425 } 2381 }