Beispiel #1
0
//----------------------------------------------------------------//
int GlutHost ( int argc, char** argv ) {

	_printMoaiVersion ();

	#ifdef _DEBUG
		printf ( "DEBUG BUILD\n" );
	#endif

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

	glutInit ( &argc, argv );

	GlutRefreshContext ();

	char* lastScript = NULL;

	if ( argc < 2 ) {
		AKURunScript ( "main.lua" );
	}
	else {

		AKUSetArgv ( argv );

		for ( int i = 1; i < argc; ++i ) {
			char* arg = argv [ i ];
			if ( strcmp( arg, "-e" ) == 0 ) {
        // sDynamicallyReevaluateLuaFiles = true;
			}
			else if ( strcmp( arg, "-s" ) == 0 && ++i < argc ) {
				char* script = argv [ i ];
				AKURunString ( script );
			}
			else {
				AKURunScript ( arg );
				lastScript = arg;
			}
		}
	}
	
	//assuming that the last script is the entry point we watch for that directory and its subdirectories
	#if MOAI_WITH_FOLDER_WATCHER
		if ( lastScript && sDynamicallyReevaluateLuaFiles ) {
			#ifdef _WIN32
				winhostext_WatchFolder ( lastScript );
			#elif __APPLE__
				FWWatchFolder( lastScript );
			#endif
		}
	#endif
	
	if ( sHasWindow ) {
		glutTimerFunc ( 0, _onTimer, 0 );
		glutMainLoop ();
	}
	return 0;
}
Beispiel #2
0
//----------------------------------------------------------------//
int GlutHost ( int argc, char** argv ) {

	_printMoaiVersion ();

	#ifdef _DEBUG
		printf ( "DEBUG BUILD\n" );
	#endif

	atexit ( _cleanup );

	glutInit ( &argc, argv );

	GlutRefreshContext ( argc, argv);

 AKUModulesParseArgs ( argc, argv );

	if ( sHasWindow ) {
		glutTimerFunc ( 0, _onTimer, 0 );
		glutMainLoop ();
	}
	return 0;
}
Beispiel #3
0
//----------------------------------------------------------------//
int GlutHost ( int argc, char** argv ) {

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

	glutInit ( &argc, argv );

	GlutRefreshContext ();

	int i = 1;
	
	if ( argc > 2 && argv [ i ][ 0 ] == '-' && argv [ i ][ 1 ] == 'e' ) {
		sDynamicallyReevaluatsLuaFiles = true;
		i++;
	}
	
	for ( ; i < argc; ++i ) {
		AKURunScript ( argv [ i ]);
	}
	
	//assuming that the last script is the entry point we watch for that directory and its subdirectories
	if ( sDynamicallyReevaluatsLuaFiles ) {
		#ifdef _WIN32
			winhostext_WatchFolder ( argv [ argc - 1 ]);
		#elif __APPLE__
			FWWatchFolder( argv [ argc - 1 ] );
		#endif
	}
	
	if ( sHasWindow ) {
		glutTimerFunc ( 0, _onTimer, 0 );
		glutMainLoop ();
	}
	return 0;
}
static void reloadLuaFile(const char * file) {
	GlutRefreshContext ();
	AKURunScript(file);
	printf("%s reloaded.\n",file);
}