2005-02-15 08:03:56 +00:00
|
|
|
|
/***************************************************************************
|
|
|
|
|
* __________ __ ___.
|
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
|
* $Id$
|
|
|
|
|
*
|
2006-03-27 17:34:23 +00:00
|
|
|
|
* Copyright (C) 2005 Jonas H<EFBFBD>gqvist
|
2005-02-15 08:03:56 +00:00
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
2005-02-15 08:03:56 +00:00
|
|
|
|
*
|
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
|
* KIND, either express or implied.
|
|
|
|
|
*
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
#include "plugin.h"
|
2012-02-25 20:29:01 +00:00
|
|
|
|
#include "lib/pluginlib_actions.h"
|
2005-02-15 08:03:56 +00:00
|
|
|
|
|
2012-02-25 20:29:01 +00:00
|
|
|
|
/* this set the context to use with PLA */
|
|
|
|
|
static const struct button_mapping *plugin_contexts[]
|
|
|
|
|
= { pla_main_ctx,
|
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
|
pla_remote_ctx,
|
|
|
|
|
#endif
|
|
|
|
|
};
|
2006-01-15 18:20:18 +00:00
|
|
|
|
|
2005-03-05 22:45:04 +00:00
|
|
|
|
#define DISPLAY_WIDTH LCD_WIDTH
|
|
|
|
|
#define DISPLAY_HEIGHT LCD_HEIGHT
|
|
|
|
|
#define RAND_SCALE 5
|
2005-02-15 08:03:56 +00:00
|
|
|
|
|
2005-05-23 16:23:25 +00:00
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
|
#define REMOTE_WIDTH LCD_REMOTE_WIDTH
|
|
|
|
|
#define REMOTE_HEIGHT LCD_REMOTE_HEIGHT
|
2008-11-03 14:37:50 +00:00
|
|
|
|
#include "pluginbitmaps/remote_rockboxlogo.h"
|
2008-01-31 21:05:32 +00:00
|
|
|
|
#define REMOTE_LOGO_WIDTH BMPWIDTH_remote_rockboxlogo
|
|
|
|
|
#define REMOTE_LOGO_HEIGHT BMPHEIGHT_remote_rockboxlogo
|
2008-01-31 19:28:51 +00:00
|
|
|
|
#define REMOTE_LOGO remote_rockboxlogo
|
2005-06-30 21:07:00 +00:00
|
|
|
|
#endif /* HAVE_REMOTE_LCD */
|
2005-05-16 12:07:30 +00:00
|
|
|
|
|
2008-01-31 19:28:51 +00:00
|
|
|
|
#define LOGO rockboxlogo
|
2008-11-03 14:37:50 +00:00
|
|
|
|
#include "pluginbitmaps/rockboxlogo.h"
|
2008-01-31 21:05:32 +00:00
|
|
|
|
#define LOGO_WIDTH BMPWIDTH_rockboxlogo
|
|
|
|
|
#define LOGO_HEIGHT BMPHEIGHT_rockboxlogo
|
2005-03-05 22:45:04 +00:00
|
|
|
|
|
2012-02-25 20:29:01 +00:00
|
|
|
|
/* We use PLA */
|
|
|
|
|
#define LP_QUIT PLA_EXIT
|
|
|
|
|
#define LP_DEC_X PLA_LEFT
|
|
|
|
|
#define LP_DEC_X_REPEAT PLA_LEFT_REPEAT
|
|
|
|
|
#define LP_INC_X PLA_RIGHT
|
|
|
|
|
#define LP_INC_X_REPEAT PLA_RIGHT_REPEAT
|
plugins: Improve usability of iPod keymaps
- Reduce need to press multiple buttons at
the same time to quit a plugin
- Have "Menu" be default way to quit plugins or
to access plugin menu
- Fall back to (Long) "Select" or Long "Menu"
in cases where Menu button isn't available
(e.g. in ImageViewer and many games)
out of scope:
boomshine, lua_scripts, Rockpaint,
Doom, Duke3D, Pacbox, Quake,
Sgt-Puzzles, Wolf3D, XWorld,
Minesweeper, Pixel Painter, Spacerocks
Change-Id: I6d4dc7174695fe4b8ee9cbaccb21bdbfe6af5c48
2022-12-18 20:13:15 +00:00
|
|
|
|
|
|
|
|
|
#if (CONFIG_KEYPAD == IPOD_1G2G_PAD) \
|
|
|
|
|
|| (CONFIG_KEYPAD == IPOD_3G_PAD) \
|
|
|
|
|
|| (CONFIG_KEYPAD == IPOD_4G_PAD)
|
|
|
|
|
#define LP_QUIT2 PLA_UP
|
|
|
|
|
#define LP_DEC_Y PLA_SCROLL_BACK
|
|
|
|
|
#define LP_DEC_Y_REPEAT PLA_SCROLL_BACK_REPEAT
|
|
|
|
|
#define LP_INC_Y PLA_SCROLL_FWD
|
|
|
|
|
#define LP_INC_Y_REPEAT PLA_SCROLL_FWD_REPEAT
|
|
|
|
|
#else
|
|
|
|
|
#define LP_QUIT2 PLA_CANCEL
|
2012-02-25 20:29:01 +00:00
|
|
|
|
#define LP_DEC_Y PLA_DOWN
|
|
|
|
|
#define LP_DEC_Y_REPEAT PLA_DOWN_REPEAT
|
|
|
|
|
#define LP_INC_Y PLA_UP
|
|
|
|
|
#define LP_INC_Y_REPEAT PLA_UP_REPEAT
|
plugins: Improve usability of iPod keymaps
- Reduce need to press multiple buttons at
the same time to quit a plugin
- Have "Menu" be default way to quit plugins or
to access plugin menu
- Fall back to (Long) "Select" or Long "Menu"
in cases where Menu button isn't available
(e.g. in ImageViewer and many games)
out of scope:
boomshine, lua_scripts, Rockpaint,
Doom, Duke3D, Pacbox, Quake,
Sgt-Puzzles, Wolf3D, XWorld,
Minesweeper, Pixel Painter, Spacerocks
Change-Id: I6d4dc7174695fe4b8ee9cbaccb21bdbfe6af5c48
2022-12-18 20:13:15 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
2005-02-15 08:03:56 +00:00
|
|
|
|
|
2009-01-16 10:34:40 +00:00
|
|
|
|
enum plugin_status plugin_start(const void* parameter) {
|
2005-02-15 08:03:56 +00:00
|
|
|
|
int button;
|
|
|
|
|
int timer = 10;
|
2005-03-05 22:45:04 +00:00
|
|
|
|
int x = (DISPLAY_WIDTH / 2) - (LOGO_WIDTH / 2);
|
|
|
|
|
int y = (DISPLAY_HEIGHT / 2) - (LOGO_HEIGHT / 2);
|
2005-02-15 09:27:23 +00:00
|
|
|
|
int dx;
|
|
|
|
|
int dy;
|
|
|
|
|
|
2005-02-15 08:03:56 +00:00
|
|
|
|
(void)parameter;
|
2005-02-15 09:27:23 +00:00
|
|
|
|
|
2005-03-05 22:45:04 +00:00
|
|
|
|
rb->srand(*rb->current_tick);
|
|
|
|
|
dx = rb->rand()%(2*RAND_SCALE+1) - RAND_SCALE;
|
|
|
|
|
dy = rb->rand()%(2*RAND_SCALE+1) - RAND_SCALE;
|
2005-02-15 08:03:56 +00:00
|
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
|
rb->lcd_clear_display();
|
2014-06-18 05:15:00 +00:00
|
|
|
|
rb->lcd_bitmap((const fb_data*)LOGO, x, y, LOGO_WIDTH, LOGO_HEIGHT);
|
2005-05-16 12:07:30 +00:00
|
|
|
|
#ifdef REMOTE_LOGO
|
2005-06-29 01:39:50 +00:00
|
|
|
|
rb->lcd_remote_clear_display();
|
2014-06-20 22:49:05 +00:00
|
|
|
|
rb->lcd_remote_bitmap((const fb_remote_data*)REMOTE_LOGO,
|
2005-05-16 12:07:30 +00:00
|
|
|
|
(x * (REMOTE_WIDTH - REMOTE_LOGO_WIDTH)) / (DISPLAY_WIDTH - LOGO_WIDTH),
|
|
|
|
|
(y * (REMOTE_HEIGHT - REMOTE_LOGO_HEIGHT)) / (DISPLAY_HEIGHT - LOGO_HEIGHT),
|
2005-06-29 01:39:50 +00:00
|
|
|
|
REMOTE_LOGO_WIDTH, REMOTE_LOGO_HEIGHT);
|
2005-05-16 12:07:30 +00:00
|
|
|
|
#endif
|
2005-02-15 08:03:56 +00:00
|
|
|
|
x += dx;
|
|
|
|
|
if (x < 0) {
|
|
|
|
|
dx = -dx;
|
|
|
|
|
x = 0;
|
|
|
|
|
}
|
2005-03-05 22:45:04 +00:00
|
|
|
|
if (x > DISPLAY_WIDTH - LOGO_WIDTH) {
|
2005-02-15 08:03:56 +00:00
|
|
|
|
dx = -dx;
|
2005-03-05 22:45:04 +00:00
|
|
|
|
x = DISPLAY_WIDTH - LOGO_WIDTH;
|
2005-02-15 08:03:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
y += dy;
|
|
|
|
|
if (y < 0) {
|
|
|
|
|
dy = -dy;
|
|
|
|
|
y = 0;
|
|
|
|
|
}
|
2005-03-05 22:45:04 +00:00
|
|
|
|
if (y > DISPLAY_HEIGHT - LOGO_HEIGHT) {
|
2005-02-15 08:03:56 +00:00
|
|
|
|
dy = -dy;
|
2005-03-05 22:45:04 +00:00
|
|
|
|
y = DISPLAY_HEIGHT - LOGO_HEIGHT;
|
2005-02-15 08:03:56 +00:00
|
|
|
|
}
|
2005-03-05 22:45:04 +00:00
|
|
|
|
|
2005-02-15 08:03:56 +00:00
|
|
|
|
rb->lcd_update();
|
2005-05-16 12:07:30 +00:00
|
|
|
|
#ifdef REMOTE_LOGO
|
2005-06-29 01:39:50 +00:00
|
|
|
|
rb->lcd_remote_update();
|
2005-03-05 22:45:04 +00:00
|
|
|
|
#endif
|
2005-02-15 08:03:56 +00:00
|
|
|
|
rb->sleep(HZ/timer);
|
2012-02-25 20:29:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*We get button from PLA this way */
|
|
|
|
|
button = pluginlib_getaction(TIMEOUT_NOBLOCK, plugin_contexts,
|
|
|
|
|
ARRAYLEN(plugin_contexts));
|
|
|
|
|
|
2005-02-15 08:03:56 +00:00
|
|
|
|
switch (button) {
|
2005-03-05 22:45:04 +00:00
|
|
|
|
case LP_QUIT:
|
2012-02-25 20:29:01 +00:00
|
|
|
|
case LP_QUIT2:
|
2005-02-15 08:03:56 +00:00
|
|
|
|
return PLUGIN_OK;
|
2005-03-05 22:45:04 +00:00
|
|
|
|
case LP_DEC_X:
|
2012-02-25 20:29:01 +00:00
|
|
|
|
case LP_DEC_X_REPEAT:
|
2005-03-05 22:45:04 +00:00
|
|
|
|
if (dx)
|
|
|
|
|
dx += (dx < 0) ? 1 : -1;
|
2005-02-15 08:03:56 +00:00
|
|
|
|
break;
|
2005-03-05 22:45:04 +00:00
|
|
|
|
case LP_INC_X:
|
2012-02-25 20:29:01 +00:00
|
|
|
|
case LP_INC_X_REPEAT:
|
2005-03-05 22:45:04 +00:00
|
|
|
|
dx += (dx < 0) ? -1 : 1;
|
2005-02-15 08:03:56 +00:00
|
|
|
|
break;
|
2005-03-05 22:45:04 +00:00
|
|
|
|
case LP_DEC_Y:
|
2012-02-25 20:29:01 +00:00
|
|
|
|
case LP_DEC_Y_REPEAT:
|
2005-03-05 22:45:04 +00:00
|
|
|
|
if (dy)
|
|
|
|
|
dy += (dy < 0) ? 1 : -1;
|
2005-02-15 08:03:56 +00:00
|
|
|
|
break;
|
2005-03-05 22:45:04 +00:00
|
|
|
|
case LP_INC_Y:
|
2012-02-25 20:29:01 +00:00
|
|
|
|
case LP_INC_Y_REPEAT:
|
2005-03-05 22:45:04 +00:00
|
|
|
|
dy += (dy < 0) ? -1 : 1;
|
2005-02-15 08:03:56 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
2005-03-05 22:45:04 +00:00
|
|
|
|
if (rb->default_event_handler(button) == SYS_USB_CONNECTED) {
|
|
|
|
|
return PLUGIN_USB_CONNECTED;
|
|
|
|
|
}
|
2005-02-15 08:03:56 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|