forked from len0rd/rockbox
Use macros instead of multiple #ifdef to make the code more readable.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6965 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c8ce78aa90
commit
c5bdca9b62
1 changed files with 9 additions and 19 deletions
|
@ -86,12 +86,17 @@ static long matrice[3][3];
|
||||||
static int nb_points = 8;
|
static int nb_points = 8;
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
#define MYLCD(fn) rb->lcd_ ## fn
|
||||||
|
#define DIST (10*LCD_HEIGHT/16)
|
||||||
static int x_off = LCD_WIDTH/2;
|
static int x_off = LCD_WIDTH/2;
|
||||||
static int y_off = LCD_HEIGHT/2;
|
static int y_off = LCD_HEIGHT/2;
|
||||||
#else
|
#else
|
||||||
|
#define MYLCD(fn) pgfx_ ## fn
|
||||||
|
#define DIST 9
|
||||||
static int x_off = 10;
|
static int x_off = 10;
|
||||||
static int y_off = 7;
|
static int y_off = 7;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int z_off = 600;
|
static int z_off = 600;
|
||||||
|
|
||||||
/* Precalculated sine and cosine * 10000 (four digit fixed point math) */
|
/* Precalculated sine and cosine * 10000 (four digit fixed point math) */
|
||||||
|
@ -116,7 +121,7 @@ static int sin_table[91] =
|
||||||
9848,9876,9902,9925,9945,
|
9848,9876,9902,9925,9945,
|
||||||
9961,9975,9986,9993,9998,
|
9961,9975,9986,9993,9998,
|
||||||
10000
|
10000
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct plugin_api* rb;
|
static struct plugin_api* rb;
|
||||||
|
|
||||||
|
@ -239,12 +244,6 @@ static void cube_viewport(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
#define DIST (10*LCD_HEIGHT/16)
|
|
||||||
#else
|
|
||||||
#define DIST 9
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void cube_init(void)
|
static void cube_init(void)
|
||||||
{
|
{
|
||||||
/* Original 3D-position of cube's corners */
|
/* Original 3D-position of cube's corners */
|
||||||
|
@ -260,11 +259,7 @@ static void cube_init(void)
|
||||||
|
|
||||||
static void line(int a, int b)
|
static void line(int a, int b)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LCD_BITMAP
|
MYLCD(drawline)(point2D[a].x, point2D[a].y, point2D[b].x, point2D[b].y);
|
||||||
rb->lcd_drawline(point2D[a].x, point2D[a].y, point2D[b].x, point2D[b].y);
|
|
||||||
#else
|
|
||||||
pgfx_drawline(point2D[a].x, point2D[a].y, point2D[b].x, point2D[b].y);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cube_draw(void)
|
static void cube_draw(void)
|
||||||
|
@ -325,11 +320,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
||||||
else
|
else
|
||||||
rb->sleep(4);
|
rb->sleep(4);
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
MYLCD(clear_display)();
|
||||||
rb->lcd_clear_display();
|
|
||||||
#else
|
|
||||||
pgfx_clear_display();
|
|
||||||
#endif
|
|
||||||
cube_rotate(xa,ya,za);
|
cube_rotate(xa,ya,za);
|
||||||
cube_viewport();
|
cube_viewport();
|
||||||
cube_draw();
|
cube_draw();
|
||||||
|
@ -341,7 +332,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
||||||
xs, ys, zs, highspeed);
|
xs, ys, zs, highspeed);
|
||||||
rb->lcd_putsxy(0, LCD_HEIGHT-8, buffer);
|
rb->lcd_putsxy(0, LCD_HEIGHT-8, buffer);
|
||||||
}
|
}
|
||||||
rb->lcd_update();
|
|
||||||
#else
|
#else
|
||||||
if (t_disp>0)
|
if (t_disp>0)
|
||||||
{
|
{
|
||||||
|
@ -364,8 +354,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
||||||
pgfx_display(3, 0);
|
pgfx_display(3, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pgfx_update();
|
|
||||||
#endif
|
#endif
|
||||||
|
MYLCD(update)();
|
||||||
|
|
||||||
xa+=xs;
|
xa+=xs;
|
||||||
if (xa>359)
|
if (xa>359)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue