Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add numpad support #31

Merged
merged 3 commits into from Feb 6, 2018
Merged

Add numpad support #31

merged 3 commits into from Feb 6, 2018

Conversation

samiksome92
Copy link
Contributor

This adds basic numpad support. The numpad keys are mapped in a vertically inverted manner (1,2,3->7,8,9) and (7,8,9->1,2,3) as layout is vertically inverted in mobile phone keypads.

@samiksome92 samiksome92 mentioned this pull request Feb 6, 2018
@recompileorg
Copy link
Collaborator

recompileorg commented Feb 6, 2018

You should change lines like this:
case KeyEvent.VK_0: case KeyEvent.VK_NUMPAD0: return Mobile.KEY_NUM0;
to:
case KeyEvent.VK_NUMPAD0: return Mobile.KEY_NUM0;

@samiksome92
Copy link
Contributor Author

samiksome92 commented Feb 6, 2018

So no fall throughs, but a separate set of case statements entirely right? Done

@recompileorg
Copy link
Collaborator

Yes. If you'll look just a few lines above, you'll see that those cases are already handled.

You should also consider that users who don't have or aren't using a numpad (most laptop users) will be very confused when they press 1 and get a 7 instead. As we have separate constants for the numpad numbers, it only makes sense to use those for the inverted numpad. You can see this in the SDL version, as Hex pointed out.

Copy link
Collaborator

@recompileorg recompileorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@samiksome92
Copy link
Contributor Author

I don't understand. the VK_NUMPAD signals are only generated if someone presses a the numpad keys right? In that case people who don't have numpad would still not have any problems. Someone pressing non-numpad 7 would still get 7 since the VK_7 matches and returns Mobile.KEY_NUM7

@recompileorg recompileorg merged commit 59566e4 into hex007:master Feb 6, 2018
@samiksome92
Copy link
Contributor Author

Thanks for the merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants