summaryrefslogtreecommitdiff
path: root/apps/plugins/xracer/compat.h
diff options
context:
space:
mode:
authorFranklin Wei <frankhwei536@gmail.com>2015-01-07 16:40:33 -0500
committerFranklin Wei <franklin@fwei.ml>2015-06-13 19:44:59 -0400
commitb9fb85845715d81f50d8fd6bf523982b339d26e7 (patch)
tree032516d8ef26dcb67beee3b6c5a8459ebee941eb /apps/plugins/xracer/compat.h
parent8aa72f07f4bf38e9b898fb8d8042239861b9a423 (diff)
downloadrockbox-xracer.zip
rockbox-xracer.tar.gz
rockbox-xracer.tar.bz2
rockbox-xracer.tar.xz
[WIP] XRacer - a racing gamexracer
Plan: ----- A simple racing game like Pole Position or Enduro. Status: ------- - Currently generates a random road and scrolls through it - Random road generation (curves and hills) - Supports loading of maps from a file ("/output.xrm") - Sample map at http://a.pomf.se/ynhlwq.xrm Todo: ----- - Convert to fixed-point math in all places (only one place left!) - Improve/fix track looping - Improve random road generation to start and end at the same height - Finish sprite code - Make sprites - Game-ify! What's new: ----------- - NEW: uses greylib on low-depth targets! - Loadable maps implemented, UNTESTED! - Sprites in progress (see render() in graphics.c) Change-Id: Ia2ff60b3c43d9f2e3a4f63e0ad90d2cb571c605e
Diffstat (limited to 'apps/plugins/xracer/compat.h')
-rw-r--r--apps/plugins/xracer/compat.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/apps/plugins/xracer/compat.h b/apps/plugins/xracer/compat.h
new file mode 100644
index 0000000..f4507d5
--- /dev/null
+++ b/apps/plugins/xracer/compat.h
@@ -0,0 +1,61 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2015 Franklin Wei
+ *
+ * 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.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+
+#if (LCD_DEPTH < 4)
+#include "lib/grey.h"
+#else
+#include "lib/xlcd.h"
+#endif
+
+/* this file contains some #defines to make this as platform-neutral as possible */
+#if (LCD_DEPTH < 4)
+/* greylib API */
+
+#define FILL_TRI(x1, y1, x2, y2, x3, y3) grey_filltriangle(x1, y1, x2, y2, x3, y3)
+#define FILL_RECT(x, y, w, h) grey_fillrect(x, y, w, h)
+#define DRAW_HLINE(x1, x2, y) grey_hline(x1, x2, y)
+#define LCD_RGBPACK(r, g, b) GREY_BRIGHTNESS(((r+g+b)/3))
+#define CLEAR_DISPLAY() grey_clear_display()
+#define SET_FOREGROUND(x) grey_set_foreground(x)
+#define SET_BACKGROUND(x) grey_set_background(x)
+#undef LCD_BLACK
+#undef LCD_WHITE
+#define LCD_BLACK GREY_BLACK
+#define LCD_WHITE GREY_WHITE
+#define LCD_UPDATE() grey_update()
+#define PUTSXY(x, y, s) grey_putsxy(x, y, s)
+#define RGB_UNPACK_RED(x) (x)
+#define RGB_UNPACK_GREEN(x) (x)
+#define RGB_UNPACK_BLUE(x) (x)
+
+#else
+/* rockbox API */
+
+#define FILL_TRI(x1, y1, x2, y2, x3, y3) xlcd_filltriangle(x1, y1, x2, y2, x3, y3)
+#define FILL_RECT(x, y, w, h) rb->lcd_fillrect(x, y, w, h)
+#define DRAW_HLINE(x1, x2, y) rb->lcd_hline(x1, x2, y)
+#define CLEAR_DISPLAY() rb->lcd_clear_display()
+#define SET_FOREGROUND(x) rb->lcd_set_foreground(x)
+#define SET_BACKGROUND(x) rb->lcd_set_background(x)
+#define LCD_UPDATE() rb->lcd_update()
+#define PUTSXY(x, y, s) rb->lcd_putsxy(x, y, s)
+
+#endif