How to change a bool through a key press?
In my small game engine, I've made a system to detect whether or not the user is using a gamepad or the keyboard; however, the system is not working all too well.
Here's the code:
public void checkInputSource()
{
if (Keyboard.GetState().IsKeyDown(Keys.Enter))
{
isUsingKeyboard = true;
isInInputPrompt = false;
}
if (GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.Start))
{
isUsingGamepad = true;
isInInputPrompt = false;
}
}
What exactly is the correct way to change a boolean's value through a key press?
No comments:
Post a Comment