예제 #1
0
void copySysOSX(const char* projName)
{
#ifdef _DEBUG
	const char * appName = "MaratisPlayerDebug";
#else
	const char * appName = "MaratisPlayer";
#endif

	MWindow * window = MWindow::getInstance();
	MEngine* engine = MEngine::getInstance();
	MSystemContext* system = engine->getSystemContext();

	char filename[256];
	getLocalFilename(filename, system->getWorkingDirectory(), projName);

	if(char* ext = strstr(filename, ".mproj"))
	{
		MProject proj;
		if(proj.loadXML(projName))
		{
			strcpy(ext, ".app");

			char path[256];
			char srcName[256];
			char destName[256];
			char appPath[256];
			char level[256];

			getLocalFilename(level, system->getWorkingDirectory(), proj.startLevel.c_str());
			getGlobalFilename(appPath, getPubDir(), filename);

			sprintf(path, "../../../%s.app", appName);
			getGlobalFilename(srcName, window->getCurrentDirectory(), path);
			copyDirectory(srcName, appPath);

			strcpy(ext, "");
			sprintf(srcName, "%s/Contents/MacOS/%s", appPath, appName);

			strcpy(ext, ".mproj");
			embedProject(srcName, srcName, filename, level, proj.renderer.c_str());
			chmod(srcName, 0777);

			// we need to put all data in app/Contents/Resources/
			sprintf(destName, "%s/Contents/Resources", appPath);
			createDirectory(destName);
			s_dataDir = destName;
		}
	}
}
예제 #2
0
bool MaratisPlayer::loadProject(const char * filename)
{
	if(! filename)
		return false;
	
	// load project file
	MProject proj;
	if(proj.loadXML(filename))
	{
		loadProject(&proj, filename);
		return true;
	}
	
	return false;
}
예제 #3
0
void copySysLinux(const char* projName)
{
#ifdef _DEBUG
	const char * appName = "MaratisPlayerDebug";
#else
	const char * appName = "MaratisPlayer";
#endif

	MEngine* engine = MEngine::getInstance();
	MSystemContext* system = engine->getSystemContext();

	char filename[256];
	getLocalFilename(filename, system->getWorkingDirectory(), projName);

	if(char* ext = strstr(filename, ".mproj"))
	{
		*ext = 0;

		MProject proj;
		if(proj.loadXML(projName))
		{
			char destName[256];
			getGlobalFilename(destName, getPubDir(), filename);

			char level[256];
			getLocalFilename(level, system->getWorkingDirectory(), proj.startLevel.c_str());

			strcpy(ext, ".mproj");
			embedProject(appName, destName, filename, level, proj.renderer.c_str());
			chmod(destName, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);

			// find all dynamic libraries
			copyDirFiles(".", getPubDir(), ".so");
		}
	}
}
예제 #4
0
void copySysWindows(const char* projName)
{
#ifdef _DEBUG
	const char * appName = "MaratisPlayerDebug.exe";
#else
	const char * appName = "MaratisPlayer.exe";
#endif

	MEngine* engine = MEngine::getInstance();
	MSystemContext* system = engine->getSystemContext();

	char filename[256];
	getLocalFilename(filename, system->getWorkingDirectory(), projName);

	if(char* ext = strstr(filename, ".mproj"))
	{
		MProject proj;
		if(proj.loadXML(projName))
		{
			strcpy(ext, ".exe");
			char destName[256];
			getGlobalFilename(destName, getPubDir(), filename);

			char level[256];
			getLocalFilename(level, system->getWorkingDirectory(), proj.startLevel.c_str());

			// we need the project "filename" to still be a .mproj for MaratisPlayer to behave
			// correctly
			strcpy(ext, ".mproj");
			embedProject(appName, destName, filename, level, proj.renderer.c_str());

			// find all dynamic libraries
			copyDirFiles(".", getPubDir(), ".dll");
		}
	}
}