Hi! I'm having an issue with the code for day 16 where my keyboard won't respond to input. The Xbox pad works as expected and I've gone through the video and double checked to make sure I did everything exactly as Casey has.
Here's my code in CALLBACK WinMain:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 | while (GlobalRunning)
{
game_controller_input *KeyboardController = &NewInput->Controllers[0];
// TODO: Zeroing macro
game_controller_input ZeroController = {};
*KeyboardController = ZeroController;
Win32ProcessPendingMessages(KeyboardController);
// TODO: Should we poll this more frequently?
DWORD MaxControllerCount = XUSER_MAX_COUNT;
if (MaxControllerCount > ArrayCount(NewInput->Controllers))
{
MaxControllerCount = ArrayCount(NewInput->Controllers);
}
for (DWORD ControllerIndex = 1;
ControllerIndex < MaxControllerCount;
++ControllerIndex)
{
game_controller_input*OldController=&OldInput>Controllers[ControllerIndex];
game_controller_input *NewController = &NewInput->Controllers[ControllerIndex];
...
|
Changing
| game_controller_input *OldController = &OldInput->Controllers[ControllerIndex];
game_controller_input *NewController = &NewInput->Controllers[ControllerIndex];
|
to
| game_controller_input *OldController = &OldInput->Controllers[ControllerIndex + 1];
game_controller_input *NewController = &NewInput->Controllers[ControllerIndex + 1];
|
fixes the issue but Casey doesn't do this in his code. What's the deal? I mean, so, yes I fixed it but why does it work fine on Casey's machine?