summaryrefslogtreecommitdiff
path: root/apps/plugins/flipit.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/flipit.c')
-rw-r--r--apps/plugins/flipit.c75
1 files changed, 0 insertions, 75 deletions
diff --git a/apps/plugins/flipit.c b/apps/plugins/flipit.c
index fab409cc14..294bee8f5b 100644
--- a/apps/plugins/flipit.c
+++ b/apps/plugins/flipit.c
@@ -595,75 +595,6 @@ static void draw_info_panel(void)
595 GRID_TOP + 4*(TK_HEIGHT+TK_SPACE) + 2, s ); 595 GRID_TOP + 4*(TK_HEIGHT+TK_SPACE) + 2, s );
596} 596}
597 597
598#else /* HAVE_LCD_CHARCELLS */
599
600static const unsigned char tk_pat[4][7] = {
601 { 0x0e, 0x11, 0x0e, 0x00, 0x0e, 0x11, 0x0e }, /* white - white */
602 { 0x0e, 0x11, 0x0e, 0x00, 0x0e, 0x1f, 0x0e }, /* white - black */
603 { 0x0e, 0x1f, 0x0e, 0x00, 0x0e, 0x11, 0x0e }, /* black - white */
604 { 0x0e, 0x1f, 0x0e, 0x00, 0x0e, 0x1f, 0x0e } /* black - black */
605};
606
607static unsigned char cur_pat[7];
608static unsigned long gfx_chars[5];
609
610static void release_gfx(void)
611{
612 int i;
613
614 for (i = 0; i < 5; i++)
615 if (gfx_chars[i])
616 rb->lcd_unlock_pattern(gfx_chars[i]);
617}
618
619static bool init_gfx(void)
620{
621 int i;
622
623 for (i = 0; i < 5; i++) {
624 if ((gfx_chars[i] = rb->lcd_get_locked_pattern()) == 0) {
625 release_gfx();
626 return false;
627 }
628 }
629 for (i = 0; i < 4; i++)
630 rb->lcd_define_pattern(gfx_chars[i], tk_pat[i]);
631 return true;
632}
633
634/* draw a spot at the coordinates (x,y), range of p is 0-19 */
635static void draw_spot(int p)
636{
637 if ((p/5) & 1)
638 p -= 5;
639
640 rb->lcd_putc (p%5, p/10, gfx_chars[2*spots[p]+spots[p+5]]);
641}
642
643/* draw the cursor at the current cursor position */
644static void draw_cursor(void)
645{
646 if ((cursor_pos/5) & 1) {
647 rb->memcpy( cur_pat, tk_pat[2*spots[cursor_pos-5]+spots[cursor_pos]], 7 );
648 cur_pat[4] ^= 0x15;
649 cur_pat[6] ^= 0x11;
650 }
651 else {
652 rb->memcpy( cur_pat, tk_pat[2*spots[cursor_pos]+spots[cursor_pos+5]], 7 );
653 cur_pat[0] ^= 0x15;
654 cur_pat[2] ^= 0x11;
655 }
656 rb->lcd_define_pattern(gfx_chars[4], cur_pat);
657 rb->lcd_putc( cursor_pos%5, cursor_pos/10, gfx_chars[4] );
658}
659
660/* draw the info panel ... duh */
661static void draw_info_panel(void)
662{
663 rb->lcd_puts( 6, 0, "Flips" );
664 rb->lcd_putsf( 6, 1, "%d", moves );
665}
666
667#endif /* LCD */ 598#endif /* LCD */
668 599
669/* clear the cursor where it is */ 600/* clear the cursor where it is */
@@ -978,9 +909,6 @@ enum plugin_status plugin_start(const void* parameter)
978#endif 909#endif
979 910
980 rb->lcd_update(); 911 rb->lcd_update();
981#else /* HAVE_LCD_CHARCELLS */
982 if (!init_gfx())
983 return PLUGIN_ERROR;
984#endif 912#endif
985 rb->button_get_w_tmo(HZ*3); 913 rb->button_get_w_tmo(HZ*3);
986 914
@@ -995,8 +923,5 @@ enum plugin_status plugin_start(const void* parameter)
995 rb->srand(*rb->current_tick); 923 rb->srand(*rb->current_tick);
996 924
997 rc = flipit_loop(); 925 rc = flipit_loop();
998#ifdef HAVE_LCD_CHARCELLS
999 release_gfx();
1000#endif
1001 return rc; 926 return rc;
1002} 927}