Coder Social home page Coder Social logo

gesluxe's Introduction

gesluxe

Inspired by Gestouch ActionScript 3 gesture recognition library

##Supported gestures:

  • Tap
  • Pan
  • Long press
  • Swipe
  • Zoom
  • Rotation
  • Transform

##Clone the repository and test

haxelib git gesluxe https://github.com/josuigoa/gesluxe.git

##Usage First of all, we must define the library dependency in the project.flow file

{
...
    build : {
      dependencies : {
        luxe : '*',
        gesluxe : '*'
      }
    }
...
}

Then, initialize the gesture recognizer (initialize the touch/mouse listeners)

org.gesluxe.Gesluxe.init();

Last, create a new Gesture object (ZoomGesture, PanGesture, SwipeGesture...) for each gesture you want to handle

// ...
// If you want to detect the gesture in a concrete geometry, pass it as parameter.
// If there is no geometry passed, the gesture will be detected anywhere
zoomGesture = new org.gesluxe.gestures.ZoomGesture(sprite.geometry);
zoomGesture.events.listen(GestureEvent.GESTURE_BEGAN, onZoomGesture);
zoomGesture.events.listen(GestureEvent.GESTURE_CHANGED, onZoomGesture);
// ...

function onZoomGesture(event: GestureEventData) {
  Luxe.camera.scale.set_xy(zoomGesture.scaleX, zoomGesture.scaleY);
}

If you want to try a more complete sample, you can run the test project from this repository

  • cd /path/to/gesluxe/test_project
  • haxelib run flow run web

It should work on every target supported by Luxe. Tested and working on CPP (Window, Mac, iOS, Android) and Web

##Screenshots

gesluxe's People

Contributors

anissen avatar josuigoa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

anissen jiveui

gesluxe's Issues

Cannot run on Mac or Web

I have not been able to run the examples project with neither Mac nor Web with the latest versions of flow, snow and luxe.

Here's my output for Mac:

$ haxelib run flow run mac
flow / 1.0.0-alpha.1
flow / target is mac ( arch 64 )

flow / project - searching project root /Users/nissen/code/Gesluxe
flow / project - using project file /Users/nissen/code/Gesluxe/project.flow
flow / build - gesluxe_test 1.0.0 for mac
flow / build - running haxe ...
flow / build - running hxcpp ...
flow / build - done
flow / launching gesluxe_test 1.0.0 for mac

Core.hx:140:      i / luxe / version 1.0.0-alpha.1+83169a9776
Error : Invalid Cast

And for Web (Chrome):

Core.hx:140:      i / luxe / version 1.0.0-alpha.1+83169a9776 gesluxe_test.js:1820
Parcel.hx::100     i / parcel / loading parcel in 0.4s gesluxe_test.js:3403
Parcel.hx::104     i / parcel / starting load gesluxe_test.js:3403
Texture.hx::149    i / texture / texture loaded assets/luxelogo.png (360x390) real size (512x512) gesluxe_test.js:3403
Texture.hx::149    i / texture / texture loaded assets/arrow.png (220x150) real size (256x256) gesluxe_test.js:3403
Uncaught TypeError: undefined is not a function gesluxe_test.js:2589

where gesluxe_test.js:2589 is

set_parent: function(other) {
        if(this.get_parent() != null) this.get_parent()._remove_child(this);
        this.parent = other;
        if(this.get_parent() != null) {
            this.get_parent()._add_child(this); // <-- Error here
            this.transform.set_parent(this.get_parent().transform);
        } else this.transform.set_parent(null);
        return this.get_parent();
    }

Documentation

It would be nice with some basic documentation about the library or a how-to guide. How to initialise the library, listen to events and handle gesture events.

For instance, something like the following:

        // ...

        Gesluxe.init();

        zoomGesture = new ZoomGesture();
        zoomGesture.events.listen(GestureEvent.GESTURE_BEGAN, onZoomGesture);
        zoomGesture.events.listen(GestureEvent.GESTURE_CHANGED, onZoomGesture);
    }

    function onZoomGesture(event: GestureEventData) {
        Luxe.camera.scale.set_xy(zoomGesture.scaleX, zoomGesture.scaleY);
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.