summaryrefslogtreecommitdiff
path: root/System.cpp
diff options
context:
space:
mode:
authorXaviDCR92 <xavi.dcr@gmail.com>2018-07-09 19:26:13 +0200
committerXaviDCR92 <xavi.dcr@gmail.com>2018-07-09 19:26:13 +0200
commitf0b654b9bf3bc2a93c1f89d4cc3edcf77b948555 (patch)
tree91b7404dca0b6eb136cb7f9b144435419144b777 /System.cpp
parentd85464781580796bbcc744ae732e56d1920e3b0f (diff)
Game has been restructured in favor of OOP
Diffstat (limited to 'System.cpp')
-rw-r--r--System.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/System.cpp b/System.cpp
new file mode 100644
index 0000000..7961512
--- /dev/null
+++ b/System.cpp
@@ -0,0 +1,62 @@
+/* *************************************
+ * Includes
+ * *************************************/
+
+#include <Arduino.h>
+#include <Gamebuino.h>
+
+/* *************************************
+ * Defines
+ * *************************************/
+
+#define mCHECK_COLLISION(x1, y1, w1, h1, x2, y2, w2, h2) \
+ (!( ((x1) >= (x2) + (w2)) \
+ || \
+ ((x2) >= (x1) + (w1)) \
+ || \
+ ((y1) >= (y2) + (h2)) \
+ || \
+ ((y2) >= (y1) + (h1)) )
+
+/* *************************************
+ * Structs and enums
+ * *************************************/
+
+/* *************************************
+ * Global Variables
+ * *************************************/
+
+/*****************************************************************//**
+ *
+ * \brief Global interface to Gamebuino low-level libs.
+ *
+ *********************************************************************/
+Gamebuino gb;
+
+/* *************************************
+ * Local Variables
+ * *************************************/
+
+/* *************************************
+ * Local Prototypes
+ * *************************************/
+
+/*****************************************************************//**
+ *
+ * \brief Initializes the device and game parameters.
+ *
+ *********************************************************************/
+void SystemInit(void)
+{
+ /* Arduino initialization routine. */
+ init();
+
+ /* Initialize Gamebuino libs. */
+ gb.begin();
+
+#ifdef USBCON
+
+ USBDevice.attach();
+
+#endif /* USBCON */
+}