Example #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 );
}
Example #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 );

   

}
Example #3
0
//----------------------------------------------------------------//
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;
}
Example #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;
}
Example #5
0
int main ( int argc, char *argv [])
{
    QApplication a ( argc, argv );

    MoaiQtHost::QtHostWindow* window =
        MoaiQtHost::QtHostWindow::getHostInstance ();
    MoaiQtHost::QtHostScriptLdr scriptLoader;

    AKUContextID context = AKUGetContext ();
    // Delete old context
    if ( context != 0 )
    {
        AKUDeleteContext ( context );
    }
    AKUCreateContext ();

    #ifdef QT_HOST_USE_LUAEXT
        AKUExtLoadLuacrypto ();
        AKUExtLoadLuacurl ();
        AKUExtLoadLuafilesystem ();
        AKUExtLoadLuasocket ();
        AKUExtLoadLuasql ();
    #endif

    #ifdef QT_HOST_USE_UNTZ
        AKUUntzInit ();
    #endif

    #ifdef QT_HOST_USE_FMOD_EX
        AKUFmodExInit ();
    #endif

    #ifdef QT_HOST_USE_FMOD_DESIGNER
        AKUFmodDesignerInit ();
    #endif

    #ifdef QT_HOST_USE_AUDIOSAMPLER
        AKUAudioSamplerInit ();
    #endif

    #ifdef QT_HOST_USE_PARTICLE_PRESETS
        ParticlePresets ();
    #endif

    window->setDevices ();
    window->setCallbacks ();

    scriptLoader.loadScripts ( argc, argv );
    window->startAkuTimers ();

    int execReturn = a.exec ();
    delete window;
    return execReturn;
}
Example #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;
}
//----------------------------------------------------------------//
int work_font_mipmap ( int argc, char **argv ) {
	
	AKUCreateContext ();

	MOAIImage image;
	
	image.Load ( "../../src/work/font-mipmap/screebie32.png" );
	
	_write_png ( image, "1.png" );
	
	image.MipReduce ();
	_write_png ( image, "2.png" );
	
	image.MipReduce ();
	_write_png ( image, "3.png" );

	return 0;
}
Example #8
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");
}
Example #9
0
//----------------------------------------------------------------//
int main ( int argc, char *argv []) {

	AKUAppInitialize ();
	AKUModulesAppInitialize ();

	AKUCreateContext ();
	AKUModulesContextInitialize ();

	// Setup signal handler: quit on Ctrl-C
	signal ( SIGTERM, signal_handler );
	signal ( SIGINT, signal_handler );
	
	AKUSetArgv ( argv );
	
	for ( int i = 1; i < argc; ++i ) {
		char* arg = argv [ i ];
		if ( strcmp( arg, "-s" ) == 0 && ++i < argc ) {
			AKURunString ( argv [ i ]);
		}
		else {
			AKURunScript ( arg );
		}
	}
	
	while ( sExitFlag == 0 ) {
		sleep ( 1 );
	}
	printf ( "Exiting on signal %d, waiting for all threads to finish...", sExitFlag );
	fflush ( stdout );
	
	AKUModulesAppFinalize ();
	AKUAppFinalize ();
	
	printf ( "%s", " done.\n" );

	return EXIT_SUCCESS;
}
Example #10
0
	//----------------------------------------------------------------//
	extern "C" int Java_com_ziplinegames_moai_Moai_AKUCreateContext ( JNIEnv* env, jclass obj ) {
		
		return AKUCreateContext ();
	}
Example #11
0
//----------------------------------------------------------------//
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;
}
Example #12
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 );
}