Some love features I think would be useful
Posted: Sat Jun 01, 2019 10:07 pm
I just had a suggestion for love2d to make input easier to manage
adding these functions would make life a lot easier and I think could speed up development time for people.
- Love.keyboard.isDownPrevious()
- Love.mouse.isDownPrevious()
- Love.joystick.isDownPrevious()
- Love.joystick.GetAxisPrevious()
- Love.keyboard.GetKeysDown()
- Love.keyboard.GetKeysDownPrevious()
- Love.mouse.GetButtonsDown()
- Love.mouse.GetButtonsDownPrevious()
- Love.joystick.GetButtonsDown()
- Love.joystick.GetButtonsDownPrevious()
- Love.joystick.GetAxesDown()
- Love.joystick.GetAxesDownPrevious()
not only this but you could make a input manager without a update function because you have access to all the inputs that is needed to check if something was just pressed, something is pressed, or something is released for example..
it also supports people making their own input managers because you don't have access to pressed and release functions directly but just the current and previous inputs.
also we can now easily check for if anything was pressed by just passing in the one of the new constant getting functions.
what do you guys think?
adding these functions would make life a lot easier and I think could speed up development time for people.
- Love.keyboard.isDownPrevious()
- Love.mouse.isDownPrevious()
- Love.joystick.isDownPrevious()
- Love.joystick.GetAxisPrevious()
- Love.keyboard.GetKeysDown()
- Love.keyboard.GetKeysDownPrevious()
- Love.mouse.GetButtonsDown()
- Love.mouse.GetButtonsDownPrevious()
- Love.joystick.GetButtonsDown()
- Love.joystick.GetButtonsDownPrevious()
- Love.joystick.GetAxesDown()
- Love.joystick.GetAxesDownPrevious()
not only this but you could make a input manager without a update function because you have access to all the inputs that is needed to check if something was just pressed, something is pressed, or something is released for example..
Code: Select all
local joystickAxesCurr = joystick:GetAxesButtonsDown(1)
local joystickAxesPrev = joystick:GetAxesButtonsDownPrevious(1)
local joystickAxisJustChangedFrom0 = joystick:GetAxis(joystickAxesCurr ) == 0 and joystick:GetAxisPrevious(joystickAxesPrev) ~= 0;
local joystickAxisJustChangedTo0 = joystick:GetAxis(joystickAxesCurr ) ~= 0 and joystick:GetAxisPrevious(joystickAxesPrev) == 0;
also we can now easily check for if anything was pressed by just passing in the one of the new constant getting functions.
what do you guys think?