Skip to content

Conversation

@NyakoFox
Copy link
Contributor

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:

  • Menus converted to a mobile-friendly format
  • Additional gameplay control styles (Not just D-pad)
  • The touch control tutorial
  • Saving when you touch a checkpoint
  • Level editor controls

Supersedes #1142.

Legal Stuff:

By submitting this pull request, I confirm that...

  • My changes may be used in a future commercial release of VVVVVV
  • I will be credited in a CONTRIBUTORS file 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

@InfoTeddy InfoTeddy self-assigned this Mar 23, 2024
@NyakoFox NyakoFox force-pushed the touch-initial branch 2 times, most recently from 6f47455 to adff529 Compare April 11, 2024 23:08
@NyakoFox NyakoFox mentioned this pull request Apr 12, 2024
2 tasks
@NyakoFox NyakoFox mentioned this pull request Sep 30, 2024
9 tasks
@NyakoFox
Copy link
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.

AllyTally and others added 7 commits November 23, 2024 18:21
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.
@mothbeanie mothbeanie mentioned this pull request Jun 16, 2025
2 tasks
Copy link
Contributor

@Daaaav Daaaav left a 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, maybe init(void) should be at the top? Maybe get_rect(button, rect) should be right above render(void)? (close to where it's used)
  • Maybe the Touch.cpp functions 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 a TouchButton. Then you see touch::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 of Touch.cpp then 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 as rect_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(), and touch::screen_down() serve similar purposes (to ask whether something is touched) but all are named completely differently

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants