Fixing Android builds with missing dependencies, making sure templates are up to date. Fixing include.xml as well for that

This commit is contained in:
underscorediscovery
2013-11-25 07:26:40 -03:30
parent b713cffcaa
commit b4bc627a22
20 changed files with 478 additions and 13 deletions

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.haxe.extension" >
</manifest>

13
dependencies/extension-api/build.xml vendored Normal file
View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="OpenFLExtension" default="help">
<property environment="env"/>
<property name="sdk.dir" value="${env.ANDROID_SDK}"/>
<property file="local.properties"/>
<property file="ant.properties"/>
<property file="project.properties"/>
<import file="${sdk.dir}/tools/ant/build.xml"/>
</project>

View File

@@ -0,0 +1,13 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "build.properties", and override values to adapt the script to your
# project structure.
android.library=true
# Project target.
target=android-::ANDROID_TARGET_SDK_VERSION::

View File

@@ -0,0 +1,30 @@
package org.haxe;
// Wrapper for native library
public class HXCPP {
private static boolean mInit = false;
public static native void main ();
public static void run (String inClassName) {
System.loadLibrary (inClassName);
if (!mInit) {
mInit = true;
main ();
}
}
}

View File

@@ -0,0 +1,109 @@
package org.haxe.extension;
import android.app.Activity;
import android.content.res.AssetManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
public class Extension {
public static AssetManager assetManager;
public static Handler callbackHandler;
public static Activity mainActivity;
public static Context mainContext;
/**
* Called when an activity you launched exits, giving you the requestCode
* you started it with, the resultCode it returned, and any additional data
* from it.
*/
public boolean onActivityResult (int requestCode, int resultCode, Intent data) {
return true;
}
/**
* Called when the activity is starting.
*/
public void onCreate (Bundle savedInstanceState) {
}
/**
* Perform any final cleanup before an activity is destroyed.
*/
public void onDestroy () {
}
/**
* Called as part of the activity lifecycle when an activity is going into
* the background, but has not (yet) been killed.
*/
public void onPause () {
}
/**
* Called after {@link #onStop} when the current activity is being
* re-displayed to the user (the user has navigated back to it).
*/
public void onRestart () {
}
/**
* Called after {@link #onRestart}, or {@link #onPause}, for your activity
* to start interacting with the user.
*/
public void onResume () {
}
/**
* Called after {@link #onCreate} &mdash; or after {@link #onRestart} when
* the activity had been stopped, but is now again being displayed to the
* user.
*/
public void onStart () {
}
/**
* Called when the activity is no longer visible to the user, because
* another activity has been resumed and is covering this one.
*/
public void onStop () {
}
}

View File

@@ -0,0 +1,114 @@
package org.haxe.nme;
import android.util.Log;
import java.lang.Boolean;
import java.lang.Byte;
import java.lang.Character;
import java.lang.Short;
import java.lang.Integer;
import java.lang.Long;
import java.lang.Float;
import java.lang.Double;
public class HaxeObject
{
public long __haxeHandle;
public HaxeObject(long value)
{
__haxeHandle = value;
}
public static HaxeObject create(long inHandle) { return new HaxeObject(inHandle); }
protected void finalize() throws Throwable {
try {
NME.releaseReference(__haxeHandle);
} finally {
super.finalize();
}
}
public Object call0(String function)
{
//Log.e("HaxeObject","Calling obj0" + function + "()" );
return NME.callObjectFunction(__haxeHandle,function,new Object[0]);
}
public Object call1(String function,Object arg0)
{
Object[] args = new Object[1];
args[0] = arg0;
//Log.e("HaxeObject","Calling obj1 " + function + "(" + arg0 + ")" );
return NME.callObjectFunction(__haxeHandle,function,args);
}
public Object call2(String function,Object arg0,Object arg1)
{
Object[] args = new Object[2];
args[0] = arg0;
args[1] = arg1;
//Log.e("HaxeObject","Calling obj2 " + function + "(" + arg0 + "," + arg1 + ")" );
return NME.callObjectFunction(__haxeHandle,function,args);
}
public Object call3(String function,Object arg0,Object arg1,Object arg2)
{
Object[] args = new Object[3];
args[0] = arg0;
args[1] = arg1;
args[2] = arg2;
//Log.e("HaxeObject","Calling obj3 " + function + "(" + arg0 + "," + arg1 + "," + arg2 + ")" );
return NME.callObjectFunction(__haxeHandle,function,args);
}
public Object call4(String function,Object arg0,Object arg1,Object arg2,Object arg3)
{
Object[] args = new Object[4];
args[0] = arg0;
args[1] = arg1;
args[2] = arg2;
args[3] = arg3;
//Log.e("HaxeObject","Calling obj4 " + function + "(" + arg0 + "," + arg1 + "," + arg2 + "," + arg3 + ")" );
return NME.callObjectFunction(__haxeHandle,function,args);
}
public double callD0(String function)
{
//Log.e("HaxeObject","Calling objD0 " + function + "()" );
return NME.callNumericFunction(__haxeHandle,function,new Object[0]);
}
public double callD1(String function,Object arg0)
{
Object[] args = new Object[1];
args[0] = arg0;
//Log.e("HaxeObject","Calling D1 " + function + "(" + arg0 + ")" );
return NME.callNumericFunction(__haxeHandle,function,args);
}
public double callD2(String function,Object arg0,Object arg1)
{
Object[] args = new Object[2];
args[0] = arg0;
args[1] = arg1;
//Log.e("HaxeObject","Calling D2 " + function + "(" + arg0 + "," + arg1 + ")" );
return NME.callNumericFunction(__haxeHandle,function,args);
}
public double callD3(String function,Object arg0,Object arg1,Object arg2)
{
Object[] args = new Object[2];
args[0] = arg0;
args[1] = arg1;
args[2] = arg2;
//Log.e("HaxeObject","Calling D3 " + function + "(" + arg0 + "," + arg1 + "," + arg2 + ")" );
return NME.callNumericFunction(__haxeHandle,function,args);
}
public Object call(String function, Object[] args)
{
return NME.callObjectFunction(__haxeHandle,function,args);
}
public double callD(String function, Object[] args)
{
return NME.callNumericFunction(__haxeHandle,function,args);
}
}

View File

@@ -0,0 +1,34 @@
package org.haxe.nme;
// Wrapper for native library
public class NME {
static {
System.loadLibrary("openal");
System.loadLibrary("nme");
}
public static final int ACTIVATE = 1;
public static final int DEACTIVATE = 2;
public static final int DESTROY = 3;
public static native int onDeviceOrientationUpdate(int orientation);
public static native int onNormalOrientationFound(int orientation);
public static native int onOrientationUpdate(float x, float y, float z);
public static native int onAccelerate(float x, float y, float z);
public static native int onTouch(int type, float x, float y, int id, float sizeX, float sizeY);
public static native int onResize(int width, int height);
public static native int onTrackball(float x,float y);
public static native int onJoyChange(int inDeviceID, int inCode, boolean inIsDown);
public static native int onJoyMotion(int inDeviceID, int axis, float value);
public static native int onKeyChange(int inCode, boolean inIsDown);
public static native int onRender();
public static native int onPoll();
public static native double getNextWake();
public static native int onActivity(int inState);
public static native void onCallback(long inHandle);
public static native Object callObjectFunction(long inHandle,String function, Object[] args);
public static native double callNumericFunction(long inHandle,String function, Object[] args);
public static native void releaseReference(long inHandle);
}

View File

@@ -0,0 +1,18 @@
package org.haxe.nme;
public class Value {
double mValue;
public Value (double inValue) { mValue = inValue; }
public Value (int inValue) { mValue = inValue; }
public Value (short inValue) { mValue = inValue; }
public Value (char inValue) { mValue = inValue; }
public Value (boolean inValue) { mValue = inValue ? 1.0 : 0.0; }
public double getDouble () { return mValue; }
}