to check whether the Left button is pressed. What about plus and minus. For minus i can use
, but it is not working for plus. I believe it is because shift has to be pressed on the same time. How about plus and minus on the num pad?
Does anybody know how to get plus and minus?
@CallError It’s g.keyboard.KP_PLUS for the numpad/keypad plus.
And g.keyboard.PLUS otherwise, and it works for me, i.e. for the key that gives me a + works, in my Icelandic keyboard setup (I think it’s the same for US keyboard; I actually have a Scandinavian keyboard and something else is printed on that key next to ENTER which gives me plus, it’s likely based on keycodes that do not change, also why they are different for the keypad).
Seemingly the same after stripping SDLK_
EDIT: I can confirm g.keyboard.PLUS didn’t work for me (on Linux), but neither g.keyboard.MINUS (on the numpad at least), nor did I find this defined in the code, or any game. So is it supposed to work (that way)? Nor did I find anything useful defined in SimpleDirectMediaLayer.jl its dependency, so maybe it’s a limitation there, and also a known problem in similar project for Python, also based on it?
git clone https://github.com/SquidSinker/GZExamples
julia> rungame("""GZExamples/Flappy bird/flappybird.jl""")
Great fun! Works for me, both plus and minus, on the numpad, and they do the same as the up arrow.
It’s possible though that “ANY” key works and is checked for…
Thank you for the link. I got the plus key running now:
g.keyboard.PLUS || g.keyboard.KP_PLUS || ((g.keyboard.RSHIFT || g.keyboard.LSHIFT) && g.keyboard.EQUALS)
The “g.keyboard.PLUS” can only be used for keyboard layouts, which don’t require an extra button, like shift for example, to activate it. So I think it is good practice to put it into the code even though it doesn’t have an effect for the US keyboard layout.
The only thing which might can bring Problems for larger projects, could come in the form of users, who have exotic keyboard layouts. That is something to bare in mind.