mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 22:02:49 -06:00
Added Android builder juicy example
git-svn-id: svn://ultimatepp.org/upp/trunk@8640 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
20ee1a9a47
commit
99222001cf
15 changed files with 439 additions and 0 deletions
96
examples/AndroidMath/Vector.cpp
Normal file
96
examples/AndroidMath/Vector.cpp
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
#ifndef _Included_org_upp_AndroidMath_Vector
|
||||
#define _Included_org_upp_AndroidMath_Vector
|
||||
|
||||
#include <jni.h>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include <AndroidMathUtility/AndroidMathUtility.h>
|
||||
|
||||
#include "MemoryManager.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
using AndroidMathUtility::Vector;
|
||||
|
||||
MemoryManager<Vector> mm;
|
||||
|
||||
/*
|
||||
* Class: org_upp_AndroidMath_Vector
|
||||
* Method: construct
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_upp_AndroidMath_Vector_construct
|
||||
(JNIEnv *env, jobject obj, jint size)
|
||||
{
|
||||
mm.Insert(env, obj, Vector(size));
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_upp_AndroidMath_Vector
|
||||
* Method: destruct
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_upp_AndroidMath_Vector_destroy
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
mm.Erase(env, obj);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_upp_AndroidMath_Vector
|
||||
* Method: getSize
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_upp_AndroidMath_Vector_getSize
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
Vector* vec = mm.Get(env, obj);
|
||||
|
||||
return vec->GetSize();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_upp_AndroidMath_Vector
|
||||
* Method: get
|
||||
* Signature: (I)F
|
||||
*/
|
||||
JNIEXPORT jfloat JNICALL Java_org_upp_AndroidMath_Vector_get
|
||||
(JNIEnv *, jobject, jint)
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_upp_AndroidMath_Vector
|
||||
* Method: set
|
||||
* Signature: (IF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_upp_AndroidMath_Vector_set
|
||||
(JNIEnv *, jobject, jint, jfloat)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_upp_AndroidMath_Vector
|
||||
* Method: toStirng
|
||||
* Signature: ()Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_org_upp_AndroidMath_Vector_toString
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
Vector* vec = mm.Get(env, obj);
|
||||
|
||||
return env->NewStringUTF(vec->ToString().c_str());
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue