EngoEngine / engo

Engo is an open-source 2D game engine written in Go.
https://engoengine.github.io
MIT License
1.74k stars 136 forks source link

Input key modifiers #731

Closed otraore closed 4 years ago

otraore commented 4 years ago

Something to note is that SDL supports modifiers being identifiable by their position on the keyboard. So left shift vs right shift. GLFW as far as I know, does not. To keep the API simple and not requiring the end users to use bitwise operations to check their Modifiers, I just did the checks within the game loop so the API is the same for both platforms. Going to be adding js support in an upcoming commit as well.

ex:

if engo.Input.Modifier == engo.Shift {
    log.Println("is shift")
}
github-actions[bot] commented 4 years ago

Coverage Status

Coverage increased (+1.7%) to 39.126% when pulling 03790dc00083374e18073956643bc2a8bb5081d2 on input-modifiers into 9a3d4a5eb1be34e366a03871a19509362de7260a on master.

otraore commented 4 years ago

Hey @Noofbiz can you "squash and merge" instead of just doing a regular merge? It's just to keep the main commit messages cleaner without all the working commits in the PR. Thanks, appreciate it for getting this merged in.