HyperTouch icon indicating copy to clipboard operation
HyperTouch copied to clipboard

Android, compatibility broken with Openfl 1.4, and Haxeflixel

Open paala opened this issue 10 years ago • 9 comments

Hello, It seams that the so file is still referencing to the old "org.haxe.nme" instead of lime.

I get errors like below.

How can I generate a new so file?

Thanks

-compile: [javac] Compiling 13 source files to D:\Haxeflixel\Gestures\Project Jumper_gestures2\export\android\bin\bin\classes [javac] D:\Haxeflixel\Gestures\Project Jumper_gestures2\export\android\bin\src\fr\hyperfiction\hypertouch

\HyperTouch.java:10: error: package org.haxe.nme does not exist

paala avatar May 16 '14 08:05 paala

Hi the java is not contained into the so, you just have to edit the java class.

To rebuild the .so just execute the android.sh file in the project folder.

shoebox avatar May 16 '14 08:05 shoebox

Ok, editing the java files only works, , but in my project(haxeflixel),everytime I do a gesture, the whole game crashes.

What I did is :

Is this setup ok, or I did something wrong? Thanks

In main.hx:

#if mobile import fr.hyperfiction.hypertouch.HyperTouch;

import fr.hyperfiction.hypertouch.events.GestureTapEvent; import fr.hyperfiction.hypertouch.events.TransformGestureEvent; import fr.hyperfiction.hypertouch.events.GestureLongPressEvent; #end^


private function setupGame():Void {

    //gestures

    #if mobile
    var hyp = HyperTouch.getInstance();
    hyp.add( TAP( 1 , 1 ));//Single Tap
    hyp.add( TAP( 2 , 1 ));//Two Fingers Taps
    hyp.add( GESTURE_SWIPE );//Swipe Gesture
    hyp.add( LONGPRESS );//Swipe Gesture

    Lib.current.stage.addEventListener( GestureTapEvent.TAP , FTap );
   Lib.current.stage.addEventListener( GestureLongPressEvent.LONG_PRESS , FLongPress );
   Lib.current.stage.addEventListener( TransformGestureEvent.GESTURE_SWIPE , FSwipeTrace);
    //FlxG.stage.addEventListener( TransformGestureEvent.GESTURE_SWIPE , FSwipeTrace);


    #end
//end gestures
    var stageWidth:Int = Lib.current.stage.stageWidth;
    var stageHeight:Int = Lib.current.stage.stageHeight;

    if (zoom == -1)
    {
        var ratioX:Float = stageWidth / gameWidth;
        var ratioY:Float = stageHeight / gameHeight;
        zoom = Math.min(ratioX, ratioY);
        gameWidth = Math.ceil(stageWidth / zoom);
        gameHeight = Math.ceil(stageHeight / zoom);
    }

    addChild(new FlxGame(gameWidth, gameHeight, initialState, zoom, framerate, framerate, skipSplash, startFullscreen));

}

//gestures

#if mobile
private function FSwipeTrace(e : TransformGestureEvent = null):Void
{
    //trace("Swipe!");
    //FlxG.switchState(new PlayState());
    //FlxG.debugger.visible = false;
   // trace(e.direction);

}

private function FLongPress(e : GestureLongPressEvent = null):Void
{
    trace("longPress");
}
private function FTap(e : GestureTapEvent = null):Void
{
    trace("tap-pos: ["+e.stageX+","+e.stageY+"]");
}

#end
//end gestures

paala avatar May 16 '14 11:05 paala

It's probably due to the issue i reported here: https://github.com/openfl/openfl-native/issues/216

You can downgrade to OpenFL 1.3 for noz

shoebox avatar May 16 '14 12:05 shoebox

Thanks, will try

paala avatar May 16 '14 13:05 paala

Is this affecting the HypFacebook also?

Thanks

paala avatar May 16 '14 13:05 paala

Yeah

shoebox avatar May 16 '14 13:05 shoebox

I manage to get admob working from this: https://github.com/mkorman9/admob-openfl What's the difference between this implementation and yours? After all the extension is about calling native code , no?

paala avatar May 16 '14 15:05 paala

If you read the bug report i linked earlier, it's not about calling native code, it's about receiving callbacks from it.

shoebox avatar May 16 '14 15:05 shoebox

if i downgrade only openfl and openfl native to 1.3.0 the game compiles but crashes. The game without your extension works fine

paala avatar May 19 '14 12:05 paala