summaryrefslogtreecommitdiffstats
path: root/apps/plugins/mosaique.c
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2006-09-21 20:28:06 +0000
committerJens Arnold <amiconn@rockbox.org>2006-09-21 20:28:06 +0000
commit4a037df62dd5286ab3c6e47cc3e03fbe7b831987 (patch)
tree34bdfdd0ab9c025ff9934456d942b7e4c717b693 /apps/plugins/mosaique.c
parent10381032ab0146e90ce7aaf964366b4fe39abcaa (diff)
downloadrockbox-4a037df62dd5286ab3c6e47cc3e03fbe7b831987.tar.gz
rockbox-4a037df62dd5286ab3c6e47cc3e03fbe7b831987.tar.bz2
rockbox-4a037df62dd5286ab3c6e47cc3e03fbe7b831987.zip
Made mosaique less boring on square LCDs.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11022 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/mosaique.c')
-rw-r--r--apps/plugins/mosaique.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/apps/plugins/mosaique.c b/apps/plugins/mosaique.c
index 08cbaef0bd..b951fdc8b3 100644
--- a/apps/plugins/mosaique.c
+++ b/apps/plugins/mosaique.c
@@ -22,13 +22,22 @@
PLUGIN_HEADER
#ifdef HAVE_LCD_BITMAP
-#define LARGE ((LCD_WIDTH - 2) / 2)
-#define HAUT ((LCD_HEIGHT - 2) / 2)
#define MYLCD(fn) rb->lcd_ ## fn
+#define GFX_X (LCD_WIDTH/2-1)
+#define GFX_Y (LCD_HEIGHT/2-1)
+#if LCD_WIDTH != LCD_HEIGHT
+#define GFX_WIDTH GFX_X
+#define GFX_HEIGHT GFX_Y
+#else
+#define GFX_WIDTH GFX_X
+#define GFX_HEIGHT (4*GFX_Y/5)
+#endif
#else
-#define LARGE 9
-#define HAUT 6
#define MYLCD(fn) pgfx_ ## fn
+#define GFX_X 9
+#define GFX_Y 6
+#define GFX_WIDTH 9
+#define GFX_HEIGHT 6
#endif
/* variable button definitions */
@@ -107,9 +116,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
while (1) {
x+=sx;
- if (x>LARGE)
+ if (x>GFX_WIDTH)
{
- x = 2*LARGE-x;
+ x = 2*GFX_WIDTH-x;
sx=-sx;
}
@@ -120,9 +129,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
}
y+=sy;
- if (y>HAUT)
+ if (y>GFX_HEIGHT)
{
- y = 2*HAUT-y;
+ y = 2*GFX_HEIGHT-y;
sy=-sy;
}
@@ -132,10 +141,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
sy = -sy;
}
- MYLCD(fillrect)(LARGE-x, HAUT-y, 2*x+1, 1);
- MYLCD(fillrect)(LARGE-x, HAUT+y, 2*x+1, 1);
- MYLCD(fillrect)(LARGE-x, HAUT-y+1, 1, 2*y-1);
- MYLCD(fillrect)(LARGE+x, HAUT-y+1, 1, 2*y-1);
+ MYLCD(fillrect)(GFX_X-x, GFX_Y-y, 2*x+1, 1);
+ MYLCD(fillrect)(GFX_X-x, GFX_Y+y, 2*x+1, 1);
+ MYLCD(fillrect)(GFX_X-x, GFX_Y-y+1, 1, 2*y-1);
+ MYLCD(fillrect)(GFX_X+x, GFX_Y-y+1, 1, 2*y-1);
MYLCD(update)();
rb->sleep(HZ/timer);
@@ -161,8 +170,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
case MOSAIQUE_RESTART:
- sx = rb->rand() % (HAUT/2) + 1;
- sy = rb->rand() % (HAUT/2) + 1;
+ sx = rb->rand() % (GFX_HEIGHT/2) + 1;
+ sy = rb->rand() % (GFX_HEIGHT/2) + 1;
x=0;
y=0;
MYLCD(clear_display)();