* Add support for the input buffer
This commit is contained in:
jean.chalard
2008-11-21 13:20:16 +00:00
parent 31a2202036
commit 03e8d636fc
+24 -1
View File
@@ -491,6 +491,27 @@ actualHeight = height;
return TRUE; // Success
}
u32 JGEReadKey()
{
if (gKeyBuffer.empty()) return 0;
u32 val = gKeyBuffer.front().first;
gKeyBuffer.pop();
return val;
}
u32 JGEReadLocalKey()
{
if (gKeyBuffer.empty()) return 0;
u32 val = gKeyBuffer.front().second;
gKeyBuffer.pop();
return val;
}
void JGEResetInput()
{
while (!gKeyBuffer.empty()) gKeyBuffer.pop();
}
LRESULT CALLBACK WndProc( HWND hWnd, // Handle For This Window
UINT uMsg, // Message For This Window
WPARAM wParam, // Additional Message Information
@@ -537,7 +558,9 @@ LRESULT CALLBACK WndProc( HWND hWnd, // Handle For This Window
if ((wParam >= 0) && (wParam <= 255)) // Is Key (wParam) In A Valid Range?
{
g_keys[wParam] = TRUE; // Set The Selected Key (wParam) To True
return 0; // Return
for (signed int i = sizeof(gWinKeyCodes)/sizeof(gWinKeyCodes[0]); i > 0; --i)
if (gWinKeyCodes[i] == wParam) { gKeyBuffer.push(make_pair(gPSPKeyMasks[i],0x8000+key)); return 0; }
return 0;
}
break; // Break