summaryrefslogtreecommitdiff
path: root/Pad.cpp
diff options
context:
space:
mode:
authorXaviDCR92 <xavi.dcr@gmail.com>2017-03-07 20:57:09 +0100
committerXaviDCR92 <xavi.dcr@gmail.com>2017-03-07 20:57:09 +0100
commit8ec41b4410aba535008daf991ea59a8740951d44 (patch)
tree01ee0846f579d9d139ee46a6a43f67ba522c7196 /Pad.cpp
+ Initial commit. Added source, sprites and final executable.
Diffstat (limited to 'Pad.cpp')
-rw-r--r--Pad.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/Pad.cpp b/Pad.cpp
new file mode 100644
index 0000000..bb2a0ab
--- /dev/null
+++ b/Pad.cpp
@@ -0,0 +1,43 @@
+/* *************************************
+ * Includes
+ * *************************************/
+
+#include "Pad.h"
+
+/* *************************************
+ * Defines
+ * *************************************/
+
+/* *************************************
+ * Structs and enums
+ * *************************************/
+
+bool PadButtonReleased(PAD_BUTTONS btn)
+{
+ return gb.buttons.released(btn);
+}
+
+bool PadButtonPressed(PAD_BUTTONS btn)
+{
+ return gb.buttons.timeHeld(btn) > 0;
+}
+
+bool PadDirectionKeyPressed(void)
+{
+ return ( PadButtonPressed(PAD_UP)
+ ||
+ PadButtonPressed(PAD_DOWN)
+ ||
+ PadButtonPressed(PAD_LEFT)
+ ||
+ PadButtonPressed(PAD_RIGHT) );
+}
+
+bool PadAnyKeyPressed(void)
+{
+ return ( (PadDirectionKeyPressed() == true)
+ ||
+ (PadButtonPressed(PAD_A) == true)
+ ||
+ (PadButtonPressed(PAD_B) == true) );
+}