diff --git a/src/handmade.cpp b/src/handmade.cpp index 09768e6..c0b2748 100644 --- a/src/handmade.cpp +++ b/src/handmade.cpp @@ -65,10 +65,14 @@ internal void gameUpdateAndRender(GameMemory *memory, GameOffscreenBuffer *video state->blueOffset += (int)(4.0f*controllerInput->stickAvgY); } else { if (controllerInput->stickRight.endedDown) { + state->toneHz = 440 + 128; state->greenOffset -= 4; } else if (controllerInput->stickLeft.endedDown) { + state->toneHz = 440 - 128; state->greenOffset += 4; - } + } else { + state->toneHz = 440; + } if (controllerInput->stickUp.endedDown) { state->blueOffset += 4; } else if (controllerInput->stickDown.endedDown) { diff --git a/src/win32_handmade.cpp b/src/win32_handmade.cpp index 79bdabd..35cb70d 100644 --- a/src/win32_handmade.cpp +++ b/src/win32_handmade.cpp @@ -432,9 +432,9 @@ int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prevInstance, PSTR commandLin win32ProcessPendingMessages(newKeyboardController); XINPUT_STATE controllerState; - int maxControllerCount = 1 + XUSER_MAX_COUNT; - if (maxControllerCount > ArrayCount(newInput->controllers)) { - maxControllerCount = ArrayCount(newInput->controllers); + int maxControllerCount = XUSER_MAX_COUNT; + if (maxControllerCount > ArrayCount(newInput->controllers) - 1) { + maxControllerCount = ArrayCount(newInput->controllers) - 1; } for (DWORD controllerIndex = 0; controllerIndex < XUSER_MAX_COUNT; controllerIndex++) {