Ejemplo n.º 1
0
bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if(!glview) {
        glview = GLViewImpl::createWithRect("crushGame", Rect(0, 0, 270, 480));
        director->setOpenGLView(glview);
    }

    director->getOpenGLView()->setDesignResolutionSize(540, 960, ResolutionPolicy::SHOW_ALL);

    // turn on display FPS
    director->setDisplayStats(true);

    // set FPS. the default value is 1.0/60 if you don't call this
    director->setAnimationInterval(1.0 / 60);

	auto sharedFile = FileUtils::getInstance();
	sharedFile->addSearchPath("res");
	sharedFile->addSearchPath("GameScene");
	sharedFile->addSearchPath("MenuScene");
	sharedFile->addSearchPath("ShopScene");
	sharedFile->addSearchPath("GameOverScene");
    // create a scene. it's an autorelease object
    auto scene = MenuScene::createScene();

    // run
    director->runWithScene(scene);

    return true;
}
Ejemplo n.º 2
0
int _tmain(int argc, _TCHAR* argv[])
{
	lua_State *L = lua_open();  /* create state */
	if (L != NULL) {		

		luaL_openlibs(L);  /* open libraries */
		luamodule_cjson(L);
		luamodule_cjson_safe(L);
		luamodule_md5(L);
		luamodule_des56(L);

		CSimpleIniA ini;
		ini.LoadFile("app.ini");

		const char* tmp;
		tmp = ini.GetValue("Application","libs.dir",NULL);
		if(tmp!=NULL) {
			std::string s(tmp);
			size_t last = 0;
			size_t index=s.find_first_of(";",last);
			while (index!=std::string::npos)
			{
				addSearchPath(L, s.substr(last,index-last).c_str());
				last=index+1;
				index=s.find_first_of(";",last);
			}
			if (index-last>0)
			{
				addSearchPath(L, s.substr(last,index-last).c_str());
			}			
		}
	}
	return luamain(L, argc,argv);
}
Ejemplo n.º 3
0
hkDemoFileSystem::hkDemoFileSystem()
{
	hkFileSystem* parent = &hkFileSystem::getInstance();
	parent->addReference();
	m_parent = parent;
	addSearchPath("./");
	addSearchPath(hkDemoDatabase::getInstance().getPrefix().cString());
	m_locations.pushBack(hkString::strDup(""));
}
Ejemplo n.º 4
0
 void FileFinder::addSearchPaths( std::vector<std::string> const& paths )
 {
   for ( std::vector<std::string>::const_iterator it = paths.begin() ; it != paths.end() ; ++it )
   {
     addSearchPath( *it );
   }
 }
Ejemplo n.º 5
0
    void ContentModule::initializeTextures() const
    {
        
		String resourceGroup = isCommon() ?
            ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME : getId();

		StringVector texLocations = getTextureLocations();
		for(StringVector::iterator iter = texLocations.begin();
			iter != texLocations.end();
			iter++)
		{
			String location = *iter;
			if (location.find(".zip") != String::npos)
			{
                ResourceGroupManager::getSingleton().addResourceLocation(
                	getDirectory() + "/materials/" + location, "Zip", resourceGroup);
			}
			else
			{
                ResourceGroupManager::getSingleton().addResourceLocation(
                	getDirectory() + "/materials/" + location, "FileSystem", resourceGroup);
			}
		}

		addSearchPath(getDirectory()+"/materials", resourceGroup);
    }
Ejemplo n.º 6
0
int main(int argc, char *argv[]){

    QTextCodec::setCodecForLocale( QTextCodec::codecForName(THIS_PROJECT_LOCALCODEC) );

    QApplication app(argc, argv);

    { delete (new QImage("..null.png")); }

    {
        const QStringList search_path_base{ app.applicationDirPath(),QFile::decodeName(THIS_PROJECT_PWD) };
        QDir::setSearchPaths("images",addSearchPath(search_path_base,"images"));
        QDir::setSearchPaths("glsl",addSearchPath(search_path_base,"glsl"));
    }

    MainWindow window;
    window.resize(512,512);
    window.show();

    return app.exec();
}
Ejemplo n.º 7
0
void SimpleApp::InitPlatform()
{
    /// Redirect Caramel Trace to Win32 Debugger ///

    auto debugger = new Windows::DebuggerTraceAdapter;
    debugger->BindBuiltinChannels( Trace::LEVEL_DEBUG );
    Trace::Listeners::AddManaged( debugger );


    /// Create GLView with Size and Title ///

    const DesktopSettings& ds = m_settings.desktop;

    auto glview = GLViewImpl::createWithRect(
        ds.frameTitle, Rect( 0, 0, ds.frameWidth, ds.frameHeight ));

    auto director = Director::getInstance();
    CARAMEL_ASSERT( nullptr == director->getOpenGLView() );

    director->setOpenGLView( glview );


    //
    // Specify Assets path in Win32
    // - 1. Relateive path from working directory to assets.
    //   2. Add an additional assets.win32 .
    //

    if ( ds.assetsPath.empty() )
    {
        CARAMEL_THROW( "Assets path not set" );
    }

    auto fileUtils = FileUtils::getInstance();

    fileUtils->addSearchPath( ds.assetsPath );
    fileUtils->addSearchPath( ds.assetsPath + ".win32" );
}
Ejemplo n.º 8
0
FileSystem::FileSystem()
{
	name.assign("file_system");

	// PHYSFS must be initialized before other modules awake,
	// because it will be used by them.
	if (PHYSFS_isInit() == 0)
	{
		char *base_path = SDL_GetBasePath();
		PHYSFS_init(base_path);
		SDL_free(base_path);

		addSearchPath(".");
	}	
}
Ejemplo n.º 9
0
bool FileSystem::awake(pugi::xml_node &node)
{
	bool ret = true;

	for (pugi::xml_node path = node.child("path"); path ; path = path.next_sibling("path"))
		addSearchPath(path.child_value());

	char *write_dir = SDL_GetPrefPath("Carlos", "Game_development");

	if (PHYSFS_setWriteDir(write_dir) == 0)
	{
		LOG("%s,%s","Error on setting Write Dir. Error:", PHYSFS_getLastError());
		ret = false;
	}
	else
	{
		LOG("%s %s", "Write directory is ", write_dir);
		addSearchPath(write_dir, getSaveDirectory());
	}

	SDL_free(write_dir);
	
	return ret;
}
Ejemplo n.º 10
0
    void ContentModule::initialize()
    {
        SaveGameManager::getSingleton().registerSaveGameData(this);

        Ogre::String moduleDir = getDirectory();

        Ogre::String resourceGroup = getId();

        addSearchPath(moduleDir + "/conf", resourceGroup);
        addSearchPath(moduleDir + "/dsa", resourceGroup);
        addSearchPath(moduleDir + "/maps", resourceGroup);
        addSearchPath(moduleDir + "/models", resourceGroup);
           StringVector modelLoc = getModelLocations();
        for (StringVector::iterator it = modelLoc.begin(); it != modelLoc.end(); ++it)
        {
            addSearchPath(moduleDir + "/models/"+*it, resourceGroup);
        }

        addSearchPath(moduleDir + "/sound", resourceGroup); ///@todo ueber Verzeichnisnamen nachdenken
        StringVector soundLoc = getSoundLocations();
        for (StringVector::iterator it = soundLoc.begin(); it != soundLoc.end(); ++it)
        {
            addSearchPath(moduleDir + "/sound/"+*it, resourceGroup);
        }

        addSearchPath(moduleDir + "/gui", resourceGroup);
        addSearchPath(moduleDir + "/gui/fonts", resourceGroup);
        addSearchPath(moduleDir + "/gui/imagesets", resourceGroup);
        addSearchPath(moduleDir + "/gui/schemes", resourceGroup);
        addSearchPath(moduleDir + "/gui/windows", resourceGroup);
        addSearchPath(moduleDir + "/gui/windows/buttons", resourceGroup);
        addSearchPath(moduleDir + "/dialogs", resourceGroup);
        addSearchPath(moduleDir + "/quests", resourceGroup);

        RubyInterpreter* interpreter = CoreSubsystem::getSingleton().getRubyInterpreter();
        if (interpreter != NULL)
        {
            interpreter->addSearchPath(moduleDir + "/scripts");
            interpreter->addSearchPath(moduleDir + "/scripts/maps");
        }

        mLoaded = true;
    }
	void addRelativePath(std::string rel, bool recursive=true) {
		addSearchPath(appPath() + rel, recursive);
	}
Ejemplo n.º 12
0
 FileFinder::FileFinder( std::string const& path )
 {
   DP_VERIFY( addSearchPath( path ) );
 }
Ejemplo n.º 13
0
	void ContentModule::initialize() const
    {
        String moduleDir = getDirectory();

        String resourceGroup = isCommon() ?
            ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME : getId();

        addSearchPath(moduleDir + "/conf", resourceGroup);
        addSearchPath(moduleDir + "/dsa", resourceGroup);
        addSearchPath(moduleDir + "/maps", resourceGroup);
        addSearchPath(moduleDir + "/models", resourceGroup);
   		StringVector modelLoc = getModelLocations();
		for (StringVector::iterator it = modelLoc.begin(); it != modelLoc.end(); ++it)
		{
			addSearchPath(moduleDir + "/models/"+*it, resourceGroup);
		}

		addSearchPath(moduleDir + "/sound", resourceGroup); //@todo ueber Verzeichnisnamen nachdenken
		StringVector soundLoc = getSoundLocations();
		for (StringVector::iterator it = soundLoc.begin(); it != soundLoc.end(); ++it)
		{
			addSearchPath(moduleDir + "/sound/"+*it, resourceGroup);
		}

		addSearchPath(moduleDir + "/gui", resourceGroup);
        addSearchPath(moduleDir + "/gui/fonts", resourceGroup);
        addSearchPath(moduleDir + "/gui/imagesets", resourceGroup);
        addSearchPath(moduleDir + "/gui/schemes", resourceGroup);
        addSearchPath(moduleDir + "/gui/windows", resourceGroup);
        addSearchPath(moduleDir + "/gui/windows/buttons", resourceGroup);
        addSearchPath(moduleDir + "/dialogs", resourceGroup);     

		SoundManager::getSingleton().addSounds( resourceGroup );


		RubyInterpreter* interpreter = CoreSubsystem::getSingleton().getRubyInterpreter();
        if (interpreter != NULL)
        {
            interpreter->addSearchPath(moduleDir + "/scripts");
            interpreter->addSearchPath(moduleDir + "/scripts/maps");
        }
    }