Ejemplo n.º 1
0
// This is called from main()/WinMain()/whatever.
int MojoSetup_main(int argc, char **argv)
{
    GArgc = argc;
    GArgv = (const char **) argv;

    if (cmdline("buildver"))
    {
        printf("%s\n", GBuildVer);
        return 0;
    } // if

    #if TEST_LAUNCH_BROWSER_CODE
    return MojoSetup_testLaunchBrowserCode(argc, argv);
    #endif

    #if TEST_ARCHIVE_CODE
    return MojoSetup_testArchiveCode(argc, argv);
    #endif

    #if TEST_NETWORK_CODE
    return MojoSetup_testNetworkCode(argc, argv);
    #endif

    if (!initEverything())
        return 1;

    // Jump into Lua for the heavy lifting.
    MojoLua_runFile("mojosetup_mainline");
    deinitEverything();

    return 0;
} // MojoSetup_main
Ejemplo n.º 2
0
int main(int argc, char **argv){
    initEverything();
    
    loadScoreFile();
    canRun = mainMenu;
    while (canRun != leave) {
        quit = 0;
        switch (canRun) {
               case mainMenu:
            initMainMenu();
            break;

               case highScore:
            initHighScore();
            break;

               case credits:
            initCredits();
            break;

               case onePlayer:
            initOnePlayer();
            break;

               case twoPlayers:
            initTwoPlayers();
            break;

               case showWinner:
            InitWinner();
            break;
        }
    }
    return 0;
}
Ejemplo n.º 3
0
      Fuzzy (
          const cv::Mat &rows, 
          const int number_clusters,
          const float fuzziness, 
          const float epsilon,
          const SoftCDistType dist_type,
          const SoftCInitType init_type
          )
        :

        fuzziness_ (fuzziness),
        epsilon_ (epsilon),
        dist_type_ (dist_type),
        init_type_ (init_type),
        number_clusters_ (number_clusters),
        number_points_ (rows.rows),
        dimension_ (rows.cols),
        rows_ (rows)
        {
          centroids_ = cv::Mat::zeros  (number_clusters_, dimension_, CV_32FC1);
          membership_ 
            = cv::Mat::zeros  (number_points_, number_clusters_, CV_32FC1);
          new_membership_ 
            = cv::Mat::zeros  (number_points_, number_clusters_, CV_32FC1);
          initEverything ();
        };
Ejemplo n.º 4
0
int main(int argc, char* argv[]) {
	if (!initEverything()) {
		return 1;
	}
	LOG_INFO("Loading resources...")
	if (!loadEverything()) {
		return 1;
	}
	LOG_INFO("Starting demoooo");
	run();
	clean();
	return 0;
}
Ejemplo n.º 5
0
int main() {
    setbuf(stdout, NULL);
    initEverything();
    doSomeStuff();
    return 0;
}
Ejemplo n.º 6
0
int main(int argc, char *argv[])
{
	int done=0; double gpsUpdateRate, imuUpdateRate, eulerUpdateRate;
	long int gpsUpdateCount, imuUpdateCount, eulerUpdateCount, kalmanUpdateCount;
	double lastTime;
	
	// Program begins with the usual logging of data and so on...
	captureQuitSignal();
	shared = (Q_SHARED * )attach_memory(QBOATShareKey, sizeof(Q_SHARED));
	sharedDIAG = (DIAG_SHARED *)attach_memory(DIAGShareKey, sizeof(DIAG_SHARED));

	createDirectory();
	sleep(1);
	openKalmanlogfile();
		
	fprintf(stderr,"\nExtended Kalman Filter v 1.0 for the Q-boat (based on the Heli INS by Srik)");
	
	initEverything();
	lastTime = get_time();	
	// Now begin main loop... 
	while (!done) {
		// Run a loop to check if we've  received new data from the sensors...				
	if((get_time()-lastTime)>=1.0) {
		fprintf(stderr,"\nGPS %dHz, IMU %d Hz, EUL %d Hz, KAL %dHz,  LastTime %f",gpsUpdateCount, imuUpdateCount, eulerUpdateCount,kalmanUpdateCount,lastTime);	

		gpsUpdateCount = 0; imuUpdateCount = 0; eulerUpdateCount = 0; kalmanUpdateCount = 0; lastTime = get_time();
	}

	if(shared->SensorData.lastEulerKalmanTime<shared->SensorData.eulerUpdateTime) {
			++eulerUpdateCount;
			if(!init_compass)
				compassInit();
			else updateCompass();
		}
		#ifdef __USE3DMG_DATA__
		if(shared->SensorData.lastImuKalmanTime<shared->SensorData.imuUpdateTime) {
			if(!init_imu)
				imuInit();
			else updateImu();
			++imuUpdateCount;
		}
		#endif
		#ifdef __USEXBOW_DATA__
		if(shared->SensorData.lastImuKalmanTime<sharedDIAG->xbowData.lastXbowTime) {
			if(!init_imu)
				imuInit();
			else updateImu();
			++imuUpdateCount;
		}
		#endif
		if(shared->SensorData.lastGpsKalmanTime<shared->SensorData.gpsUpdateTime) {
			if(!init_gps)
				gpsInit();
			else updateGPS();
			++gpsUpdateCount;
		}
		if(!init_kf) {
			if(init_gps && init_compass && init_imu)
				kalmanInit();
		}
		// Update the State...
		if(init_kf && (get_time() - shared->kalmanData.lastKalmanUpdateTime)>=0.01) {
			updateState();
			++kalmanUpdateCount;
		}
		usleep(50);
	}
}
Ejemplo n.º 7
0
int main( int argc, char** argv )
{
	unsigned int tickDelta;
	unsigned int currTicks;
	unsigned int physicsTickAcc;
	int numPhysicsProcesses;
	float renderDelta;

#ifdef _DEBUG
	SDL_LogSetAllPriority( SDL_LOG_PRIORITY_VERBOSE );
#else
	SDL_LogSetAllPriority( SDL_LOG_PRIORITY_WARN );
#endif

	SDL_LogSetAllPriority( SDL_LOG_PRIORITY_VERBOSE );

	if( initEverything( ) < 0 ) {
		return 1;
	}

	srand( (unsigned int)time( NULL ) );

	/* main loop */
	running = 1;
	lastTicks = SDL_GetTicks( );
	physicsTickAcc = 0;

	gsmEnterState( &globalFSM, &titleScreenState );

	while( running ) {

		if( !focused ) {
			processEvents( 1 );
			continue;
		}

		currTicks = SDL_GetTicks( );
		tickDelta = currTicks - lastTicks;
		lastTicks = currTicks;

		physicsTickAcc += tickDelta;

		/* process input */
		processEvents( 0 );
		sys_Process( );
		gsmProcess( &globalFSM );

		/* process movement and collision */
		numPhysicsProcesses = 0;
		while( physicsTickAcc > PHYSICS_TICK ) {
			sys_PhysicsTick( PHYSICS_DELTA );
			gsmPhysicsTick( &globalFSM, PHYSICS_DELTA );
			physicsTickAcc -= PHYSICS_TICK;
			++numPhysicsProcesses;
		}

		/* rendering */
		if( numPhysicsProcesses > 0 ) {
			/* set the new render positions */
			renderDelta = PHYSICS_DELTA * (float)numPhysicsProcesses;
			gfx_ClearDrawCommands( renderDelta );
			cam_FinalizeStates( renderDelta );

			/* render all the things */
			sys_Draw( );
			gsmDraw( &globalFSM );
		}

		float dt = (float)tickDelta / 1000.0f;
		cam_Update( dt );
		gfx_Render( dt );
		// flip here so we don't have to store the window anywhere else
		SDL_GL_SwapWindow( window );
	}

	return 0;
}