From c396e4161a9bd3f15b779476b3f18400abbecf11 Mon Sep 17 00:00:00 2001 From: Kevin Ferrare Date: Fri, 26 Feb 2010 07:38:18 +0000 Subject: Remote support for the alarmclock plugin git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24921 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/alarmclock.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'apps/plugins/alarmclock.c') diff --git a/apps/plugins/alarmclock.c b/apps/plugins/alarmclock.c index c8653dcd64..a691b61822 100644 --- a/apps/plugins/alarmclock.c +++ b/apps/plugins/alarmclock.c @@ -41,9 +41,23 @@ int rem_seconds(void) { -(rb->get_time()->tm_sec)); } -void draw(void) { +void draw_centered_string(struct screen * display, char * string) { + int w, h; + display->getstringsize(string, &w, &h); + + if (w > display->lcdwidth || h > display->lcdheight) { + rb->splash(0, string); + } else { + display->putsxy((display->lcdwidth - w) / 2, + (display->lcdheight - h) / 2, + string); + display->update(); + } +} + +void draw(struct screen * display) { char info[128]; - rb->lcd_clear_display(); + display->clear_display(); int secs = rem_seconds(); @@ -61,16 +75,7 @@ void draw(void) { alarm[0], alarm[1]); } - - int w, h; - rb->lcd_getstringsize(info, &w, &h); - - if (w > LCD_WIDTH || h > LCD_HEIGHT) - rb->splash(0, info); - else { - rb->lcd_putsxy((LCD_WIDTH - w) / 2, (LCD_HEIGHT - h) / 2, info); - rb->lcd_update(); - } + draw_centered_string(display, info); } bool can_play(void) { @@ -100,6 +105,7 @@ void play(void) { enum plugin_status plugin_start(const void* parameter) { int button; + int i; (void)parameter; if (!can_play()) { @@ -115,7 +121,9 @@ enum plugin_status plugin_start(const void* parameter) if (button == PLA_QUIT) quit = true; - draw(); + FOR_NB_SCREENS(i) { + draw(rb->screens[i]); + } if (waiting) { if (rem_seconds() <= 0) { quit = done = true; -- cgit v1.2.3