//----------------------------------------------------------------// void GlutRefreshContext () { AKUContextID context = AKUGetContext (); if ( context ) { AKUDeleteContext ( context ); } AKUCreateContext (); #ifdef GLUTHOST_USE_FMOD_DESIGNER AKUFmodDesignerInit (); #endif #ifdef GLUTHOST_USE_FMOD_EX AKUFmodExInit (); #endif #ifdef GLUTHOST_USE_LUAEXT AKUExtLoadLuacrypto (); AKUExtLoadLuacurl (); AKUExtLoadLuafilesystem (); AKUExtLoadLuasocket (); AKUExtLoadLuasql (); AKUExtLoadLuamsgpack (); #endif #ifdef GLUTHOST_USE_UNTZ AKUUntzInit (); #endif #ifdef GLUTHOST_USE_AUDIOSAMPLER AKUAudioSamplerInit(); #endif #ifdef GLUTHOST_USE_PARTICLE_PRESETS ParticlePresets (); #endif AKUSetInputConfigurationName ( "AKUGlut" ); AKUReserveInputDevices ( GlutInputDeviceID::TOTAL ); AKUSetInputDevice ( GlutInputDeviceID::DEVICE, "device" ); AKUReserveInputDeviceSensors ( GlutInputDeviceID::DEVICE, GlutInputDeviceSensorID::TOTAL ); AKUSetInputDeviceKeyboard ( GlutInputDeviceID::DEVICE, GlutInputDeviceSensorID::KEYBOARD, "keyboard" ); AKUSetInputDevicePointer ( GlutInputDeviceID::DEVICE, GlutInputDeviceSensorID::POINTER, "pointer" ); AKUSetInputDeviceButton ( GlutInputDeviceID::DEVICE, GlutInputDeviceSensorID::MOUSE_LEFT, "mouseLeft" ); AKUSetInputDeviceButton ( GlutInputDeviceID::DEVICE, GlutInputDeviceSensorID::MOUSE_MIDDLE, "mouseMiddle" ); AKUSetInputDeviceButton ( GlutInputDeviceID::DEVICE, GlutInputDeviceSensorID::MOUSE_RIGHT, "mouseRight" ); AKUSetFunc_EnterFullscreenMode ( _AKUEnterFullscreenModeFunc ); AKUSetFunc_ExitFullscreenMode ( _AKUExitFullscreenModeFunc ); AKUSetFunc_OpenWindow ( _AKUOpenWindowFunc ); #ifdef GLUTHOST_USE_DEBUGGER AKUSetFunc_ErrorTraceback ( _AKUErrorTracebackFunc ); AKUDebugHarnessInit (); #endif AKURunBytecode ( moai_lua, moai_lua_SIZE ); }
//----------------------------------------------------------------// extern "C" void Java_com_ziplinegames_moai_Moai_AKUInit ( JNIEnv* env, jclass obj ) { MOAIAppAndroid::Affirm (); REGISTER_LUA_CLASS ( MOAIAppAndroid ); MOAIDialogAndroid::Affirm (); REGISTER_LUA_CLASS ( MOAIDialogAndroid ); MOAIMoviePlayerAndroid::Affirm (); REGISTER_LUA_CLASS ( MOAIMoviePlayerAndroid ); #ifndef DISABLE_ADCOLONY MOAIAdColonyAndroid::Affirm (); REGISTER_LUA_CLASS ( MOAIAdColonyAndroid ); #endif #ifndef DISABLE_BILLING MOAIBillingAndroid::Affirm (); REGISTER_LUA_CLASS ( MOAIBillingAndroid ); #endif #ifndef DISABLE_CHARTBOOST MOAIChartBoostAndroid::Affirm (); REGISTER_LUA_CLASS ( MOAIChartBoostAndroid ); #endif #ifndef DISABLE_CRITTERCISM MOAICrittercismAndroid::Affirm (); REGISTER_LUA_CLASS ( MOAICrittercismAndroid ); #endif #ifndef DISABLE_FACEBOOK MOAIFacebookAndroid::Affirm (); REGISTER_LUA_CLASS ( MOAIFacebookAndroid ); #endif #ifndef DISABLE_NOTIFICATIONS MOAINotificationsAndroid::Affirm (); REGISTER_LUA_CLASS ( MOAINotificationsAndroid ); #endif #ifndef DISABLE_TAPJOY MOAITapjoyAndroid::Affirm (); REGISTER_LUA_CLASS ( MOAITapjoyAndroid ); #endif AKURunBytecode ( moai_lua, moai_lua_SIZE ); inputQueue = new LockingQueue < InputEvent > (); }
void MoaiWidget::refreshContext(){ printf("Starting load\n"); AKUContextID context = AKUGetContext (); if ( context ) { AKUDeleteContext ( context ); } AKUCreateContext (); AKUExtLoadLuacrypto (); AKUExtLoadLuacurl (); AKUExtLoadLuafilesystem (); AKUExtLoadLuasocket (); AKUExtLoadLuasql (); AKUSetInputConfigurationName ( "AKUQT" ); AKUReserveInputDevices ( QTInputDeviceID::TOTAL ); AKUSetInputDevice ( QTInputDeviceID::DEVICE, "device" ); AKUReserveInputDeviceSensors ( QTInputDeviceID::DEVICE, QTInputDeviceSensorID::TOTAL ); AKUSetInputDeviceKeyboard ( QTInputDeviceID::DEVICE, QTInputDeviceSensorID::KEYBOARD, "keyboard" ); AKUSetInputDevicePointer ( QTInputDeviceID::DEVICE, QTInputDeviceSensorID::POINTER, "pointer" ); AKUSetInputDeviceButton ( QTInputDeviceID::DEVICE, QTInputDeviceSensorID::MOUSE_LEFT, "mouseLeft" ); AKUSetInputDeviceButton ( QTInputDeviceID::DEVICE, QTInputDeviceSensorID::MOUSE_MIDDLE, "mouseMiddle" ); AKUSetInputDeviceButton ( QTInputDeviceID::DEVICE, QTInputDeviceSensorID::MOUSE_RIGHT, "mouseRight" ); AKUDetectGfxContext (); if(mWidth > 0 ) { AKUSetScreenSize ( mWidth, mHeight); AKUSetViewSize(mWidth,mHeight); } AKURunBytecode ( moai_lua, moai_lua_SIZE ); mTimer = new QTimer(this); mTimer->setInterval( 30 ); connect(mTimer, SIGNAL(timeout()), this, SLOT(onUpdate()) ); mTimer->start(); mInitialized = true; printf("Initialized\n"); }
//----------------------------------------------------------------// int GlutHostTest ( int argc, char** argv ) { // TODO: integrate this nicely with host //AKUInitMemPool ( 100 * 1024 * 1024 ); atexit ( _cleanup ); glutInit ( &argc, argv ); AKUCreateContext (); AKUExtLoadLuacrypto (); AKUExtLoadLuacurl (); AKUExtLoadLuafilesystem (); AKUExtLoadLuasocket (); AKUExtLoadLuasql (); AKUTestInit (); AKUSetFunc_OpenWindow ( _AKUOpenWindowFunc ); AKURunBytecode ( moai_lua, moai_lua_SIZE ); // parse the commands int total = argc - 1; // parse results file first int i = 1; for ( ; i < total; ++i ) { char* arg = argv [ i ]; // results if ( strcmp ( arg, "-r" ) == 0 ) { AKUTestSetResultsFile ( argv [ ++i ]); } } i = 1; for ( ; i < total; ++i ) { char* arg = argv [ i ]; if ( arg [ 0 ] != '-' ) break; // staging if ( strcmp ( arg, "-s" ) == 0 ) { AKUTestSetStaging (); } // test if ( strcmp ( arg, "-t" ) == 0 ) { AKUTestRunTest ( argv [ ++i ]); } } for ( ; i < argc; ++i ) { AKUTestRunScript ( argv [ i ]); } if ( sHasWindow ) { glutTimerFunc ( 0, _onTimer, 0 ); glutMainLoop (); } return 0; }