summaryrefslogtreecommitdiff
path: root/Pad.cpp
diff options
context:
space:
mode:
authorXaviDCR92 <xavi.dcr@gmail.com>2017-03-12 21:09:29 +0100
committerXaviDCR92 <xavi.dcr@gmail.com>2017-03-12 21:09:29 +0100
commit6628e7de58425b3e93da9ae6fcb7347137d96096 (patch)
tree336d1f74961187aad7c85ba06dcdd0684c003282 /Pad.cpp
parentf416816883545433ea33ca410983371e657dba18 (diff)
* Player can now select nearest unit or building. Multiple buildings and units can be selected at the same time.
* Unit module moved from C++ to C (only extension change - and compiler - was needed). * GfxGetHeightFromSpriteData and GfxGetWidthFromSpriteData were getting incorrect data! Incorrect memory address was being read when calling pgm_read_byte, and caused unexpected behaviour under real hw.
Diffstat (limited to 'Pad.cpp')
-rw-r--r--Pad.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/Pad.cpp b/Pad.cpp
index bb2a0ab..15a9092 100644
--- a/Pad.cpp
+++ b/Pad.cpp
@@ -19,7 +19,12 @@ bool PadButtonReleased(PAD_BUTTONS btn)
bool PadButtonPressed(PAD_BUTTONS btn)
{
- return gb.buttons.timeHeld(btn) > 0;
+ return PadButtonPressedFrames(btn, 0);
+}
+
+bool PadButtonPressedFrames(PAD_BUTTONS btn, uint8_t frames)
+{
+ return gb.buttons.timeHeld(btn) > frames;
}
bool PadDirectionKeyPressed(void)