replace tab to space x4 #1012

This commit is contained in:
ushiostarfish 2019-11-11 23:13:42 +09:00
parent ec813758bb
commit 3f0e32193a

View File

@ -2218,28 +2218,28 @@ int GetKeyPressed(void)
bool IsCharAvailable() bool IsCharAvailable()
{ {
return 0 < inputCharacterQueueCount; return 0 < inputCharacterQueueCount;
} }
unsigned int GetNextChar() unsigned int GetNextChar()
{ {
if (inputCharacterQueueCount <= 0) if (inputCharacterQueueCount <= 0)
{ {
return 0; return 0;
} }
// take a character from the head // take a character from the head
unsigned int c = inputCharacterQueue[0]; unsigned int c = inputCharacterQueue[0];
// shift elements 1 step toward the head. // shift elements 1 step toward the head.
inputCharacterQueueCount--; inputCharacterQueueCount--;
for (int i = 0; i < inputCharacterQueueCount; i++) for (int i = 0; i < inputCharacterQueueCount; i++)
{ {
inputCharacterQueue[i] = inputCharacterQueue[i + 1]; inputCharacterQueue[i] = inputCharacterQueue[i + 1];
} }
// this is not required, but this can keep clean memory // this is not required, but this can keep clean memory
inputCharacterQueue[inputCharacterQueueCount] = 0; inputCharacterQueue[inputCharacterQueueCount] = 0;
return c; return c;
} }
// Set a custom key to exit program // Set a custom key to exit program
@ -3949,15 +3949,15 @@ static void CharCallback(GLFWwindow *window, unsigned int key)
lastKeyPressed = key; lastKeyPressed = key;
// If the capacity over, is will waste the old one. // If the capacity over, is will waste the old one.
static const int CAPACITY = sizeof(inputCharacterQueue) / sizeof(inputCharacterQueue[0]); static const int CAPACITY = sizeof(inputCharacterQueue) / sizeof(inputCharacterQueue[0]);
if (CAPACITY <= inputCharacterQueueCount) if (CAPACITY <= inputCharacterQueueCount)
{ {
GetNextChar(); GetNextChar();
} }
// add to queue // add to queue
inputCharacterQueue[inputCharacterQueueCount++] = key; inputCharacterQueue[inputCharacterQueueCount++] = key;
} }
// GLFW3 CursorEnter Callback, when cursor enters the window // GLFW3 CursorEnter Callback, when cursor enters the window