J :
* Some adjustments, code fixes, cleaning
This commit is contained in:
+14
-8
@@ -360,7 +360,7 @@ void initGlut(int* argc, char* argv[])
|
||||
|
||||
void specialKey(int key, int x __attribute__((unused)), int y __attribute((unused)))
|
||||
{
|
||||
for (signed int i = sizeof(gGlutKeyCodes)/sizeof(gGlutKeyCodes[0]); i > 0; --i)
|
||||
for (signed int i = sizeof(gGlutKeyCodes)/sizeof(gGlutKeyCodes[0]) - 1; i > 0; --i)
|
||||
if (gGlutKeyCodes[i] == key)
|
||||
{
|
||||
if (false == gThisFrame[i])
|
||||
@@ -375,14 +375,10 @@ void specialKey(int key, int x __attribute__((unused)), int y __attribute((unuse
|
||||
}
|
||||
void specialUp(int key, int x __attribute__((unused)), int y __attribute((unused)))
|
||||
{
|
||||
for (signed int i = sizeof(gGlutKeyCodes)/sizeof(gGlutKeyCodes[0]); i > 0; --i)
|
||||
for (signed int i = sizeof(gGlutKeyCodes)/sizeof(gGlutKeyCodes[0]) - 1; i > 0; --i)
|
||||
if (gGlutKeyCodes[i] == key)
|
||||
{
|
||||
if (false == gThisFrame[i])
|
||||
{
|
||||
gThisFrame[i] = true;
|
||||
gButtons &= ~gPSPKeyMasks[i];
|
||||
}
|
||||
gButtons &= ~gPSPKeyMasks[i];
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -408,7 +404,17 @@ void normalKey(unsigned char key, int x __attribute__((unused)), int y __attribu
|
||||
}
|
||||
}
|
||||
for (signed int i = sizeof(gNonGlutKeyCodes)/sizeof(gNonGlutKeyCodes[0]); i > 0; --i)
|
||||
if (gNonGlutKeyCodes[i] == key) { gButtons |= gPSPKeyMasks[i]; gKeyPresses |= gPSPKeyMasks[i]; gKeyBuffer.push(make_pair(gPSPKeyMasks[i],key)); return; }
|
||||
if (gNonGlutKeyCodes[i] == key)
|
||||
{
|
||||
if (false == gThisFrame[i])
|
||||
{
|
||||
gThisFrame[i] = true;
|
||||
gButtons |= gPSPKeyMasks[i];
|
||||
gKeyPresses |= gPSPKeyMasks[i];
|
||||
gKeyBuffer.push(make_pair(gPSPKeyMasks[i],key));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
void normalUp(unsigned char key, int x __attribute__((unused)), int y __attribute((unused)))
|
||||
{
|
||||
|
||||
+6
-9
@@ -583,16 +583,13 @@ 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
|
||||
for (signed int i = sizeof(gWinKeyCodes)/sizeof(gWinKeyCodes[0]); i > 0; --i)
|
||||
for (signed int i = sizeof(gWinKeyCodes)/sizeof(gWinKeyCodes[0]) - 1; i > 0; --i)
|
||||
if (gWinKeyCodes[i] == wParam)
|
||||
{
|
||||
if (false == gThisFrame[i])
|
||||
{
|
||||
gThisFrame[i] = true;
|
||||
gKeyBuffer.push(make_pair(gPSPKeyMasks[i],0x8000+wParam));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (false == gThisFrame[i])
|
||||
{
|
||||
gThisFrame[i] = true;
|
||||
gKeyBuffer.push(make_pair(gPSPKeyMasks[i], wParam));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
break; // Break
|
||||
|
||||
Reference in New Issue
Block a user