J :
* New try for input
This commit is contained in:
@@ -48,6 +48,7 @@ bool fullscreen=FALSE; // Windowed Mode By Default
|
|||||||
DWORD lastTickCount;
|
DWORD lastTickCount;
|
||||||
|
|
||||||
BOOL g_keys[256];
|
BOOL g_keys[256];
|
||||||
|
BOOL g_holds[256];
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
@@ -226,6 +227,7 @@ int InitGame(GLvoid)
|
|||||||
lastTickCount = GetTickCount();
|
lastTickCount = GetTickCount();
|
||||||
|
|
||||||
ZeroMemory(g_keys, 256);
|
ZeroMemory(g_keys, 256);
|
||||||
|
ZeroMemory(g_holds, 256);
|
||||||
|
|
||||||
//delete launcher;
|
//delete launcher;
|
||||||
|
|
||||||
@@ -520,6 +522,7 @@ u32 JGEReadKey()
|
|||||||
{
|
{
|
||||||
if (gKeyBuffer.empty()) return 0;
|
if (gKeyBuffer.empty()) return 0;
|
||||||
u32 val = gKeyBuffer.front().first;
|
u32 val = gKeyBuffer.front().first;
|
||||||
|
g_holds[val] = false;
|
||||||
gKeyBuffer.pop();
|
gKeyBuffer.pop();
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
@@ -528,6 +531,7 @@ u32 JGEReadLocalKey()
|
|||||||
{
|
{
|
||||||
if (gKeyBuffer.empty()) return 0;
|
if (gKeyBuffer.empty()) return 0;
|
||||||
u32 val = gKeyBuffer.front().second;
|
u32 val = gKeyBuffer.front().second;
|
||||||
|
g_holds[val] = false;
|
||||||
gKeyBuffer.pop();
|
gKeyBuffer.pop();
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
@@ -583,6 +587,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, // Handle For This Window
|
|||||||
if ((wParam >= 0) && (wParam <= 255)) // Is Key (wParam) In A Valid Range?
|
if ((wParam >= 0) && (wParam <= 255)) // Is Key (wParam) In A Valid Range?
|
||||||
{
|
{
|
||||||
g_keys[wParam] = TRUE; // Set The Selected Key (wParam) To True
|
g_keys[wParam] = TRUE; // Set The Selected Key (wParam) To True
|
||||||
|
g_holds[wParam] = TRUE;
|
||||||
for (signed int i = sizeof(gWinKeyCodes)/sizeof(gWinKeyCodes[0]) - 1; i >= 0; --i)
|
for (signed int i = sizeof(gWinKeyCodes)/sizeof(gWinKeyCodes[0]) - 1; i >= 0; --i)
|
||||||
if (gWinKeyCodes[i] == wParam)
|
if (gWinKeyCodes[i] == wParam)
|
||||||
if (false == gThisFrame[i])
|
if (false == gThisFrame[i])
|
||||||
@@ -598,6 +603,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, // Handle For This Window
|
|||||||
if ((wParam >= 0) && (wParam <= 255)) // Is Key (wParam) In A Valid Range?
|
if ((wParam >= 0) && (wParam <= 255)) // Is Key (wParam) In A Valid Range?
|
||||||
{
|
{
|
||||||
g_keys[wParam] = FALSE; // Set The Selected Key (wParam) To False
|
g_keys[wParam] = FALSE; // Set The Selected Key (wParam) To False
|
||||||
|
g_holds[wParam] = FALSE;
|
||||||
return 0; // Return
|
return 0; // Return
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user