summaryrefslogtreecommitdiffstats
path: root/apps/plugins/rockboy/sys_rockbox.c
diff options
context:
space:
mode:
authorMichael Stummvoll <michael@stummi.org>2010-11-28 19:49:15 +0000
committerMichael Stummvoll <michael@stummi.org>2010-11-28 19:49:15 +0000
commita0480c734aa30ab00e877dc33daac30ed484cd99 (patch)
tree929101658f49b95a1ade3d2dbeea3bbaf46eda51 /apps/plugins/rockboy/sys_rockbox.c
parent418b7d4d78d6f4429584b8d1f3a54346e6f91ebe (diff)
downloadrockbox-a0480c734aa30ab00e877dc33daac30ed484cd99.tar.gz
rockbox-a0480c734aa30ab00e877dc33daac30ed484cd99.tar.bz2
rockbox-a0480c734aa30ab00e877dc33daac30ed484cd99.zip
applying FS#10489: Rockboy - rotate directional keys when screen is rotated
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28695 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/rockboy/sys_rockbox.c')
-rw-r--r--apps/plugins/rockboy/sys_rockbox.c62
1 files changed, 55 insertions, 7 deletions
diff --git a/apps/plugins/rockboy/sys_rockbox.c b/apps/plugins/rockboy/sys_rockbox.c
index 0bed7f8de6..faba95ea68 100644
--- a/apps/plugins/rockboy/sys_rockbox.c
+++ b/apps/plugins/rockboy/sys_rockbox.c
@@ -134,10 +134,34 @@ void ev_poll(void)
#else
if(released) {
ev.type = EV_RELEASE;
- if(released & options.LEFT) { ev.code=PAD_LEFT; ev_postevent(&ev); }
+#ifdef HAVE_LCD_COLOR
+ if (options.rotate == 1) /* if screen is rotated, rotate direction keys */
+ {
+ if(released & options.LEFT) {ev.code=PAD_DOWN; ev_postevent(&ev);}
+ if(released & options.RIGHT) {ev.code=PAD_UP; ev_postevent(&ev);}
+ if(released & options.DOWN) {ev.code=PAD_RIGHT; ev_postevent(&ev);}
+ if(released & options.UP) {ev.code=PAD_LEFT; ev_postevent(&ev);}
+ }
+ else if (options.rotate == 2) /* if screen is rotated, rotate direction keys */
+ {
+ if(released & options.LEFT) {ev.code=PAD_UP; ev_postevent(&ev);}
+ if(released & options.RIGHT) {ev.code=PAD_DOWN; ev_postevent(&ev);}
+ if(released & options.DOWN) {ev.code=PAD_LEFT; ev_postevent(&ev);}
+ if(released & options.UP) {ev.code=PAD_RIGHT; ev_postevent(&ev);}
+ }
+ else /* screen is not rotated, do not rotate direction keys */
+ {
+ if(released & options.LEFT) {ev.code=PAD_LEFT; ev_postevent(&ev);}
+ if(released & options.RIGHT) {ev.code=PAD_RIGHT; ev_postevent(&ev);}
+ if(released & options.DOWN) {ev.code=PAD_DOWN; ev_postevent(&ev);}
+ if(released & options.UP) {ev.code=PAD_UP; ev_postevent(&ev);}
+ }
+#else
+ if(released & options.LEFT) {ev.code=PAD_LEFT; ev_postevent(&ev);}
if(released & options.RIGHT) {ev.code=PAD_RIGHT; ev_postevent(&ev);}
- if(released & options.DOWN) { ev.code=PAD_DOWN; ev_postevent(&ev); }
- if(released & options.UP) { ev.code=PAD_UP; ev_postevent(&ev); }
+ if(released & options.DOWN) {ev.code=PAD_DOWN; ev_postevent(&ev);}
+ if(released & options.UP) {ev.code=PAD_UP; ev_postevent(&ev);}
+#endif
if(released & options.A) { ev.code=PAD_A; ev_postevent(&ev); }
if(released & options.B) { ev.code=PAD_B; ev_postevent(&ev); }
if(released & options.START) {
@@ -151,10 +175,34 @@ void ev_poll(void)
}
if(pressed) { /* button press */
ev.type = EV_PRESS;
- if(pressed & options.LEFT) { ev.code=PAD_LEFT; ev_postevent(&ev); }
- if(pressed & options.RIGHT) { ev.code=PAD_RIGHT; ev_postevent(&ev);}
- if(pressed & options.DOWN) { ev.code=PAD_DOWN; ev_postevent(&ev); }
- if(pressed & options.UP) { ev.code=PAD_UP; ev_postevent(&ev); }
+#ifdef HAVE_LCD_COLOR
+ if (options.rotate == 1) /* if screen is rotated, rotate direction keys */
+ {
+ if(pressed & options.LEFT) {ev.code=PAD_DOWN; ev_postevent(&ev);}
+ if(pressed & options.RIGHT) {ev.code=PAD_UP; ev_postevent(&ev);}
+ if(pressed & options.DOWN) {ev.code=PAD_RIGHT; ev_postevent(&ev);}
+ if(pressed & options.UP) {ev.code=PAD_LEFT; ev_postevent(&ev);}
+ }
+ else if (options.rotate == 2) /* if screen is rotated, rotate direction keys */
+ {
+ if(pressed & options.LEFT) {ev.code=PAD_UP; ev_postevent(&ev);}
+ if(pressed & options.RIGHT) {ev.code=PAD_DOWN; ev_postevent(&ev);}
+ if(pressed & options.DOWN) {ev.code=PAD_LEFT; ev_postevent(&ev);}
+ if(pressed & options.UP) {ev.code=PAD_RIGHT; ev_postevent(&ev);}
+ }
+ else /* screen is not rotated, do not rotate direction keys */
+ {
+ if(pressed & options.LEFT) {ev.code=PAD_LEFT; ev_postevent(&ev);}
+ if(pressed & options.RIGHT) {ev.code=PAD_RIGHT; ev_postevent(&ev);}
+ if(pressed & options.DOWN) {ev.code=PAD_DOWN; ev_postevent(&ev);}
+ if(pressed & options.UP) {ev.code=PAD_UP; ev_postevent(&ev);}
+ }
+#else
+ if(pressed & options.LEFT) {ev.code=PAD_LEFT; ev_postevent(&ev);}
+ if(pressed & options.RIGHT) {ev.code=PAD_RIGHT; ev_postevent(&ev);}
+ if(pressed & options.DOWN) {ev.code=PAD_DOWN; ev_postevent(&ev);}
+ if(pressed & options.UP) {ev.code=PAD_UP; ev_postevent(&ev);}
+#endif
if(pressed & options.A) { ev.code=PAD_A; ev_postevent(&ev); }
if(pressed & options.B) { ev.code=PAD_B; ev_postevent(&ev); }
if(pressed & options.START) {