J :
* Release holds when key is released. * Fix a bug that would mark the key pressed instead of released when it's read.
This commit is contained in:
+6
-1
@@ -343,7 +343,7 @@ u32 JGE::ReadButton()
|
|||||||
{
|
{
|
||||||
if (gKeyBuffer.empty()) return 0;
|
if (gKeyBuffer.empty()) return 0;
|
||||||
u32 val = gKeyBuffer.front();
|
u32 val = gKeyBuffer.front();
|
||||||
gHolds &= val;
|
gHolds &= ~val;
|
||||||
gKeyBuffer.pop();
|
gKeyBuffer.pop();
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
@@ -385,6 +385,7 @@ void JGE::Run()
|
|||||||
|
|
||||||
sceCtrlPeekBufferPositive(&mCtrlPad, 1);
|
sceCtrlPeekBufferPositive(&mCtrlPad, 1);
|
||||||
for (signed int i = sizeof(gKeyCodeList)/sizeof(gKeyCodeList[0]) - 1; i >= 0; --i)
|
for (signed int i = sizeof(gKeyCodeList)/sizeof(gKeyCodeList[0]) - 1; i >= 0; --i)
|
||||||
|
{
|
||||||
if (gKeyCodeList[i] & mCtrlPad.Buttons)
|
if (gKeyCodeList[i] & mCtrlPad.Buttons)
|
||||||
{
|
{
|
||||||
if (!(gKeyCodeList[i] & mOldButtons))
|
if (!(gKeyCodeList[i] & mOldButtons))
|
||||||
@@ -399,6 +400,10 @@ void JGE::Run()
|
|||||||
}
|
}
|
||||||
gHolds |= gKeyCodeList[i];
|
gHolds |= gKeyCodeList[i];
|
||||||
}
|
}
|
||||||
|
if (!(gKeyCodeList[i] & mCtrlPad.Buttons))
|
||||||
|
if (!(gKeyCodeList[i] & mOldButtons))
|
||||||
|
gHolds &= ~gKeyCodeList[i];
|
||||||
|
}
|
||||||
mOldButtons = mCtrlPad.Buttons;
|
mOldButtons = mCtrlPad.Buttons;
|
||||||
|
|
||||||
nextInput -= (curr - mLastTime);
|
nextInput -= (curr - mLastTime);
|
||||||
|
|||||||
Reference in New Issue
Block a user