コード例 #1
0
ファイル: BaseManager.cpp プロジェクト: JohnCrash/iRobot
	BaseManager::BaseManager() :
		mGUI(nullptr),
		mInfo(nullptr),
		mFocusInfo(nullptr),
		mRoot(nullptr),
		mCamera(nullptr),
		mSceneManager(nullptr),
		mWindow(nullptr),
		mExit(false),
		mReset(true),
		mFastReset(false),
		mPluginCfgName("plugins.cfg"),
		mResourceXMLName("resources.xml"),
		mResourceFileName("mygui/MyGUI_Core.xml"),
		mNode(nullptr),
		mCoutSource(nullptr),
		mFrameCount(0)
	{
		#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
			mResourcePath = macBundlePath() + "/Contents/Resources/";
			mResourceXMLName = macBundlePath()+"/Contents/Resources/"+mResourceXMLName;
		#else
			mResourcePath = "../";
			mResourceXMLName = mResourcePath + mResourceXMLName;
		#endif
	}
コード例 #2
0
ファイル: graphics.cpp プロジェクト: Mononofu/OTE
void GraphicsImpl::setupResources()
{
	// Load resource paths from config file
	Ogre::ConfigFile cf;
	cf.load(resourcePath + "resources.cfg");

	// Go through all sections & settings in the file
	Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();

	Ogre::String secName, typeName, archName;

	while (seci.hasMoreElements()) {
		secName = seci.peekNextKey();
		Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
		Ogre::ConfigFile::SettingsMultiMap::iterator i;

		for (i = settings->begin(); i != settings->end(); ++i) {
			typeName = i->first;
			archName = i->second;
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
			// OS X does not set the working directory relative to the app,
			// In order to make things portable on OS X we need to provide
			// the loading with it's own bundle path location
			Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
			 Ogre::String(macBundlePath() + "/" + archName), typeName, secName);
#else
			Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
			 archName, typeName, secName);
#endif
		}
	}
}
コード例 #3
0
void
GraphicsManager::setupResources()
{
    ConfigFile configFile;
    configFile.load(m_resourcePath + "resources.cfg");

    ConfigFile::SectionIterator secItr = configFile.getSectionIterator();

    String secName, typeName, archName;
    while (secItr.hasMoreElements())
    {
        secName = secItr.peekNextKey();
        ConfigFile::SettingsMultiMap *settings = secItr.getNext();
        ConfigFile::SettingsMultiMap::iterator i;
        for (i = settings->begin(); i != settings->end(); ++i)
        {
            typeName = i->first;
            archName = i->second;
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
            ResourceGroupManager::getSingleton().addResourceLocation(
                String(macBundlePath() + "/" + archName), typeName, secName);
#else
            ResourceGroupManager::getSingleton().addResourceLocation(
                archName, typeName, secName);
#endif
        }
    }
}
コード例 #4
0
ファイル: BaseManager.cpp プロジェクト: 2asoft/MMO-Framework
	void BaseManager::addResourceLocation(const std::string& _name, const std::string& _group, const std::string& _type, bool _recursive)
	{
		#if MYGUI_PLATFORM == MYGUI_PLATFORM_APPLE
			// OS X does not set the working directory relative to the app, In order to make things portable on OS X we need to provide the loading with it's own bundle path location
			Ogre::ResourceGroupManager::getSingleton().addResourceLocation(Ogre::String(macBundlePath() + "/" + _name), _type, _group, _recursive);
		#else
			Ogre::ResourceGroupManager::getSingleton().addResourceLocation(_name, _type, _group, _recursive);
		#endif
	}
コード例 #5
0
ファイル: ogreapp.cpp プロジェクト: dorgonman/cocos2d-x-ogre
OgreApp::OgreApp(){
	mRoot = 0;
	// Provide a nice cross platform solution for locating the configuration files
	// On windows files are searched for in the current working directory, on OS X however
	// you must provide the full path, the helper function macBundlePath does this for us.
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
	mResourcePath = macBundlePath() + "/Contents/Resources/";
#else
	mResourcePath = "../Resources/";
#endif
}
コード例 #6
0
ファイル: OgrePong.cpp プロジェクト: jpbullalayao/projects
OgrePong::OgrePong()
{
    mPongFrameListener = 0;
    mRoot = 0;
    // Provide a nice cross platform solution for locating the configuration files
    // On windows files are searched for in the current working directory, on OS X however
    // you must provide the full path, the helper function macBundlePath does this for us.
	//  (Note:  This is not fully tested under IOS)
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
    mResourcePath = macBundlePath() + "/Contents/Resources/";
#else
    mResourcePath = "";
#endif
}
コード例 #7
0
ファイル: Shader.cpp プロジェクト: motrr/RemoteControlGalileo
Shader::Shader(const std::string &vertexFile, const std::string &fragmentFile, bool fromBundle):
    mProgram(0)
{
    // load vertex shader
    std::string fileName = (fromBundle)	? macBundlePath() + "/" + vertexFile : vertexFile;
    FILE* file = fopen(fileName.c_str(), "rb");
    if(!file)
    {
        printf("Failed to load vertex shader");
        return;
    }

    fseek(file, 0, SEEK_END);
    long size = ftell(file);
    rewind(file);

    mVertexSource.resize(size);
    fread(&mVertexSource[0], 1, size, file);
    fclose(file);

    // load fragment shader
    fileName = (fromBundle) ? macBundlePath() + "/" + fragmentFile : fragmentFile;
    file = fopen(fileName.c_str(), "rb");
    if(!file)
    {
        printf("Failed to load fragment shader");
        return;
    }

    fseek(file, 0, SEEK_END);
    size = ftell(file);
    rewind(file);

    mFragmentSource.resize(size);
    fread(&mFragmentSource[0], 1, size, file);
    fclose(file);
}
コード例 #8
0
GraphicsManager::GraphicsManager()
{
    m_initialized = false;
    m_root = 0;
    m_sceneManager = 0;
    m_window = 0;
    m_debugOverlayFrameListener = 0;

#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
 m_resourcePath = macBundlePath() + "/Contents/Resources/";
#else
 m_resourcePath = "";
#endif

    setMaxFrameTime(COAJNR_GRAPHICS_FRAME_TIME);
}
コード例 #9
0
BasisManager::BasisManager() :
	mInputManager(0),
	mMouse(0),
	mKeyboard(0),
	mRoot(0),
	mCamera(0),
	mSceneMgr(0),
	mWindow(0),
	m_exit(false)
{
	#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
		mResourcePath = macBundlePath() + "/Contents/Resources/";
	#else
		mResourcePath = "";
	#endif
} 
コード例 #10
0
ファイル: DefaultCore.cpp プロジェクト: llazarus1/YAGE
DefaultCore::DefaultCore(const std::string &projectName, const std::string &resourceDir) {
    // Build our personal directory location.
#if SYS_PLATFORM == PLATFORM_APPLE
    _personalDirectory = std::string(getenv("HOME")) + "/Library/Application Support/" + projectName + "/";
#else
#   error This is not implemented.
#endif

    // Format and create the project settings directory.
    FileSystem::FormatPath(_personalDirectory);
    if (!FileSystem::CreateDirectory(_personalDirectory)) {
        THROW(InternalError, "Could not make directory: " << _personalDirectory);
    }

    // Create the window and add it as the primary target.
    _mainWindow = new Window(projectName);

    // Load our options from disk.
    _optionsModule = new OptionsModule(_personalDirectory);
    _optionsModule->registerListener("video", this);
    _optionsModule->load();

    // Setup the event pump.
    _eventPump = new EventPump(_mainWindow);
    _eventPump->addWindowListener(this);
    _eventPump->addMouseButtonListener(this);
    _eventPump->addMouseMotionListener(this);
    _eventPump->addKeyListener(this);

    // And create our audio system (do this AFTER window creation, because of SDL).
    _audioSystem = new AudioSystem();

    // Wait until the window has been created, which gives us our GL context, to
    // intitialize Content.
    Content::Initialize();
    
    // Setup the default resource directory.
    std::string basicDir = resourceDir.size() > 0 ? resourceDir :
#if SYS_PLATFORM == PLATFORM_APPLE
        macBundlePath() + "/Contents/Resources/";
#else
#   error This is not implemented.
#endif

    FileSystem::ChangeDirectory(basicDir);
    Content::AddResourceDir(basicDir);
}
コード例 #11
0
ファイル: TerrainTests.cpp プロジェクト: vancepym/ogre
void TerrainTests::setUp()
{
    // set up silent logging to not pollute output
	if(LogManager::getSingletonPtr())
		OGRE_DELETE Ogre::LogManager::getSingletonPtr();

	if(LogManager::getSingletonPtr() == 0)
	{
		LogManager* logManager = OGRE_NEW LogManager();
		logManager->createLog("testTerrain.log", true, false);
	}
    LogManager::getSingleton().setLogDetail(LL_LOW);

	mRoot = OGRE_NEW Root();
	mTerrainOpts = OGRE_NEW TerrainGlobalOptions();

	// Load resource paths from config file
	ConfigFile cf;
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
	cf.load(macBundlePath() + "/Contents/Resources/resources.cfg");
#else
	cf.load("resources.cfg");
#endif

	// Go through all sections & settings in the file
	ConfigFile::SectionIterator seci = cf.getSectionIterator();

	String secName, typeName, archName;
	while (seci.hasMoreElements())
	{
		secName = seci.peekNextKey();
		ConfigFile::SettingsMultiMap *settings = seci.getNext();
		ConfigFile::SettingsMultiMap::iterator i;
		for (i = settings->begin(); i != settings->end(); ++i)
		{
			typeName = i->first;
			archName = i->second;
			ResourceGroupManager::getSingleton().addResourceLocation(
				archName, typeName, secName);

		}
	}

	mSceneMgr = mRoot->createSceneManager(ST_GENERIC);

}
コード例 #12
0
ファイル: BaseManager.cpp プロジェクト: ruananswer/AncelApp
	BaseManager::BaseManager() :
		mGUI(nullptr),
		mPlatform(nullptr),
		mInfo(nullptr),
		mFocusInfo(nullptr),
		mRoot(nullptr),
		mCamera(nullptr),
		mSceneManager(nullptr),
		mWindow(nullptr),
		mExit(false),
		mPluginCfgName("plugins.cfg"),
		mResourceXMLName("resources.xml"),
		mResourceFileName("MyGUI_Core.xml"),
		mNode(nullptr)
	{
		#if MYGUI_PLATFORM == MYGUI_PLATFORM_APPLE
			mResourcePath = macBundlePath() + "/Contents/Resources/";
		#else
			mResourcePath = "";
		#endif
	}
コード例 #13
0
ファイル: BaseManager.cpp プロジェクト: 2asoft/MMO-Framework
	BaseManager::BaseManager() :
		mGUI(nullptr),
		mPlatform(nullptr),
		mRoot(nullptr),
		mCamera(nullptr),
		mSceneManager(nullptr),
		mWindow(nullptr),
		mExit(false),
#ifdef _DEBUG // Gauss 27.10.2014
    mPluginCfgName("plugins_d.cfg"),
#else
    mPluginCfgName("plugins.cfg"),
#endif
		mResourceXMLName("ResourcesBaseManager.xml"),
		mResourceFileName("MyGUI_Core.xml")
	{
		#if MYGUI_PLATFORM == MYGUI_PLATFORM_APPLE
			mResourcePath = macBundlePath() + "/Contents/Resources/";
		#else
			mResourcePath = "";
		#endif
	}
コード例 #14
0
ファイル: path_resolver.cpp プロジェクト: amireh/Karazeh
  path_t locate_bin_directory(const logger* log, bool verbose) {
    // locate the binary and build its path
    #if KZH_PLATFORM == KZH_PLATFORM_LINUX
      // use binreloc and fs to build up our paths
      int brres = br_init(0);
      if (brres == 0) {
        if (verbose) {
          log->error() << "binreloc could not be initialised";
        }

        throw std::runtime_error("Unable to resolve paths! binreloc could not be initialized");
      }

      char *tmp_bin_path = br_find_exe_dir(".");
      path_t bin_path = path_t(tmp_bin_path).make_preferred();
      free(tmp_bin_path);
      br_free();

      return bin_path;
    #elif KZH_PLATFORM == KZH_PLATFORM_APPLE
      // use NSBundlePath() to build up our paths
      // return path_t(macBundlePath() + "/Contents/MacOS").make_preferred();
      return path_t(macBundlePath()).make_preferred();
    #else // Windows
      // use GetModuleFileName() and fs to build up our paths on Windows
      TCHAR szPath[MAX_PATH];

      if (!GetModuleFileName(NULL, szPath, MAX_PATH)) {
        if (verbose) {
          log->error() << "Unable to resolve path: " << GetLastError();;
        }

        throw std::runtime_error("Unable to resolve paths! GetModuleFileName() failed. See the log for the error.");
      }

      return path_t(string_t(szPath)).remove_filename().make_preferred();
    #endif
  }
コード例 #15
0
ファイル: macUtils.cpp プロジェクト: MrLobo/El-Rayo-de-Zeus
    std::string macPluginPath()
	{
		return macBundlePath() + "/Contents/Plugins/";
	}