-
Notifications
You must be signed in to change notification settings - Fork 587
Initial touch controls implementation #1160
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
Open
NyakoFox
wants to merge
8
commits into
TerryCavanagh:master
Choose a base branch
from
NyakoFox:touch-initial
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6f47455 to
adff529
Compare
adff529 to
db611bd
Compare
db611bd to
ee1efa5
Compare
Contributor
Author
|
I've rebased and pushed -- do note that I don't have any apple devices so I'm unable to test for iOS. |
leo60228
suggested changes
Nov 21, 2024
This commit adds virtual buttons on-screen to let you navigate through menus, and play the game.
Touch input automatically "disables" when you press a key on your keyboard. The back button on Android counts as a key press, so let's just ignore it.
For some reason, the code that handled button presses for the ingame menu checked the confirm button in the wrong places.
ee1efa5 to
6ed3fab
Compare
Daaaav
suggested changes
Jul 3, 2025
Contributor
Daaaav
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Went through this whole PR - it looks pretty solid I think! I mostly have some nits here and there.
In addition to the in-context code comments:
- In
Touch.cpp, maybeinit(void)should be at the top? Maybeget_rect(button, rect)should be right aboverender(void)? (close to where it's used) - Maybe the
Touch.cppfunctions could use comments at the top of the functions to document what the functions mean. Like,touch::get_rect(button, rect)gets a rect from aTouchButton. Then you seetouch::get_scale(void)and it gets... the scale? From? A button as well? Is it an API for external use? Oh wait, this one doesn't actually take a button, it's the global graphics scale. (Also, if functions aren't used outside ofTouch.cppthen it helps to make them static to make clear that they're local helper functions and not 'API') - The names of functions could also make things clearer:
- The
get_rect(button, rect)I mentioned above could maybe be clearer asrect_from_button(button, rect) touching_right()sounds a little bit ambiguous - you're not touching the right arrow button, but the right half of the screen- The 3 functions
touch::button_tapped(id),touch::touching_right(), andtouch::screen_down()serve similar purposes (to ask whether something is touched) but all are named completely differently
- The
This commit fixes or implements most of what Dav999 suggested. There's one user-facing change, being that touch input isn't automatically active on any device with touch devices present anymore, being replaced with manual iOS/Android checks.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes:
This PR adds touch controls to the game. While not being the prettiest UI-wise, it makes it possible to play the game using touch controls, making testing on mobile devices much easier. This PR will be followed up by other PRs which implement more features, such as:
Supersedes #1142.
Legal Stuff:
By submitting this pull request, I confirm that...
CONTRIBUTORSfile and the "GitHub Friends"section of the credits for all of said releases, but will NOT be compensated
for these changes unless there is a prior written agreement