2021-04-29

Retrieving struct from array not working? [closed]

I am working on implementing an input manager on top of the Windows API. I have a struct name ButtonState that stores if a key is currently down and if it has changed within that frame. I have an array of these structs for all the supported buttons and I use the Windows defined VK_XXX codes to index that array. I update these structs properly, but when I try to access them through a function, it always returns false. I've run through it literally tens of times with the debugger trying to figure out what's happening but to no avail. Here is a photo of proof that I'm not crazy and that the values in the struct are in fact true but it returns false:

enter image description here

Here is the original method:

const bool Input::KeyDown(U32 keyCode)
{
    return buttonStates[keyCode].isDown;
}

Called using:

Input::KeyDown(VK_DOWN)


from Recent Questions - Stack Overflow https://ift.tt/3e1XtCU
https://ift.tt/3u1CZzr

No comments:

Post a Comment