Idea for better input mapping
I had an idea for better input mapping. Idk if this is possible without majorly modifying love2d but if so you could allow something like this...
void SetInput()
{
//note the any constants
if (Keyboard.IsPressed(KeyConstant.Any)) // if any keyboard key is pressed
{
Keyboard.MapKey(Keyboard.GetKeyDown()) //Set binding to the first currently pressed key
}
else if (Joystick.IsPressed(GamepadButton.Any)); // If Joystick is Down
{
Joystick.MapButton(Joystick.GetButtonDown()) //Set binding to the first currently pressed button
}
else if (Joystick.IsAxisChanged(GamepadAxis.Any));
{
Joystick.MapAxis(Joystick.GetAxisChanged()); //Set binding to the first currently chnaged axis
}
}
this is just an idea to make input binding easier what do you think?
the bindings would have to be so they override the default button, axis, or key so for example X might not be X anymore but instead something else
emm, I believe it is no, it's look like a little "chicken rib" -- means "it‘s tasteless to eat but waste to throw away."
For junior developer, it was confuse. For advanced developers, they will customize their own input systems. so, i a think it was "chicken rib".
but i think the Keyboard.IsAnyKeyDown() is real useful
well thats ok
would a version of IsAnyKeyDown() be implemented for mouse and joystick as well?
mouse might be a little unnecessary but joystick would definitely be good
ok, not bad, I think that's the function you need :
bool Keyboard.AnyKeyDown()
bool Keyboard.AnyKeyDown(out KeyConstant key) // the output `key` is what you down
bool Mouse.AnyKeyDown()
bool Mouse.AnyKeyDown(out int button)
bool joystick.AnyKeyDown()
bool joystick.AnyKeyDown(out int button)
bool joystick.AnyGampadDown()
bool joystick.AnyGampadDown(out GamepadButton button)
does gamepad treat axis as buttons? I was just wondering because it would be nice to map joystick directions
no , joystick.AnyGampadDown was any key down version of Joystick:isGamepadDown
Checks if a virtual gamepad button on the Joystick is pressed. If the Joystick is not recognized as a Gamepad or isn't connected, then this function will always return false.
oh ok thats good to know