Index: apps/plugins/CATEGORIES =================================================================== --- apps/plugins/CATEGORIES (revision 14217) +++ apps/plugins/CATEGORIES (working copy) @@ -12,6 +12,7 @@ chopper,games clock,apps credits,viewers +credits2,demos cube,demos demystify,demos dice,games Index: apps/plugins/Makefile =================================================================== --- apps/plugins/Makefile (revision 14217) +++ apps/plugins/Makefile (working copy) @@ -73,6 +73,12 @@ $(SILENT)mkdir -p $(dir $@) $(call PRINTS,CC $( ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: credits2.c $ + * + * Written by Sylvain Fourmanoit + * This is based on the property viewer by Peter D'Hoye. + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#include "plugin.h" + +PLUGIN_HEADER + +static struct plugin_api* rb; + +const char* const credits[] = { +#include /* generated list of names from docs/CREDITS */ +}; + +char * get_credits(int selected_item, void* data, char *buffer); + +enum plugin_status plugin_start(struct plugin_api* api, void* parameter) +{ + struct gui_synclist credits_lists; + enum plugin_status status = PLUGIN_OK; + bool quit = false; + int j = 0; + int btn; + + (void)parameter; + rb = api; + + /* Turn off backlight timeout */ + rb->backlight_set_timeout(1); + + rb->show_logo(); + + /* Show the logo for about 3 secs, or until the user stops */ + for (j = 0; j < 15; j++) { + rb->sleep((HZ*2)/10); + + btn = rb->button_get(false); + if (btn != BUTTON_NONE && !(btn & BUTTON_REL)) + break; + } + + /* Restore to default backlight timeout */ + rb->backlight_set_timeout(rb->global_settings->backlight_timeout); + + /* Create a synclist with the credits information */ + rb->gui_synclist_init(&credits_lists, &get_credits, NULL, false, 1); + rb->gui_synclist_set_title(&credits_lists, "Credits", NOICON); + rb->gui_synclist_set_icon_callback(&credits_lists, NULL); + rb->gui_synclist_set_nb_items(&credits_lists, + sizeof(credits)/sizeof(char*)); + rb->gui_synclist_limit_scroll(&credits_lists, true); + rb->gui_synclist_select_item(&credits_lists, 0); + rb->gui_synclist_draw(&credits_lists); + + /* Iterate through the synclist */ + while(!quit) + { + btn = rb->get_action(CONTEXT_LIST,TIMEOUT_BLOCK); + if (rb->gui_synclist_do_button(&credits_lists,btn,LIST_WRAP_ON)) + continue; + switch(btn) + { + case ACTION_STD_CANCEL: + quit = true; + break; + default: + if (rb->default_event_handler(btn) == SYS_USB_CONNECTED) + { + status = PLUGIN_USB_CONNECTED; + break; + } + } + } + + return status; +} + +char * get_credits(int selected_item, void* data, char *buffer) +{ + (void)data; + + rb->strcpy(buffer,credits[selected_item]); + return buffer; +}