示例#1
0
文件: main.cpp 项目: Aerochip7/trunk
int main(int argc, char *argv[])
{
  dsr::ArgumentHelper ah;

  ah.new_string("input_filename.vtk", "The name of the input file", input_filename);
  //ah.new_string("output_filename", "The name of the output file", output_filename);
  
  //ARGUMENT_HELPER_BASICS(ah);
  ah.set_description("STEP2: A simple tutorial application for the X3DLoader library");
  ah.set_author("Kristian Sons, [email protected]");
  ah.set_version(0.9f);
  ah.set_build_date(__DATE__);

  ah.process(argc, argv);


  // Check output string
  if (fileExists(input_filename))
  {
	  TutorialApplication app;
	  app.setX3DFile(input_filename.c_str());

	  try {
		  app.go();
	  } catch( Exception& e ) {
		  fprintf(stderr, "An exception has occurred: %s\n",
			  e.getFullDescription().c_str());
	  }

	  return 0;
  }
  cerr << "Input file not found or not readable: " << input_filename << endl;
  return 1;
}
    int main(int argc, char *argv[])
#endif
    {
		TRACE_APPNAME("Ogre_App");
		TRACE_CONNECT();
		TRACE_MSG(trace::e_Info, trace::CTX_Default, "Initialized main application");

		// redirect Ogre log to our listener
        LogRedir redir;
        Ogre::LogManager * mLogManager = OGRE_NEW Ogre::LogManager();
        Ogre::Log * log = Ogre::LogManager::getSingleton().createLog("", true, false, false);
        if (log)
            log->addListener(&redir);

        // Create application object
        TutorialApplication app;

        try {
            app.go();
        } catch( Ogre::Exception& e ) {
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
            MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
            std::cerr << "An exception has occured: " <<
                e.getFullDescription().c_str() << std::endl;
#endif
        }

        if (log)
            log->removeListener(&redir);
        return 0;
    }
int main(int argc, char *argv[])
{
    // Create application object
    TutorialApplication app;

    try {
        app.go();
    } catch( Ogre::Exception& e ) {
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
        MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
        std::cerr << "An exception has occured: " <<
            e.getFullDescription().c_str() << std::endl;
#endif
    }

    return 0;
}