2002-10-15 07:17:50 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 Damien Teney
|
|
|
|
* modified to use int instead of float math by Andreas Zwirtes
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
2003-06-29 16:33:04 +00:00
|
|
|
***************************************************************************/
|
|
|
|
#include "plugin.h"
|
2005-02-10 21:28:21 +00:00
|
|
|
#include "playergfx.h"
|
2002-10-15 07:17:50 +00:00
|
|
|
|
2002-10-29 10:45:29 +00:00
|
|
|
/* Loops that the values are displayed */
|
|
|
|
#define DISP_TIME 30
|
|
|
|
|
2004-10-17 00:54:09 +00:00
|
|
|
/* variable button definitions */
|
|
|
|
#if CONFIG_KEYPAD == RECORDER_PAD
|
|
|
|
#define CUBE_QUIT (BUTTON_OFF | BUTTON_REL)
|
|
|
|
#define CUBE_X_INC BUTTON_RIGHT
|
|
|
|
#define CUBE_X_DEC BUTTON_LEFT
|
|
|
|
#define CUBE_Y_INC BUTTON_UP
|
|
|
|
#define CUBE_Y_DEC BUTTON_DOWN
|
|
|
|
#define CUBE_Z_INC BUTTON_F2
|
|
|
|
#define CUBE_Z_DEC BUTTON_F1
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_PLAY
|
|
|
|
|
2005-02-10 21:28:21 +00:00
|
|
|
#elif CONFIG_KEYPAD == PLAYER_PAD
|
|
|
|
#define CUBE_QUIT (BUTTON_STOP | BUTTON_REL)
|
|
|
|
#define CUBE_X_INC BUTTON_RIGHT
|
|
|
|
#define CUBE_X_DEC BUTTON_LEFT
|
|
|
|
#define CUBE_Y_INC (BUTTON_ON | BUTTON_RIGHT)
|
|
|
|
#define CUBE_Y_DEC (BUTTON_ON | BUTTON_LEFT)
|
|
|
|
#define CUBE_Z_INC (BUTTON_MENU | BUTTON_RIGHT)
|
|
|
|
#define CUBE_Z_DEC (BUTTON_MENU | BUTTON_LEFT)
|
|
|
|
#define CUBE_HIGHSPEED BUTTON_PLAY
|
|
|
|
|
2004-10-17 00:54:09 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDIO_PAD
|
|
|
|
#define CUBE_QUIT (BUTTON_OFF | BUTTON_REL)
|
|
|
|
#define CUBE_X_INC BUTTON_RIGHT
|
|
|
|
#define CUBE_X_DEC BUTTON_LEFT
|
|
|
|
#define CUBE_Y_INC BUTTON_UP
|
|
|
|
#define CUBE_Y_DEC BUTTON_DOWN
|
|
|
|
#define CUBE_Z_INC (BUTTON_MENU | BUTTON_UP)
|
|
|
|
#define CUBE_Z_DEC (BUTTON_MENU | BUTTON_DOWN)
|
|
|
|
#define CUBE_HIGHSPEED_PRE BUTTON_MENU
|
|
|
|
#define CUBE_HIGHSPEED (BUTTON_MENU | BUTTON_REL)
|
|
|
|
|
2005-02-04 12:41:09 +00:00
|
|
|
#elif CONFIG_KEYPAD == IRIVER_H100_PAD
|
|
|
|
#define CUBE_QUIT (BUTTON_OFF | BUTTON_REL)
|
|
|
|
#define CUBE_X_INC BUTTON_RIGHT
|
|
|
|
#define CUBE_X_DEC BUTTON_LEFT
|
|
|
|
#define CUBE_Y_INC BUTTON_UP
|
|
|
|
#define CUBE_Y_DEC BUTTON_DOWN
|
|
|
|
#define CUBE_Z_INC (BUTTON_ON | BUTTON_UP)
|
|
|
|
#define CUBE_Z_DEC (BUTTON_ON | BUTTON_DOWN)
|
|
|
|
#define CUBE_HIGHSPEED_PRE BUTTON_SELECT
|
|
|
|
#define CUBE_HIGHSPEED (BUTTON_SELECT | BUTTON_REL)
|
|
|
|
|
2004-10-17 00:54:09 +00:00
|
|
|
#endif
|
|
|
|
|
2002-10-29 10:45:29 +00:00
|
|
|
struct point_3D {
|
|
|
|
long x, y, z;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct point_2D {
|
|
|
|
long x, y;
|
|
|
|
};
|
2002-10-15 07:17:50 +00:00
|
|
|
|
2002-10-29 10:45:29 +00:00
|
|
|
static struct point_3D sommet[8];
|
|
|
|
static struct point_3D point3D[8];
|
|
|
|
static struct point_2D point2D[8];
|
2002-10-15 07:17:50 +00:00
|
|
|
|
2002-10-29 10:45:29 +00:00
|
|
|
static long matrice[3][3];
|
2002-10-15 07:17:50 +00:00
|
|
|
|
2002-10-29 10:45:29 +00:00
|
|
|
static int nb_points = 8;
|
2002-10-15 07:17:50 +00:00
|
|
|
|
2005-02-10 21:28:21 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2005-02-08 22:48:53 +00:00
|
|
|
static int x_off = LCD_WIDTH/2;
|
|
|
|
static int y_off = LCD_HEIGHT/2;
|
2005-02-10 21:28:21 +00:00
|
|
|
#else
|
|
|
|
static int x_off = 10;
|
|
|
|
static int y_off = 7;
|
|
|
|
#endif
|
2002-10-29 10:45:29 +00:00
|
|
|
static int z_off = 600;
|
2002-10-15 07:17:50 +00:00
|
|
|
|
|
|
|
/* Precalculated sine and cosine * 10000 (four digit fixed point math) */
|
2002-10-29 10:45:29 +00:00
|
|
|
static int sin_table[91] =
|
2002-10-15 07:17:50 +00:00
|
|
|
{
|
|
|
|
0, 174, 348, 523, 697,
|
|
|
|
871,1045,1218,1391,1564,
|
|
|
|
1736,1908,2079,2249,2419,
|
|
|
|
2588,2756,2923,3090,3255,
|
|
|
|
3420,3583,3746,3907,4067,
|
|
|
|
4226,4383,4539,4694,4848,
|
|
|
|
5000,5150,5299,5446,5591,
|
|
|
|
5735,5877,6018,6156,6293,
|
|
|
|
6427,6560,6691,6819,6946,
|
|
|
|
7071,7193,7313,7431,7547,
|
|
|
|
7660,7771,7880,7986,8090,
|
|
|
|
8191,8290,8386,8480,8571,
|
|
|
|
8660,8746,8829,8910,8987,
|
|
|
|
9063,9135,9205,9271,9335,
|
|
|
|
9396,9455,9510,9563,9612,
|
|
|
|
9659,9702,9743,9781,9816,
|
|
|
|
9848,9876,9902,9925,9945,
|
|
|
|
9961,9975,9986,9993,9998,
|
|
|
|
10000
|
|
|
|
};
|
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
static struct plugin_api* rb;
|
|
|
|
|
2002-10-29 10:45:29 +00:00
|
|
|
static long sin(int val)
|
2002-10-15 07:17:50 +00:00
|
|
|
{
|
|
|
|
/* Speed improvement through sukzessive lookup */
|
|
|
|
if (val<181)
|
|
|
|
{
|
2002-10-29 10:45:29 +00:00
|
|
|
if (val<91)
|
2002-10-15 07:17:50 +00:00
|
|
|
{
|
2002-10-29 10:45:29 +00:00
|
|
|
/* phase 0-90 degree */
|
|
|
|
return (long)sin_table[val];
|
2002-10-15 07:17:50 +00:00
|
|
|
}
|
2002-10-29 10:45:29 +00:00
|
|
|
else
|
2002-10-15 07:17:50 +00:00
|
|
|
{
|
2002-10-29 10:45:29 +00:00
|
|
|
/* phase 91-180 degree */
|
|
|
|
return (long)sin_table[180-val];
|
2002-10-15 07:17:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-10-29 10:45:29 +00:00
|
|
|
if (val<271)
|
2002-10-15 07:17:50 +00:00
|
|
|
{
|
2002-10-29 10:45:29 +00:00
|
|
|
/* phase 181-270 degree */
|
|
|
|
return (-1L)*(long)sin_table[val-180];
|
2002-10-15 07:17:50 +00:00
|
|
|
}
|
2002-10-29 10:45:29 +00:00
|
|
|
else
|
2002-10-15 07:17:50 +00:00
|
|
|
{
|
2002-10-29 10:45:29 +00:00
|
|
|
/* phase 270-359 degree */
|
|
|
|
return (-1L)*(long)sin_table[360-val];
|
2002-10-15 07:17:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-10-29 10:45:29 +00:00
|
|
|
static long cos(int val)
|
2002-10-15 07:17:50 +00:00
|
|
|
{
|
|
|
|
/* Speed improvement through sukzessive lookup */
|
|
|
|
if (val<181)
|
|
|
|
{
|
2002-10-29 10:45:29 +00:00
|
|
|
if (val<91)
|
2002-10-15 07:17:50 +00:00
|
|
|
{
|
2002-10-29 10:45:29 +00:00
|
|
|
/* phase 0-90 degree */
|
|
|
|
return (long)sin_table[90-val];
|
2002-10-15 07:17:50 +00:00
|
|
|
}
|
2002-10-29 10:45:29 +00:00
|
|
|
else
|
2002-10-15 07:17:50 +00:00
|
|
|
{
|
2002-10-29 10:45:29 +00:00
|
|
|
/* phase 91-180 degree */
|
|
|
|
return (-1L)*(long)sin_table[val-90];
|
2002-10-15 07:17:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-10-29 10:45:29 +00:00
|
|
|
if (val<271)
|
2002-10-15 07:17:50 +00:00
|
|
|
{
|
2002-10-29 10:45:29 +00:00
|
|
|
/* phase 181-270 degree */
|
|
|
|
return (-1L)*(long)sin_table[270-val];
|
2002-10-15 07:17:50 +00:00
|
|
|
}
|
2002-10-29 10:45:29 +00:00
|
|
|
else
|
2002-10-15 07:17:50 +00:00
|
|
|
{
|
2002-10-29 10:45:29 +00:00
|
|
|
/* phase 270-359 degree */
|
|
|
|
return (long)sin_table[val-270];
|
2002-10-15 07:17:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-10-29 10:45:29 +00:00
|
|
|
static void cube_rotate(int xa, int ya, int za)
|
2002-10-15 07:17:50 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* Just to prevent unnecessary lookups */
|
|
|
|
long sxa,cxa,sya,cya,sza,cza;
|
2002-10-29 10:45:29 +00:00
|
|
|
sxa=sin(xa);
|
|
|
|
cxa=cos(xa);
|
|
|
|
sya=sin(ya);
|
|
|
|
cya=cos(ya);
|
|
|
|
sza=sin(za);
|
|
|
|
cza=cos(za);
|
2002-10-15 07:17:50 +00:00
|
|
|
|
|
|
|
/* calculate overall translation matrix */
|
|
|
|
matrice[0][0] = cza*cya/10000L;
|
|
|
|
matrice[1][0] = sza*cya/10000L;
|
|
|
|
matrice[2][0] = -sya;
|
|
|
|
|
|
|
|
matrice[0][1] = cza*sya/10000L*sxa/10000L - sza*cxa/10000L;
|
|
|
|
matrice[1][1] = sza*sya/10000L*sxa/10000L + cxa*cza/10000L;
|
|
|
|
matrice[2][1] = sxa*cya/10000L;
|
|
|
|
|
|
|
|
matrice[0][2] = cza*sya/10000L*cxa/10000L + sza*sxa/10000L;
|
|
|
|
matrice[1][2] = sza*sya/10000L*cxa/10000L - cza*sxa/10000L;
|
|
|
|
matrice[2][2] = cxa*cya/10000L;
|
|
|
|
|
|
|
|
/* apply translation matrix to all points */
|
2002-10-29 10:45:29 +00:00
|
|
|
for(i=0;i<nb_points;i++)
|
2002-10-15 07:17:50 +00:00
|
|
|
{
|
2002-10-29 10:45:29 +00:00
|
|
|
point3D[i].x = matrice[0][0]*sommet[i].x + matrice[1][0]*sommet[i].y
|
|
|
|
+ matrice[2][0]*sommet[i].z;
|
|
|
|
|
|
|
|
point3D[i].y = matrice[0][1]*sommet[i].x + matrice[1][1]*sommet[i].y
|
|
|
|
+ matrice[2][1]*sommet[i].z;
|
|
|
|
|
|
|
|
point3D[i].z = matrice[0][2]*sommet[i].x + matrice[1][2]*sommet[i].y
|
|
|
|
+ matrice[2][2]*sommet[i].z;
|
2002-10-15 07:17:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void cube_viewport(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* Do viewport transformation for all points */
|
2002-10-29 10:45:29 +00:00
|
|
|
for(i=0;i<nb_points;i++)
|
2002-10-15 07:17:50 +00:00
|
|
|
{
|
2002-10-29 10:45:29 +00:00
|
|
|
point2D[i].x=(((point3D[i].x)<<8)/10000L)/
|
|
|
|
(point3D[i].z/10000L+z_off)+x_off;
|
|
|
|
point2D[i].y=(((point3D[i].y)<<8)/10000L)/
|
|
|
|
(point3D[i].z/10000L+z_off)+y_off;
|
2002-10-15 07:17:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-02-10 21:28:21 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
#define DIST (10*LCD_HEIGHT/16)
|
2005-02-08 22:48:53 +00:00
|
|
|
#else
|
2005-02-10 21:28:21 +00:00
|
|
|
#define DIST 9
|
2005-02-08 22:48:53 +00:00
|
|
|
#endif
|
|
|
|
|
2002-10-15 07:17:50 +00:00
|
|
|
static void cube_init(void)
|
|
|
|
{
|
|
|
|
/* Original 3D-position of cube's corners */
|
2005-02-08 22:48:53 +00:00
|
|
|
sommet[0].x = -DIST; sommet[0].y = -DIST; sommet[0].z = -DIST;
|
|
|
|
sommet[1].x = DIST; sommet[1].y = -DIST; sommet[1].z = -DIST;
|
|
|
|
sommet[2].x = DIST; sommet[2].y = DIST; sommet[2].z = -DIST;
|
|
|
|
sommet[3].x = -DIST; sommet[3].y = DIST; sommet[3].z = -DIST;
|
|
|
|
sommet[4].x = DIST; sommet[4].y = -DIST; sommet[4].z = DIST;
|
|
|
|
sommet[5].x = -DIST; sommet[5].y = -DIST; sommet[5].z = DIST;
|
|
|
|
sommet[6].x = -DIST; sommet[6].y = DIST; sommet[6].z = DIST;
|
|
|
|
sommet[7].x = DIST; sommet[7].y = DIST; sommet[7].z = DIST;
|
2002-10-15 07:17:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void line(int a, int b)
|
|
|
|
{
|
2005-02-10 21:28:21 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2003-06-29 16:33:04 +00:00
|
|
|
rb->lcd_drawline(point2D[a].x, point2D[a].y, point2D[b].x, point2D[b].y);
|
2005-02-10 21:28:21 +00:00
|
|
|
#else
|
|
|
|
pgfx_drawline(point2D[a].x, point2D[a].y, point2D[b].x, point2D[b].y);
|
|
|
|
#endif
|
2002-10-15 07:17:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void cube_draw(void)
|
|
|
|
{
|
|
|
|
/* Draws front face */
|
|
|
|
line(0,1); line(1,2);
|
|
|
|
line(2,3); line(3,0);
|
|
|
|
|
|
|
|
/* Draws rear face */
|
|
|
|
line(4,5); line(5,6);
|
|
|
|
line(6,7); line(7,4);
|
|
|
|
|
|
|
|
/* Draws the other edges */
|
|
|
|
line(0,5);
|
|
|
|
line(1,4);
|
|
|
|
line(2,7);
|
|
|
|
line(3,6);
|
|
|
|
}
|
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
|
|
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
2002-10-15 07:17:50 +00:00
|
|
|
{
|
|
|
|
int t_disp=0;
|
|
|
|
char buffer[30];
|
|
|
|
|
2004-10-17 00:54:09 +00:00
|
|
|
int button;
|
|
|
|
int lastbutton=0;
|
2002-10-15 07:17:50 +00:00
|
|
|
int xa=0;
|
|
|
|
int ya=0;
|
|
|
|
int za=0;
|
|
|
|
int xs=1;
|
|
|
|
int ys=3;
|
|
|
|
int zs=1;
|
|
|
|
bool highspeed=0;
|
|
|
|
bool exit=0;
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
|
|
TEST_PLUGIN_API(api);
|
|
|
|
(void)(parameter);
|
|
|
|
rb = api;
|
|
|
|
|
2005-02-10 21:28:21 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2003-06-29 16:33:04 +00:00
|
|
|
rb->lcd_setfont(FONT_SYSFIXED);
|
2005-02-10 21:28:21 +00:00
|
|
|
#else
|
|
|
|
if (!pgfx_init(rb, 4, 2))
|
|
|
|
{
|
|
|
|
rb->splash(HZ*2, true, "Old LCD :(");
|
|
|
|
return PLUGIN_OK;
|
|
|
|
}
|
2005-02-11 19:38:14 +00:00
|
|
|
pgfx_display(3, 0);
|
2005-02-10 21:28:21 +00:00
|
|
|
#endif
|
2002-10-29 10:45:29 +00:00
|
|
|
|
2002-10-15 07:17:50 +00:00
|
|
|
cube_init();
|
|
|
|
|
|
|
|
while(!exit)
|
|
|
|
{
|
2003-12-23 22:24:48 +00:00
|
|
|
if (highspeed)
|
|
|
|
rb->yield();
|
|
|
|
else
|
2003-06-29 16:33:04 +00:00
|
|
|
rb->sleep(4);
|
2005-02-10 21:28:21 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2003-06-29 16:33:04 +00:00
|
|
|
rb->lcd_clear_display();
|
2005-02-10 21:28:21 +00:00
|
|
|
#else
|
|
|
|
pgfx_clear_display();
|
|
|
|
#endif
|
2002-10-15 07:17:50 +00:00
|
|
|
cube_rotate(xa,ya,za);
|
|
|
|
cube_viewport();
|
|
|
|
cube_draw();
|
2005-02-10 21:28:21 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2002-10-15 07:17:50 +00:00
|
|
|
if (t_disp>0)
|
|
|
|
{
|
|
|
|
t_disp--;
|
2005-02-11 19:38:14 +00:00
|
|
|
rb->snprintf(buffer, sizeof(buffer), "x:%d y:%d z:%d h:%d",
|
|
|
|
xs, ys, zs, highspeed);
|
2005-02-09 00:36:55 +00:00
|
|
|
rb->lcd_putsxy(0, LCD_HEIGHT-8, buffer);
|
2002-10-29 10:45:29 +00:00
|
|
|
}
|
2003-06-29 16:33:04 +00:00
|
|
|
rb->lcd_update();
|
2005-02-10 21:28:21 +00:00
|
|
|
#else
|
|
|
|
if (t_disp>0)
|
|
|
|
{
|
2005-02-10 21:45:21 +00:00
|
|
|
if (t_disp == DISP_TIME)
|
|
|
|
{
|
2005-02-11 19:38:14 +00:00
|
|
|
rb->snprintf(buffer, sizeof(buffer), "x%d", xs);
|
2005-02-10 21:45:21 +00:00
|
|
|
rb->lcd_puts(0, 0, buffer);
|
2005-02-11 19:38:14 +00:00
|
|
|
rb->snprintf(buffer, sizeof(buffer), "y%d", ys);
|
2005-02-10 21:45:21 +00:00
|
|
|
rb->lcd_puts(0, 1, buffer);
|
2005-02-11 19:38:14 +00:00
|
|
|
pgfx_display(3, 0);
|
|
|
|
rb->snprintf(buffer, sizeof(buffer), "z%d", zs);
|
|
|
|
rb->lcd_puts(8, 0, buffer);
|
|
|
|
rb->snprintf(buffer, sizeof(buffer), "h%d", highspeed);
|
2005-02-10 21:45:21 +00:00
|
|
|
rb->lcd_puts(8, 1, buffer);
|
|
|
|
}
|
2005-02-10 21:28:21 +00:00
|
|
|
t_disp--;
|
2005-02-10 21:45:21 +00:00
|
|
|
if (t_disp == 0)
|
|
|
|
{
|
2005-02-11 19:38:14 +00:00
|
|
|
rb->lcd_clear_display();
|
|
|
|
pgfx_display(3, 0);
|
2005-02-10 21:45:21 +00:00
|
|
|
}
|
2005-02-10 21:28:21 +00:00
|
|
|
}
|
2005-02-11 19:38:14 +00:00
|
|
|
pgfx_update();
|
2005-02-10 21:28:21 +00:00
|
|
|
#endif
|
2005-02-09 00:36:55 +00:00
|
|
|
|
2002-10-15 07:17:50 +00:00
|
|
|
xa+=xs;
|
|
|
|
if (xa>359)
|
|
|
|
xa-=360;
|
|
|
|
if (xa<0)
|
|
|
|
xa+=360;
|
|
|
|
ya+=ys;
|
|
|
|
if (ya>359)
|
|
|
|
ya-=360;
|
|
|
|
if (ya<0)
|
|
|
|
ya+=360;
|
|
|
|
za+=zs;
|
|
|
|
if (za>359)
|
|
|
|
za-=360;
|
|
|
|
if (za<0)
|
|
|
|
za+=360;
|
|
|
|
|
2004-10-17 00:54:09 +00:00
|
|
|
button = rb->button_get(false);
|
|
|
|
switch(button)
|
2002-10-15 07:17:50 +00:00
|
|
|
{
|
2004-10-17 00:54:09 +00:00
|
|
|
case CUBE_X_INC:
|
2002-10-15 07:17:50 +00:00
|
|
|
xs+=1;
|
|
|
|
if (xs>10)
|
|
|
|
xs=10;
|
|
|
|
t_disp=DISP_TIME;
|
|
|
|
break;
|
2004-10-17 00:54:09 +00:00
|
|
|
case CUBE_X_DEC:
|
2002-10-15 07:17:50 +00:00
|
|
|
xs-=1;
|
|
|
|
if (xs<-10)
|
|
|
|
xs=-10;
|
|
|
|
t_disp=DISP_TIME;
|
|
|
|
break;
|
2004-10-17 00:54:09 +00:00
|
|
|
case CUBE_Y_INC:
|
2002-10-15 07:17:50 +00:00
|
|
|
ys+=1;
|
|
|
|
if (ys>10)
|
|
|
|
ys=10;
|
|
|
|
t_disp=DISP_TIME;
|
|
|
|
break;
|
2004-10-17 00:54:09 +00:00
|
|
|
case CUBE_Y_DEC:
|
2002-10-15 07:17:50 +00:00
|
|
|
ys-=1;
|
|
|
|
if (ys<-10)
|
|
|
|
ys=-10;
|
|
|
|
t_disp=DISP_TIME;
|
|
|
|
break;
|
2004-10-17 00:54:09 +00:00
|
|
|
case CUBE_Z_INC:
|
2002-10-15 07:17:50 +00:00
|
|
|
zs+=1;
|
|
|
|
if (zs>10)
|
|
|
|
zs=10;
|
|
|
|
t_disp=DISP_TIME;
|
|
|
|
break;
|
2004-10-17 00:54:09 +00:00
|
|
|
case CUBE_Z_DEC:
|
2002-10-15 07:17:50 +00:00
|
|
|
zs-=1;
|
|
|
|
if (zs<-10)
|
|
|
|
zs=-10;
|
|
|
|
t_disp=DISP_TIME;
|
|
|
|
break;
|
2004-10-17 00:54:09 +00:00
|
|
|
case CUBE_HIGHSPEED:
|
|
|
|
#ifdef CUBE_HIGHSPEED_PRE
|
|
|
|
if (lastbutton!=CUBE_HIGHSPEED_PRE)
|
|
|
|
break;
|
|
|
|
#endif
|
2002-10-15 07:17:50 +00:00
|
|
|
highspeed=!highspeed;
|
|
|
|
t_disp=DISP_TIME;
|
|
|
|
break;
|
2004-10-17 00:54:09 +00:00
|
|
|
case CUBE_QUIT:
|
2002-10-15 07:17:50 +00:00
|
|
|
exit=1;
|
|
|
|
break;
|
2002-10-22 20:13:40 +00:00
|
|
|
|
2004-10-17 00:54:09 +00:00
|
|
|
default:
|
|
|
|
if(rb->default_event_handler(button) == SYS_USB_CONNECTED)
|
2005-02-11 19:38:14 +00:00
|
|
|
{
|
|
|
|
#ifdef HAVE_LCD_CHARCELLS
|
|
|
|
pgfx_release();
|
|
|
|
#endif
|
2004-10-17 00:54:09 +00:00
|
|
|
return PLUGIN_USB_CONNECTED;
|
2005-02-11 19:38:14 +00:00
|
|
|
}
|
2004-10-17 00:54:09 +00:00
|
|
|
break;
|
2002-10-15 07:17:50 +00:00
|
|
|
}
|
2004-10-17 00:54:09 +00:00
|
|
|
if (button!=BUTTON_NONE)
|
|
|
|
lastbutton=button;
|
2002-10-15 07:17:50 +00:00
|
|
|
}
|
2005-02-10 21:28:21 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LCD_CHARCELLS
|
|
|
|
pgfx_release();
|
|
|
|
#endif
|
2002-10-29 10:45:29 +00:00
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
return PLUGIN_OK;
|
2002-10-15 07:17:50 +00:00
|
|
|
}
|
|
|
|
|