Exemple #1
0
//----------------------------------------------------------------//
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 );
}
Exemple #2
0
void GlutRefreshContext (int argc, char** argv) {

    AKUAppInitialize ();
	AKUModulesAppInitialize ();

	AKUCreateContext ();

    AKUModulesContextInitialize ();
	AKUModulesRunLuaAPIWrapper ();

	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_ShowCursor ( _AKUShowCursor );
	AKUSetFunc_HideCursor ( _AKUHideCursor );
	AKUSetFunc_OpenWindow ( _AKUOpenWindowFunc );

   

}
//----------------------------------------------------------------//
int work_moai_vfs ( int argc, char** argv ) {

	glutInit ( &argc, argv );

	AKUCreateContext ();

	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 );

	AKUMountVirtualDirectory ( "test", "anim-basic.zip" );
	AKUSetWorkingDirectory ( "test/anim-basic" );
	
	AKURunScript ( "main.lua" );

	return 0;
}
Exemple #4
0
//----------------------------------------------------------------//
int GlutHost ( int argc, char** argv ) {

	// TODO: integrate this nicely with host
	//AKUInitMemPool ( 100 * 1024 * 1024 );
	atexit ( _cleanup );

	glutInit ( &argc, argv );

	AKUCreateContext ();
	
	#ifdef GLUTHOST_USE_FMOD
		AKUFmodLoad ();
	#endif
	
	#ifdef GLUTHOST_USE_LUAEXT
		AKUExtLoadLuacrypto ();
		AKUExtLoadLuacurl ();
		AKUExtLoadLuasocket ();
		AKUExtLoadLuasql ();
	#endif
	
	#ifdef GLUTHOST_USE_UNTZ
		AKUUntzInit ();
	#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
		AKUDebugHarnessInit ();
	#endif

	for ( int i = 1; i < argc; ++i ) {
		AKURunScript ( argv [ i ]);
	}
	
	if ( sHasWindow ) {
		glutTimerFunc ( 0, _onTimer, 0 );
		glutMainLoop ();
	}
	return 0;
}
Exemple #5
0
	//----------------------------------------------------------------//
	extern "C" void Java_com_ziplinegames_moai_Moai_AKUSetInputDevice ( JNIEnv* env, jclass obj, jint deviceId, jstring jname ) {

		JNI_GET_CSTRING ( jname, name );

		AKUSetInputDevice ( deviceId, name );

		JNI_RELEASE_CSTRING ( jname, name );
	}
Exemple #6
0
//----------------------------------------------------------------//
int GlutHost ( int argc, char** argv ) {

	glutInit ( &argc, argv );

	AKUCreateContext ();
	
	#ifdef GLUTHOST_USE_FMOD
		AKUFmodLoad ();
	#endif
	
	#ifdef GLUTHOST_USE_LUAEXT
		AKUExtLoadLuacrypto ();
		AKUExtLoadLuacurl ();
		AKUExtLoadLuasocket ();
		AKUExtLoadLuasql ();
	#endif
	
	#ifdef GLUTHOST_USE_UNTZ
		AKUUntzInit ();
	#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 );
	AKUSetFunc_StartGameLoop ( _AKUStartGameLoopFunc );

	for ( int i = 1; i < argc; ++i ) {
		AKURunScript ( argv [ i ]);
	}
	return 0;
}
Exemple #7
0
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");
}
Exemple #8
0
void GlutRefreshContext () {

	AKUContextID context = AKUGetContext ();
	if ( context ) {
		AKUDeleteContext ( context );
	}
	AKUCreateContext ();
	
	AKUInitializeUtil ();
	AKUInitializeSim ();
  
	#if MOAI_WITH_BOX2D
		AKUInitializeBox2D ();
	#endif
	
	#if MOAI_WITH_CHIPMUNK
		AKUInitializeChipmunk ();
	#endif

	#if MOAI_WITH_FMOD_EX
		AKUFmodLoad ();
	#endif
	
	#if MOAI_WITH_FMOD_DESIGNER
		AKUFmodDesignerInit ();
	#endif
	
	#if MOAI_WITH_LUAEXT
		AKUExtLoadLuacrypto ();
		AKUExtLoadLuacurl ();
		AKUExtLoadLuafilesystem ();
		AKUExtLoadLuasocket ();
		AKUExtLoadLuasql ();
	#endif
	
	#if MOAI_WITH_HARNESS
		AKUSetFunc_ErrorTraceback ( _debuggerTracebackFunc );
		AKUDebugHarnessInit ();
	#endif
	
	#if MOAI_WITH_HTTP_CLIENT
		AKUInitializeHttpClient ();
	#endif 

	#if MOAI_WITH_PARTICLE_PRESETS
		ParticlePresets ();
	#endif
	
	#if MOAI_WITH_UNTZ
		AKUInitializeUntz ();
	#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 );

	AKURunData ( moai_lua, moai_lua_SIZE, AKU_DATA_STRING, AKU_DATA_ZIPPED );
}