I finally created an account. I've started coding MS GameInput, and have a problem retrieving keystrokes. I think I have a linking error but can't be sure I just started coding again after 15 years. The whole NUGET thing is new to me but in the package config it's there
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.GameInput" version="0.2303.22621.3038" targetFramework="native" />
<package id="NuJet" version="0.0.1" targetFramework="native" developmentDependency="true" />
</packages>'
I'm not crashing, the inputreading and the device are not NULL; but the count is zero and KeyState is NULL;
In the debugger is says to load symbols for more information so I'm not doing something right. Here's some code called in the game loop:
IGameInputReading* inputReading = NULL;
GameInputKeyState* keyState = NULL;
gameInput->GetCurrentReading(GameInputKindKeyboard, gameKeyboard, &inputReading);
int count = inputReading->GetKeyCount();
inputReading->GetKeyState(count, keyState);
for (int k = 0; k < count; k++)
{
if (keyState[k].virtualKey == 0x57)
{
MessageBoxA(NULL, "Key Pressed", "w Key pressed", MB_OK);
}
}
forgive no error checking, it will come
Edit: I looked closer at the debug string and it's this:
gameInput 0x0000022fadb55c70 <Information not available, no symbols loaded for GameInputInbox.dll> IGameInput *
now shouldn't that be gameinput.dll if so what can I do?
Here's a basic program I have:
#include <iostream>
#include <gameinput.h>
IGameInput* gameInput = NULL;
IGameInputDevice* gameKeyboard = NULL;
IGameInputReading* inputReading = NULL;
int main()
{
GameInputCreate(&gameInput);
// passing gameKeyboard as NULL device reads all devices connected, however we are filtering to the keyboard
gameInput->GetCurrentReading(GameInputKindKeyboard, gameKeyboard, &inputReading);
if (inputReading)
inputReading->GetDevice(&gameKeyboard); // since filterd the only device IS the keyboard
while (true)
{
inputReading = NULL;
GameInputKeyState* keyState = NULL;
gameInput->GetCurrentReading(GameInputKindKeyboard, gameKeyboard, &inputReading);
if (inputReading)
{
int count = inputReading->GetKeyCount();
inputReading->GetKeyState(count, keyState);
if (keyState)
for (int k = 0; k < count; k++)
{
if (keyState[k].virtualKey == 0x57)
{
MessageBoxA(NULL, "Key Pressed", "w Key pressed", MB_OK);
}
}
}
if (inputReading)
inputReading->Release();
}
if (gameKeyboard) gameKeyboard->Release();
if (gameInput) gameInput->Release();
return 0;
}
I'm still wondering about the debug symbols not being loaded though.