Gesture Reconizers: my work [WITH CODE]

Hi guys

With the hope to have Gesture Recognizer in the next versions of Cocos2d-x I want to
share with you my works about this topic. :smile:

If the work is appreciated and there are serious intentions for an integration with Cocos2d-x, I will keep working on the code making it more robust and adding features.
In this phase I think it can be useful to test the classes together before a possible pull request in the official cocos2d-x project.

Here you can download the code with some test scenes:

Report bugs here please:

Finally a little demo video on Youtube

Enjoy :wink:

4 Likes

This is really nice of you. Thank you!

You are welcome! :smile:
I hope we will succeed to add these features in next cocos2d-x version! :wink:

Great thanks for sharing .

1 Like

Hi Guys! :smile:

I updated the project with a new class:

A custom ScrollView that adds to ui::ScrollView the following features:

  • Pinch to zoom
  • Double tap to zoom in and out towards the tapped point

Note1:
The custom ScrollView is only a “proof of concept”, not a “robust class” to deploy in your projects!

Note2:
The custom ScrollView could not compile with older (than 3.11) versions of Cocos2d-x.
If this happens to you, comment the line in the file “Test/EnableScrollViewTest.h”

Bye

1 Like

I still find this interesting. I am working on a project that uses a lot of scrollviews. I will try your implementation.

@slackmoehrle

I think there is work to be done to have a robust “GestureScrollView” class!
My purpose here was to show how the Gesture Recognizer can be used to add a lots of new features to Cocos2d-x! :smile:

Awesome! thanks for sharing!

1 Like

Pull request sent today:


Now I’m waiting the administrators’ merge! :smile:
I will update this topic when the merge is completed.

1 Like

Hi guys
Sorry but cocos2d-x repository administrators, rejected the Gesture Recognizer classes because they see these as optional features.

As “minggo” said:

Thanks for the good PR, but i think it is better not
include it into cocos2d-x. It is better treated as a package when we
implement package manager

For now if I make changes, I will update my personal repository.

Bye

Hi @drakon99 We should be releasing the package manager very soon. Why don’t you and I work together to make this one of the first packages available.

1 Like

@slackmoehrle
I think I could collaborate, let me know when package manager will be ready! :wink:

Some of you had trouble to run the test project.
I added in repo the projects for iOS and Android.
Now should be very easy to test the sample code! :wink:

Great work!! Thanks!

I know this is an old thread but thank you. You saved me a lot of time

I’m glad you enjoy the project! :wink:

1 Like

Works on cocos2d-x 3.16 (android-studio)
Test didn’t work out of the box, but class work and very easy to implement.

Thank you for sharing

PS: Because the class file names are a bit long, sometimes it doesn’t work on android studio… but shortening the file names solve this problem

Why there are problems with long class names @mavios

Android-srudio will fail to compile when path is long. And although I had my project only two levels from from root, but because there were files like gesture\LongPressGestureRegonizer.cpp made over all path very long and that just caused android studio to stop compiling. So i shortened the names to only LPressGR.cpp and without Gesture directory and it worked (offcourse I did this to all files and updated references)