Compare commits
2 commits
d645d3eb18
...
1caa7fe8de
Author | SHA1 | Date | |
---|---|---|---|
1caa7fe8de | |||
21fd354931 |
2 changed files with 219 additions and 215 deletions
|
@ -27,7 +27,8 @@
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
#include <android/native_activity.h>
|
#include <android/native_activity.h>
|
||||||
|
|
||||||
#include "webview_native_activity.h"
|
//webview
|
||||||
|
//webview #include "webview_native_activity.h"
|
||||||
struct android_app * gapp;
|
struct android_app * gapp;
|
||||||
|
|
||||||
#define LOGI(...) ((void)printf(__VA_ARGS__))
|
#define LOGI(...) ((void)printf(__VA_ARGS__))
|
||||||
|
|
|
@ -23,63 +23,65 @@
|
||||||
//#include "cnfa/CNFA.h"
|
//#include "cnfa/CNFA.h"
|
||||||
#include "CNFG.h"
|
#include "CNFG.h"
|
||||||
|
|
||||||
//#define WEBVIEW_NATIVE_ACTIVITY_IMPLEMENTATION
|
//webview//#define WEBVIEW_NATIVE_ACTIVITY_IMPLEMENTATION
|
||||||
//#include "webview_native_activity.h"
|
//webview//#include "webview_native_activity.h"
|
||||||
|
|
||||||
float mountainangle;
|
float mountainangle;
|
||||||
float mountainoffsetx;
|
float mountainoffsetx;
|
||||||
float mountainoffsety;
|
float mountainoffsety;
|
||||||
|
|
||||||
ASensorManager * sm;
|
//SENSORSTURFF ASensorManager * sm;
|
||||||
const ASensor * as;
|
//SENSORSTURFF const ASensor * as;
|
||||||
bool no_sensor_for_gyro = false;
|
//SENSORSTURFF bool no_sensor_for_gyro = false;
|
||||||
ASensorEventQueue* aeq;
|
//SENSORSTURFF ASensorEventQueue* aeq;
|
||||||
ALooper * l;
|
//SENSORSTURFF ALooper * l;
|
||||||
|
|
||||||
//WebViewNativeActivityObject MyWebView;
|
//webview//WebViewNativeActivityObject MyWebView;
|
||||||
|
|
||||||
const uint32_t SAMPLE_RATE = 44100;
|
//AUDIO const uint32_t SAMPLE_RATE = 44100;
|
||||||
const uint16_t SAMPLE_COUNT = 512;
|
//AUDIO const uint16_t SAMPLE_COUNT = 512;
|
||||||
uint32_t stream_offset = 0;
|
//AUDIO uint32_t stream_offset = 0;
|
||||||
uint16_t audio_frequency;
|
//AUDIO uint16_t audio_frequency;
|
||||||
|
|
||||||
void SetupIMU()
|
|
||||||
{
|
|
||||||
sm = ASensorManager_getInstanceForPackage("gyroscope");
|
|
||||||
as = ASensorManager_getDefaultSensor( sm, ASENSOR_TYPE_GYROSCOPE );
|
|
||||||
no_sensor_for_gyro = as == NULL;
|
|
||||||
l = ALooper_prepare( ALOOPER_PREPARE_ALLOW_NON_CALLBACKS );
|
|
||||||
aeq = ASensorManager_createEventQueue( sm, (ALooper*)&l, 0, 0, 0 ); //XXX??!?! This looks wrong.
|
|
||||||
if(!no_sensor_for_gyro) {
|
|
||||||
ASensorEventQueue_enableSensor( aeq, as);
|
|
||||||
printf( "setEvent Rate: %d\n", ASensorEventQueue_setEventRate( aeq, as, 10000 ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
//SENSORSTURFF // Inertial Measurement Unit (gyroscopes and accelerometer)
|
||||||
|
//SENSORSTURFF void SetupIMU()
|
||||||
|
//SENSORSTURFF {
|
||||||
|
//SENSORSTURFF sm = ASensorManager_getInstanceForPackage("gyroscope");
|
||||||
|
//SENSORSTURFF as = ASensorManager_getDefaultSensor( sm, ASENSOR_TYPE_GYROSCOPE );
|
||||||
|
//SENSORSTURFF no_sensor_for_gyro = as == NULL;
|
||||||
|
//SENSORSTURFF l = ALooper_prepare( ALOOPER_PREPARE_ALLOW_NON_CALLBACKS );
|
||||||
|
//SENSORSTURFF aeq = ASensorManager_createEventQueue( sm, (ALooper*)&l, 0, 0, 0 ); //XXX??!?! This looks wrong.
|
||||||
|
//SENSORSTURFF if(!no_sensor_for_gyro) {
|
||||||
|
//SENSORSTURFF ASensorEventQueue_enableSensor( aeq, as);
|
||||||
|
//SENSORSTURFF printf( "setEvent Rate: %d\n", ASensorEventQueue_setEventRate( aeq, as, 10000 ) );
|
||||||
|
//SENSORSTURFF }
|
||||||
|
//SENSORSTURFF
|
||||||
|
//SENSORSTURFF }
|
||||||
|
|
||||||
float accx, accy, accz;
|
//SENSORSTURFF float accx, accy, accz;
|
||||||
int accs;
|
//SENSORSTURFF int accs;
|
||||||
|
//SENSORSTURFF
|
||||||
void AccCheck()
|
//SENSORSTURFF void AccCheck()
|
||||||
{
|
//SENSORSTURFF {
|
||||||
if(no_sensor_for_gyro) {
|
//SENSORSTURFF if(no_sensor_for_gyro) {
|
||||||
return;
|
//SENSORSTURFF return;
|
||||||
}
|
//SENSORSTURFF }
|
||||||
|
//SENSORSTURFF
|
||||||
ASensorEvent evt;
|
//SENSORSTURFF ASensorEvent evt;
|
||||||
do
|
//SENSORSTURFF do
|
||||||
{
|
//SENSORSTURFF {
|
||||||
ssize_t s = ASensorEventQueue_getEvents( aeq, &evt, 1 );
|
//SENSORSTURFF ssize_t s = ASensorEventQueue_getEvents( aeq, &evt, 1 );
|
||||||
if( s <= 0 ) break;
|
//SENSORSTURFF if( s <= 0 ) break;
|
||||||
accx = evt.vector.v[0];
|
//SENSORSTURFF accx = evt.vector.v[0];
|
||||||
accy = evt.vector.v[1];
|
//SENSORSTURFF accy = evt.vector.v[1];
|
||||||
accz = evt.vector.v[2];
|
//SENSORSTURFF accz = evt.vector.v[2];
|
||||||
mountainangle /*degrees*/ -= accz;// * 3.1415 / 360.0;// / 100.0;
|
//SENSORSTURFF mountainangle /*degrees*/ -= accz;// * 3.1415 / 360.0;// / 100.0;
|
||||||
mountainoffsety += accy;
|
//SENSORSTURFF mountainoffsety += accy;
|
||||||
mountainoffsetx += accx;
|
//SENSORSTURFF mountainoffsetx += accx;
|
||||||
accs++;
|
//SENSORSTURFF accs++;
|
||||||
} while( 1 );
|
//SENSORSTURFF } while( 1 );
|
||||||
}
|
//SENSORSTURFF }
|
||||||
|
|
||||||
unsigned frames = 0;
|
unsigned frames = 0;
|
||||||
unsigned long iframeno = 0;
|
unsigned long iframeno = 0;
|
||||||
|
@ -353,164 +355,164 @@ void HandleThisWindowTermination()
|
||||||
|
|
||||||
|
|
||||||
uint32_t randomtexturedata[256*256];
|
uint32_t randomtexturedata[256*256];
|
||||||
//uint32_t webviewdata[500*500];
|
//webview //uint32_t webviewdata[500*500];
|
||||||
//char fromJSBuffer[128];
|
//webview //char fromJSBuffer[128];
|
||||||
|
//webview
|
||||||
|
//webview //void CheckWebView( void * v )
|
||||||
|
//webview //{
|
||||||
|
//webview // static int runno = 0;
|
||||||
|
//webview // WebViewNativeActivityObject * wvn = (WebViewNativeActivityObject*)v;
|
||||||
|
//webview // if( WebViewGetProgress( wvn ) != 100 ) return;
|
||||||
|
//webview //
|
||||||
|
//webview // runno++;
|
||||||
|
//webview // if( runno == 1 )
|
||||||
|
//webview // {
|
||||||
|
//webview // // The attach (initial) message payload has no meaning.
|
||||||
|
//webview // WebViewPostMessage( wvn, "", 1 );
|
||||||
|
//webview // }
|
||||||
|
//webview // else
|
||||||
|
//webview // {
|
||||||
|
//webview // // Invoke JavaScript, which calls a function to send a webmessage
|
||||||
|
//webview // // back into C land.
|
||||||
|
//webview // WebViewExecuteJavascript( wvn, "SendMessageToC();" );
|
||||||
|
//webview //
|
||||||
|
//webview // // Send a WebMessage into the JavaScript code.
|
||||||
|
//webview // char st[128];
|
||||||
|
//webview // sprintf( st, "Into JavaScript %d\n", runno );
|
||||||
|
//webview // WebViewPostMessage( wvn, st, 0 );
|
||||||
|
//webview // }
|
||||||
|
//webview //}
|
||||||
|
|
||||||
//void CheckWebView( void * v )
|
//webview//jobject g_attachLooper;
|
||||||
//{
|
|
||||||
// static int runno = 0;
|
|
||||||
// WebViewNativeActivityObject * wvn = (WebViewNativeActivityObject*)v;
|
|
||||||
// if( WebViewGetProgress( wvn ) != 100 ) return;
|
|
||||||
//
|
|
||||||
// runno++;
|
|
||||||
// if( runno == 1 )
|
|
||||||
// {
|
|
||||||
// // The attach (initial) message payload has no meaning.
|
|
||||||
// WebViewPostMessage( wvn, "", 1 );
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// // Invoke JavaScript, which calls a function to send a webmessage
|
|
||||||
// // back into C land.
|
|
||||||
// WebViewExecuteJavascript( wvn, "SendMessageToC();" );
|
|
||||||
//
|
|
||||||
// // Send a WebMessage into the JavaScript code.
|
|
||||||
// char st[128];
|
|
||||||
// sprintf( st, "Into JavaScript %d\n", runno );
|
|
||||||
// WebViewPostMessage( wvn, st, 0 );
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
jobject g_attachLooper;
|
//webview //void SetupWebView( void * v )
|
||||||
|
//webview //{
|
||||||
//void SetupWebView( void * v )
|
//webview // WebViewNativeActivityObject * wvn = (WebViewNativeActivityObject*)v;
|
||||||
//{
|
//webview //
|
||||||
// WebViewNativeActivityObject * wvn = (WebViewNativeActivityObject*)v;
|
//webview //
|
||||||
//
|
//webview // const struct JNINativeInterface * env = 0;
|
||||||
//
|
//webview // const struct JNINativeInterface ** envptr = &env;
|
||||||
// const struct JNINativeInterface * env = 0;
|
//webview // const struct JNIInvokeInterface ** jniiptr = gapp->activity->vm;
|
||||||
// const struct JNINativeInterface ** envptr = &env;
|
//webview // const struct JNIInvokeInterface * jnii = *jniiptr;
|
||||||
// const struct JNIInvokeInterface ** jniiptr = gapp->activity->vm;
|
//webview //
|
||||||
// const struct JNIInvokeInterface * jnii = *jniiptr;
|
//webview // jnii->AttachCurrentThread( jniiptr, &envptr, NULL);
|
||||||
//
|
//webview // env = (*envptr);
|
||||||
// jnii->AttachCurrentThread( jniiptr, &envptr, NULL);
|
//webview //
|
||||||
// env = (*envptr);
|
//webview // while( g_attachLooper == 0 ) usleep(1);
|
||||||
//
|
//webview // WebViewCreate( wvn, "file:///android_asset/index.html", g_attachLooper, 500, 500 );
|
||||||
// while( g_attachLooper == 0 ) usleep(1);
|
//webview // //WebViewCreate( wvn, "about:blank", g_attachLooper, 500, 500 );
|
||||||
// WebViewCreate( wvn, "file:///android_asset/index.html", g_attachLooper, 500, 500 );
|
//webview //}
|
||||||
// //WebViewCreate( wvn, "about:blank", g_attachLooper, 500, 500 );
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
//pthread_t jsthread;
|
//webview //pthread_t jsthread;
|
||||||
//
|
//webview //
|
||||||
//void * JavscriptThread( void * v )
|
//webview //void * JavscriptThread( void * v )
|
||||||
//{
|
//webview //{
|
||||||
// const struct JNINativeInterface * env = 0;
|
//webview // const struct JNINativeInterface * env = 0;
|
||||||
// const struct JNINativeInterface ** envptr = &env;
|
//webview // const struct JNINativeInterface ** envptr = &env;
|
||||||
// const struct JNIInvokeInterface ** jniiptr = gapp->activity->vm;
|
//webview // const struct JNIInvokeInterface ** jniiptr = gapp->activity->vm;
|
||||||
// const struct JNIInvokeInterface * jnii = *jniiptr;
|
//webview // const struct JNIInvokeInterface * jnii = *jniiptr;
|
||||||
//
|
//webview //
|
||||||
// jnii->AttachCurrentThread( jniiptr, &envptr, NULL);
|
//webview // jnii->AttachCurrentThread( jniiptr, &envptr, NULL);
|
||||||
// env = (*envptr);
|
//webview // env = (*envptr);
|
||||||
//
|
//webview //
|
||||||
// // Create a looper on this thread...
|
//webview // // Create a looper on this thread...
|
||||||
// jclass LooperClass = env->FindClass(envptr, "android/os/Looper");
|
//webview // jclass LooperClass = env->FindClass(envptr, "android/os/Looper");
|
||||||
// jmethodID myLooperMethod = env->GetStaticMethodID(envptr, LooperClass, "myLooper", "()Landroid/os/Looper;");
|
//webview // jmethodID myLooperMethod = env->GetStaticMethodID(envptr, LooperClass, "myLooper", "()Landroid/os/Looper;");
|
||||||
// jobject thisLooper = env->CallStaticObjectMethod( envptr, LooperClass, myLooperMethod );
|
//webview // jobject thisLooper = env->CallStaticObjectMethod( envptr, LooperClass, myLooperMethod );
|
||||||
// if( !thisLooper )
|
//webview // if( !thisLooper )
|
||||||
// {
|
//webview // {
|
||||||
// jmethodID prepareMethod = env->GetStaticMethodID(envptr, LooperClass, "prepare", "()V");
|
//webview // jmethodID prepareMethod = env->GetStaticMethodID(envptr, LooperClass, "prepare", "()V");
|
||||||
// env->CallStaticVoidMethod( envptr, LooperClass, prepareMethod );
|
//webview // env->CallStaticVoidMethod( envptr, LooperClass, prepareMethod );
|
||||||
// thisLooper = env->CallStaticObjectMethod( envptr, LooperClass, myLooperMethod );
|
//webview // thisLooper = env->CallStaticObjectMethod( envptr, LooperClass, myLooperMethod );
|
||||||
// g_attachLooper = env->NewGlobalRef(envptr, thisLooper);
|
//webview // g_attachLooper = env->NewGlobalRef(envptr, thisLooper);
|
||||||
// }
|
//webview // }
|
||||||
//
|
//webview //
|
||||||
// jmethodID getQueueMethod = env->GetMethodID( envptr, LooperClass, "getQueue", "()Landroid/os/MessageQueue;" );
|
//webview // jmethodID getQueueMethod = env->GetMethodID( envptr, LooperClass, "getQueue", "()Landroid/os/MessageQueue;" );
|
||||||
// jobject lque = env->CallObjectMethod( envptr, g_attachLooper, getQueueMethod );
|
//webview // jobject lque = env->CallObjectMethod( envptr, g_attachLooper, getQueueMethod );
|
||||||
//
|
//webview //
|
||||||
// jclass MessageQueueClass = env->FindClass(envptr, "android/os/MessageQueue");
|
//webview // jclass MessageQueueClass = env->FindClass(envptr, "android/os/MessageQueue");
|
||||||
// jmethodID nextMethod = env->GetMethodID( envptr, MessageQueueClass, "next", "()Landroid/os/Message;" );
|
//webview // jmethodID nextMethod = env->GetMethodID( envptr, MessageQueueClass, "next", "()Landroid/os/Message;" );
|
||||||
//
|
//webview //
|
||||||
// jclass MessageClass = env->FindClass(envptr, "android/os/Message");
|
//webview // jclass MessageClass = env->FindClass(envptr, "android/os/Message");
|
||||||
// jfieldID objid = env->GetFieldID( envptr, MessageClass, "obj", "Ljava/lang/Object;" );
|
//webview // jfieldID objid = env->GetFieldID( envptr, MessageClass, "obj", "Ljava/lang/Object;" );
|
||||||
// jclass PairClass = env->FindClass(envptr, "android/util/Pair");
|
//webview // jclass PairClass = env->FindClass(envptr, "android/util/Pair");
|
||||||
// jfieldID pairfirst = env->GetFieldID( envptr, PairClass, "first", "Ljava/lang/Object;" );
|
//webview // jfieldID pairfirst = env->GetFieldID( envptr, PairClass, "first", "Ljava/lang/Object;" );
|
||||||
//
|
//webview //
|
||||||
// while(1)
|
//webview // while(1)
|
||||||
// {
|
//webview // {
|
||||||
// // Instead of using Looper::loop(), we just call next on the looper object.
|
//webview // // Instead of using Looper::loop(), we just call next on the looper object.
|
||||||
// jobject msg = env->CallObjectMethod( envptr, lque, nextMethod );
|
//webview // jobject msg = env->CallObjectMethod( envptr, lque, nextMethod );
|
||||||
// jobject innerObj = env->GetObjectField( envptr, msg, objid );
|
//webview // jobject innerObj = env->GetObjectField( envptr, msg, objid );
|
||||||
// const char * name;
|
//webview // const char * name;
|
||||||
// jstring strObj;
|
//webview // jstring strObj;
|
||||||
// jclass innerClass;
|
//webview // jclass innerClass;
|
||||||
//
|
//webview //
|
||||||
// // Check Object Type
|
//webview // // Check Object Type
|
||||||
// {
|
//webview // {
|
||||||
// innerClass = env->GetObjectClass( envptr, innerObj );
|
//webview // innerClass = env->GetObjectClass( envptr, innerObj );
|
||||||
// jmethodID mid = env->GetMethodID( envptr, innerClass, "getClass", "()Ljava/lang/Class;");
|
//webview // jmethodID mid = env->GetMethodID( envptr, innerClass, "getClass", "()Ljava/lang/Class;");
|
||||||
// jobject clsObj = env->CallObjectMethod( envptr, innerObj, mid );
|
//webview // jobject clsObj = env->CallObjectMethod( envptr, innerObj, mid );
|
||||||
// jclass clazzz = env->GetObjectClass( envptr, clsObj );
|
//webview // jclass clazzz = env->GetObjectClass( envptr, clsObj );
|
||||||
// mid = env->GetMethodID(envptr, clazzz, "getName", "()Ljava/lang/String;");
|
//webview // mid = env->GetMethodID(envptr, clazzz, "getName", "()Ljava/lang/String;");
|
||||||
// strObj = (jstring)env->CallObjectMethod( envptr, clsObj, mid);
|
//webview // strObj = (jstring)env->CallObjectMethod( envptr, clsObj, mid);
|
||||||
// name = env->GetStringUTFChars( envptr, strObj, 0);
|
//webview // name = env->GetStringUTFChars( envptr, strObj, 0);
|
||||||
// env->DeleteLocalRef( envptr, clsObj );
|
//webview // env->DeleteLocalRef( envptr, clsObj );
|
||||||
// env->DeleteLocalRef( envptr, clazzz );
|
//webview // env->DeleteLocalRef( envptr, clazzz );
|
||||||
// }
|
//webview // }
|
||||||
//
|
//webview //
|
||||||
// if( strcmp( name, "z5" ) == 0 )
|
//webview // if( strcmp( name, "z5" ) == 0 )
|
||||||
// {
|
//webview // {
|
||||||
// // Special, Some Androids (notably Meta Quest) use a different private message type.
|
//webview // // Special, Some Androids (notably Meta Quest) use a different private message type.
|
||||||
// jfieldID mstrf = env->GetFieldID( envptr, innerClass, "a", "[B" );
|
//webview // jfieldID mstrf = env->GetFieldID( envptr, innerClass, "a", "[B" );
|
||||||
// jbyteArray jba = (jstring)env->GetObjectField(envptr, innerObj, mstrf );
|
//webview // jbyteArray jba = (jstring)env->GetObjectField(envptr, innerObj, mstrf );
|
||||||
// int len = env->GetArrayLength( envptr, jba );
|
//webview // int len = env->GetArrayLength( envptr, jba );
|
||||||
// jboolean isCopy = 0;
|
//webview // jboolean isCopy = 0;
|
||||||
// jbyte * bufferPtr = env->GetByteArrayElements(envptr, jba, &isCopy);
|
//webview // jbyte * bufferPtr = env->GetByteArrayElements(envptr, jba, &isCopy);
|
||||||
//
|
//webview //
|
||||||
// if( len >= 6 )
|
//webview // if( len >= 6 )
|
||||||
// {
|
//webview // {
|
||||||
// const char *descr = (const char*)bufferPtr + 6;
|
//webview // const char *descr = (const char*)bufferPtr + 6;
|
||||||
// char tcpy[len-5];
|
//webview // char tcpy[len-5];
|
||||||
// memcpy( tcpy, descr, len-6 );
|
//webview // memcpy( tcpy, descr, len-6 );
|
||||||
// tcpy[len-6] = 0;
|
//webview // tcpy[len-6] = 0;
|
||||||
// snprintf( fromJSBuffer, sizeof( fromJSBuffer)-1, "WebMessage: %s\n", tcpy );
|
//webview // snprintf( fromJSBuffer, sizeof( fromJSBuffer)-1, "WebMessage: %s\n", tcpy );
|
||||||
//
|
//webview //
|
||||||
// env->DeleteLocalRef( envptr, jba );
|
//webview // env->DeleteLocalRef( envptr, jba );
|
||||||
// }
|
//webview // }
|
||||||
// }
|
//webview // }
|
||||||
// else
|
//webview // else
|
||||||
// {
|
//webview // {
|
||||||
// jobject MessagePayload = env->GetObjectField( envptr, innerObj, pairfirst );
|
//webview // jobject MessagePayload = env->GetObjectField( envptr, innerObj, pairfirst );
|
||||||
// // MessagePayload is a org.chromium.content_public.browser.MessagePayload
|
//webview // // MessagePayload is a org.chromium.content_public.browser.MessagePayload
|
||||||
//
|
//webview //
|
||||||
// jclass mpclass = env->GetObjectClass( envptr, MessagePayload );
|
//webview // jclass mpclass = env->GetObjectClass( envptr, MessagePayload );
|
||||||
//
|
//webview //
|
||||||
// // Get field "b" which is the web message payload.
|
//webview // // Get field "b" which is the web message payload.
|
||||||
// // If you are using binary sockets, it will be in `c` and be a byte array.
|
//webview // // If you are using binary sockets, it will be in `c` and be a byte array.
|
||||||
// jfieldID mstrf = env->GetFieldID( envptr, mpclass, "b", "Ljava/lang/String;" );
|
//webview // jfieldID mstrf = env->GetFieldID( envptr, mpclass, "b", "Ljava/lang/String;" );
|
||||||
// jstring strObjDescr = (jstring)env->GetObjectField(envptr, MessagePayload, mstrf );
|
//webview // jstring strObjDescr = (jstring)env->GetObjectField(envptr, MessagePayload, mstrf );
|
||||||
//
|
//webview //
|
||||||
// const char *descr = env->GetStringUTFChars( envptr, strObjDescr, 0);
|
//webview // const char *descr = env->GetStringUTFChars( envptr, strObjDescr, 0);
|
||||||
// snprintf( fromJSBuffer, sizeof( fromJSBuffer)-1, "WebMessage: %s\n", descr );
|
//webview // snprintf( fromJSBuffer, sizeof( fromJSBuffer)-1, "WebMessage: %s\n", descr );
|
||||||
//
|
//webview //
|
||||||
// env->ReleaseStringUTFChars(envptr, strObjDescr, descr);
|
//webview // env->ReleaseStringUTFChars(envptr, strObjDescr, descr);
|
||||||
// env->DeleteLocalRef( envptr, strObjDescr );
|
//webview // env->DeleteLocalRef( envptr, strObjDescr );
|
||||||
// env->DeleteLocalRef( envptr, MessagePayload );
|
//webview // env->DeleteLocalRef( envptr, MessagePayload );
|
||||||
// env->DeleteLocalRef( envptr, mpclass );
|
//webview // env->DeleteLocalRef( envptr, mpclass );
|
||||||
// }
|
//webview // }
|
||||||
// env->ReleaseStringUTFChars(envptr, strObj, name);
|
//webview // env->ReleaseStringUTFChars(envptr, strObj, name);
|
||||||
// env->DeleteLocalRef( envptr, strObj );
|
//webview // env->DeleteLocalRef( envptr, strObj );
|
||||||
// env->DeleteLocalRef( envptr, msg );
|
//webview // env->DeleteLocalRef( envptr, msg );
|
||||||
// env->DeleteLocalRef( envptr, innerObj );
|
//webview // env->DeleteLocalRef( envptr, innerObj );
|
||||||
// env->DeleteLocalRef( envptr, innerClass );
|
//webview // env->DeleteLocalRef( envptr, innerClass );
|
||||||
// }
|
//webview // }
|
||||||
//}
|
//webview //}
|
||||||
//
|
//webview //
|
||||||
//void SetupJSThread()
|
//webview //void SetupJSThread()
|
||||||
//{
|
//webview //{
|
||||||
// pthread_create( &jsthread, 0, JavscriptThread, 0 );
|
//webview // pthread_create( &jsthread, 0, JavscriptThread, 0 );
|
||||||
//}
|
//webview //}
|
||||||
|
|
||||||
int main( int argc, char ** argv )
|
int main( int argc, char ** argv )
|
||||||
{
|
{
|
||||||
|
@ -542,16 +544,17 @@ int main( int argc, char ** argv )
|
||||||
assettext = temp;
|
assettext = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetupIMU();
|
//SENSORSTURFF // Inertial Measurement Unit (gyroscopes and accelerometer)
|
||||||
|
//SENSORSTURFF SetupIMU();
|
||||||
|
|
||||||
// Disabled, for now.
|
//SOUND // Disabled, for now.
|
||||||
//InitCNFAAndroid( AudioCallback, "A Name", SAMPLE_RATE, 0, 1, 0, SAMPLE_COUNT, 0, 0, 0 );
|
//SOUND //InitCNFAAndroid( AudioCallback, "A Name", SAMPLE_RATE, 0, 1, 0, SAMPLE_COUNT, 0, 0, 0 );
|
||||||
|
|
||||||
// SetupJSThread();
|
//webview// SetupJSThread();
|
||||||
|
|
||||||
// Create webview and wait for its completion
|
//webview // Create webview and wait for its completion
|
||||||
// RunCallbackOnUIThread( SetupWebView, &MyWebView );
|
//webview // RunCallbackOnUIThread( SetupWebView, &MyWebView );
|
||||||
// while( !MyWebView.WebViewObject ) usleep(1);
|
//webview // while( !MyWebView.WebViewObject ) usleep(1);
|
||||||
|
|
||||||
Log( "Startup Complete" );
|
Log( "Startup Complete" );
|
||||||
|
|
||||||
|
@ -566,12 +569,12 @@ int main( int argc, char ** argv )
|
||||||
}
|
}
|
||||||
|
|
||||||
CNFGHandleInput();
|
CNFGHandleInput();
|
||||||
AccCheck();
|
//SENSORSTURFF AccCheck();
|
||||||
|
|
||||||
if( suspended ) { usleep(50000); continue; }
|
if( suspended ) { usleep(50000); continue; }
|
||||||
|
|
||||||
// RunCallbackOnUIThread( (void(*)(void*))WebViewRequestRenderToCanvas, &MyWebView );
|
//webview // RunCallbackOnUIThread( (void(*)(void*))WebViewRequestRenderToCanvas, &MyWebView );
|
||||||
// RunCallbackOnUIThread( CheckWebView, &MyWebView );
|
//webview // RunCallbackOnUIThread( CheckWebView, &MyWebView );
|
||||||
|
|
||||||
CNFGClearFrame();
|
CNFGClearFrame();
|
||||||
CNFGColor( 0xFFFFFFFF );
|
CNFGColor( 0xFFFFFFFF );
|
||||||
|
@ -587,7 +590,7 @@ int main( int argc, char ** argv )
|
||||||
|
|
||||||
CNFGPenX = 0; CNFGPenY = 480;
|
CNFGPenX = 0; CNFGPenY = 480;
|
||||||
char st[50];
|
char st[50];
|
||||||
sprintf( st, "%dx%d %d %d %d %d %d %d\n%d %d\n%5.2f %5.2f %5.2f %d", screenx, screeny, lastbuttonx, lastbuttony, lastmotionx, lastmotiony, lastkey, lastkeydown, lastbid, lastmask, accx, accy, accz, accs );
|
sprintf( st, "%dx%d %d %d %d %d %d %d\n%d %d", screenx, screeny, lastbuttonx, lastbuttony, lastmotionx, lastmotiony, lastkey, lastkeydown, lastbid, lastmask);
|
||||||
CNFGDrawText( st, 10 );
|
CNFGDrawText( st, 10 );
|
||||||
CNFGSetLineWidth( 2 );
|
CNFGSetLineWidth( 2 );
|
||||||
|
|
||||||
|
@ -641,8 +644,8 @@ int main( int argc, char ** argv )
|
||||||
randomtexturedata[x+y*256] = x | ((x*394543L+y*355+iframeno*3)<<8);
|
randomtexturedata[x+y*256] = x | ((x*394543L+y*355+iframeno*3)<<8);
|
||||||
CNFGBlitImage( randomtexturedata, 100, 600, 256, 256 );
|
CNFGBlitImage( randomtexturedata, 100, 600, 256, 256 );
|
||||||
|
|
||||||
//WebViewNativeGetPixels( &MyWebView, webviewdata, 500, 500 );
|
//webview //WebViewNativeGetPixels( &MyWebView, webviewdata, 500, 500 );
|
||||||
//CNFGBlitImage( webviewdata, 500, 640, 500, 500 );
|
//webview //CNFGBlitImage( webviewdata, 500, 640, 500, 500 );
|
||||||
|
|
||||||
frames++;
|
frames++;
|
||||||
//On Android, CNFGSwapBuffers must be called, and CNFGUpdateScreenWithBitmap does not have an implied framebuffer swap.
|
//On Android, CNFGSwapBuffers must be called, and CNFGUpdateScreenWithBitmap does not have an implied framebuffer swap.
|
||||||
|
|
Loading…
Add table
Reference in a new issue