1
0
Fork 0
forked from len0rd/rockbox

made the jackpot plugin use the new common sprite functions, cosmetic change to the clock plugin's code

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14182 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Kevin Ferrare 2007-08-04 15:13:28 +00:00
parent 14d276121a
commit 1d91334428
2 changed files with 13 additions and 24 deletions

View file

@ -174,16 +174,17 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter){
break; break;
default: default:
redraw=false;
if(rb->default_event_handler_ex(button, cleanup, NULL) if(rb->default_event_handler_ex(button, cleanup, NULL)
== SYS_USB_CONNECTED) == SYS_USB_CONNECTED)
return PLUGIN_USB_CONNECTED; return PLUGIN_USB_CONNECTED;
if(time.second != last_second){
last_second=time.second;
redraw=true;
}else
redraw=false;
break; break;
} }
if(time.second != last_second){
last_second=time.second;
redraw=true;
}
if(redraw){ if(redraw){
clock_draw_set_colors(); clock_draw_set_colors();
FOR_NB_SCREENS(i) FOR_NB_SCREENS(i)

View file

@ -19,6 +19,7 @@
#include "plugin.h" #include "plugin.h"
#include "pluginlib_actions.h" #include "pluginlib_actions.h"
#include "picture.h"
PLUGIN_HEADER PLUGIN_HEADER
@ -52,32 +53,19 @@ static unsigned long char_patterns[NB_SLOTS];
#define PICTURE_ROTATION_STEPS REMOTE_PICTURE_HEIGHT #define PICTURE_ROTATION_STEPS REMOTE_PICTURE_HEIGHT
#endif #endif
struct jackpot_picture{
const void* data;
int width;
int height;
};
/* FIXME: would be nice to have better graphics ... */ /* FIXME: would be nice to have better graphics ... */
#include "jackpot_slots.h" #include "jackpot_slots.h"
#if NB_SCREENS==2 #if NB_SCREENS==2
#include "jackpot_slots_remote.h" #include "jackpot_slots_remote.h"
#endif #endif
const struct jackpot_picture jackpot_pictures[]={ const struct picture jackpot_pictures[]={
{ {jackpot_slots, BMPWIDTH_jackpot_slots,PICTURE_HEIGHT},
jackpot_slots,
BMPWIDTH_jackpot_slots,
PICTURE_HEIGHT
},
#if NB_SCREENS==2 #if NB_SCREENS==2
{ {jackpot_slots_remote,BMPWIDTH_jackpot_slots_remote,REMOTE_PICTURE_HEIGHT}
jackpot_slots_remote,
BMPWIDTH_jackpot_slots_remote,
REMOTE_PICTURE_HEIGHT
}
#endif #endif
}; };
#define SLEEP_TIME (HZ/100) #define SLEEP_TIME (HZ/100)
#endif /* HAVE_LCD_CHARCELLS */ #endif /* HAVE_LCD_CHARCELLS */
@ -182,8 +170,7 @@ void jackpot_display_slot_machine(struct jackpot* game, struct screen* display)
#ifdef HAVE_LCD_CHARCELLS #ifdef HAVE_LCD_CHARCELLS
display->putc(0, 0, '['); display->putc(0, 0, '[');
#else #else
const struct jackpot_picture* picture= const struct picture* picture= &(jackpot_pictures[display->screen_type]);
&(jackpot_pictures[display->screen_type]);
int pos_x=(display->width-NB_SLOTS*(picture->width+1))/2; int pos_x=(display->width-NB_SLOTS*(picture->width+1))/2;
int pos_y=(display->height-(picture->height))/2; int pos_y=(display->height-(picture->height))/2;
#endif /* HAVE_LCD_CHARCELLS */ #endif /* HAVE_LCD_CHARCELLS */
@ -216,6 +203,7 @@ void jackpot_display_slot_machine(struct jackpot* game, struct screen* display)
/* Position on the screen */ /* Position on the screen */
pos_x, pos_y, picture->width, picture->height pos_x, pos_y, picture->width, picture->height
); );
vertical_picture_draw_part(display, picture, state_y, pos_x, pos_y);
pos_x+=(picture->width+1); pos_x+=(picture->width+1);
#endif #endif
} }