void PolycodeIDEApp::saveConfigFile() {
	Config *config = CoreServices::getInstance()->getConfig();
	Object configFile;
	configFile.root.name = "config";
	configFile.root.addChild("open_projects");
	configFile.root.addChild("syntax_theme", globalSyntaxTheme->name);
	for(int i=0; i < projectManager->getProjectCount(); i++) {
		PolycodeProject *project = projectManager->getProjectByIndex(i);		
		ObjectEntry *projectEntry = configFile.root["open_projects"]->addChild("project");
		projectEntry->addChild("name", project->getProjectName());
		projectEntry->addChild("path", project->getProjectFile());
	}

	configFile.root.addChild("settings");
	ObjectEntry *textEditorEntry = configFile.root["settings"]->addChild("text_editor");
	textEditorEntry->addChild("use_external", config->getStringValue("Polycode", "useExternalTextEditor"));
	textEditorEntry->addChild("command", config->getStringValue("Polycode", "externalTextEditorCommand"));

#if defined(__APPLE__) && defined(__MACH__)
	core->createFolder(core->getUserHomeDirectory()+"/Library/Application Support/Polycode");
	configFile.saveToXML(core->getUserHomeDirectory()+"/Library/Application Support/Polycode/config.xml");	
#else
	core->createFolder(core->getUserHomeDirectory()+"/.polycode");
	configFile.saveToXML(core->getUserHomeDirectory()+"/.polycode/config.xml");	

#endif
}
void parseOpenNodesIntoEntry(ObjectEntry *entry, UITree *node, bool addNewNode) {

    bool hasOpenNodes = false;
    for(int i=0; i < node->getNumTreeChildren(); i++) {
        UITree *child = node->getTreeChild(i);
        if(!child->isCollapsed()) {
            hasOpenNodes = true;
        }
    }

    if(!hasOpenNodes) {
        return;
    }

    ObjectEntry *childNodes = entry;
    if(addNewNode) {
        childNodes = entry->addChild("child_nodes");
    }

    for(int i=0; i < node->getNumTreeChildren(); i++) {
        UITree *child = node->getTreeChild(i);
        if(!child->isCollapsed()) {
            ObjectEntry *newEntry = childNodes->addChild("open_node");
            newEntry->addChild("name", child->getLabelText());
            parseOpenNodesIntoEntry(newEntry, child, true);
        }
    }
}
ObjectEntry *PolycodeProjectBrowser::getBrowserConfig() {
    ObjectEntry *configEntry = new ObjectEntry();
    configEntry->name = "project_browser";

    configEntry->addChild("width", getWidth());
    ObjectEntry *openNodes = configEntry->addChild("open_nodes");
    parseOpenNodesIntoEntry(openNodes, treeContainer->getRootNode(), false);

    return configEntry;
}
ObjectEntry *PolycodeTextEditor::getEditorConfig() {
	ObjectEntry *configEntry = new ObjectEntry();
		
	configEntry->addChild("scroll_offset", textInput->getScrollContainer()->getVScrollBar()->getScrollValue());
			
	return configEntry;
}
Exemple #5
0
void PolycodeIDEApp::saveConfigFile() {
	Object configFile;
	configFile.root.name = "config";
	configFile.root.addChild("open_projects");
	for(int i=0; i < projectManager->getProjectCount(); i++) {
		PolycodeProject *project = projectManager->getProjectByIndex(i);		
		ObjectEntry *projectEntry = configFile.root["open_projects"]->addChild("project");
		projectEntry->addChild("name", project->getProjectName());
		projectEntry->addChild("path", project->getProjectFile());
	}
	core->createFolder("/Users/ivansafrin/Library/Application Support/Polycode");
	configFile.saveToXML("/Users/ivansafrin/Library/Application Support/Polycode/config.xml");		
}
Exemple #6
0
void PolycodeIDEApp::saveConfigFile() {
	Config *config = CoreServices::getInstance()->getConfig();
	Object configFile;
	configFile.root.name = "config";
	configFile.root.addChild("open_projects");
	configFile.root.addChild("syntax_theme", globalSyntaxTheme->name);
	configFile.root.addChild("ui_theme", config->getStringValue("Polycode", "uiTheme"));
	configFile.root.addChild("texture_filtering_mode", config->getStringValue("Polycode", "textureFilteringMode"));
	
	configFile.root.addChild("app_width", String::IntToString(core->getXRes()));
	configFile.root.addChild("app_height", String::IntToString(core->getYRes()));
	
	ObjectEntry *consoleEntry = configFile.root.addChild("console");
	consoleEntry->addChild("size", frame->getConsoleSize());
	consoleEntry->addChild("showing", frame->isShowingConsole());
	
	for(int i=0; i < projectManager->getProjectCount(); i++) {
		PolycodeProject *project = projectManager->getProjectByIndex(i);		
		ObjectEntry *projectEntry = configFile.root["open_projects"]->addChild("project");

		projectEntry->addChild("is_active", (project == projectManager->getActiveProject()));
		
		projectEntry->addChild("name", project->getProjectName());
		projectEntry->addChild("path", project->getProjectFile());
		
		ObjectEntry *projectFrameConfig = frame->getFrameConfigForProject(project);
		if(projectFrameConfig) {
			projectEntry->addChild(projectFrameConfig);
		}
	}

	configFile.root.addChild("settings");
	ObjectEntry *textEditorEntry = configFile.root["settings"]->addChild("text_editor");
	textEditorEntry->addChild("use_external", config->getStringValue("Polycode", "useExternalTextEditor"));
	textEditorEntry->addChild("command", config->getStringValue("Polycode", "externalTextEditorCommand"));

#if defined(__APPLE__) && defined(__MACH__)
	core->createFolder(core->getUserHomeDirectory()+"/Library/Application Support/Polycode");
	configFile.saveToXML(core->getUserHomeDirectory()+"/Library/Application Support/Polycode/config.xml");	
#else
	core->createFolder(core->getUserHomeDirectory()+"/.polycode");
	configFile.saveToXML(core->getUserHomeDirectory()+"/.polycode/config.xml");	

#endif
}
Exemple #7
0
void PolycodeIDEApp::saveConfigFile() {
	Object configFile;
	configFile.root.name = "config";
	configFile.root.addChild("open_projects");
	configFile.root.addChild("syntax_theme", globalSyntaxTheme->name);
	for(int i=0; i < projectManager->getProjectCount(); i++) {
		PolycodeProject *project = projectManager->getProjectByIndex(i);		
		ObjectEntry *projectEntry = configFile.root["open_projects"]->addChild("project");
		projectEntry->addChild("name", project->getProjectName());
		projectEntry->addChild("path", project->getProjectFile());
	}

#if defined(__APPLE__) && defined(__MACH__)
	core->createFolder(core->getUserHomeDirectory()+"/Library/Application Support/Polycode");
	configFile.saveToXML(core->getUserHomeDirectory()+"/Library/Application Support/Polycode/config.xml");	
#else
	core->createFolder(core->getUserHomeDirectory()+"/.polycode");
	configFile.saveToXML(core->getUserHomeDirectory()+"/.polycode/config.xml");	

#endif
}
void PolycodeSpriteEditor::saveFile() {
	Object saveObject;
	
	saveObject.root.name = "sprite";
	
	ObjectEntry *image = saveObject.root.addChild("image");
	image->addChild("frameWidth", widthProp->get());
	image->addChild("frameHeight", heightProp->get());
	image->addChild("fileName", previewSprite->getTexture()->getResourcePath());
	
	ObjectEntry *animations = saveObject.root.addChild("animations");
			
	for(int i=0; i < animationEntries.size(); i++) {
		ObjectEntry *animation = animations->addChild("animation");
		animation->addChild("name", animationEntries[i]->nameInput->getText());
		animation->addChild("frames", animationEntries[i]->framesInput->getText());
		animation->addChild("speed", atof(animationEntries[i]->speedInput->getText().c_str()));	
	}			
			
	saveObject.saveToXML(filePath);
}
Exemple #9
0
int main(int argc, char **argv) {
		
#if defined(__APPLE__) && defined(__MACH__)
	char path[2049];
	_NSGetExecutablePath(path, 2048);

	String basePath = path;
	vector<String> cpts = basePath.split("/");
	String installPath = "";
	for(int i=0; i < cpts.size() - 2; i++) {
		installPath = installPath + cpts[i];
		installPath += String("/");
	}
#else
	char path[2049];
	TCHAR tpath[2049];
	GetModuleFileName(NULL, (LPWSTR)tpath, 2048);
	wtoc(path, tpath, 2048);
	
	String basePath = path;
	vector<String> cpts = basePath.split("\\");
	String installPath = "";
	for(int i=0; i < cpts.size() - 2; i++) {
		installPath = installPath + cpts[i];
		installPath += String("\\");
	}

#endif

	printf("Polycode build tool v0.1.1\n");

	for(int i=0; i < argc; i++) {
		String argString = String(argv[i]);
		vector<String> bits = argString.split("=");
		if(bits.size() == 2) {
			BuildArg arg;
			arg.name = bits[0];
			arg.value = bits[1];
			args.push_back(arg);
		}
		
	}
	
	if(getArg("--config") == "") {
		printf("\n\nInput config XML missing. Use --config=path to specify.\n\n");
		return 1;
	}

	
	if(getArg("--out") == "") {
		printf("\n\nOutput file not specified. Use --out=outfile.polyapp to specify.\n\n");
		return 1;		
	}

	char dirPath[4099];
#if defined(__APPLE__) && defined(__MACH__)
	_getcwd(dirPath, sizeof(dirPath));
#else	
	TCHAR tdirpath[4099];
	GetCurrentDirectory(4098, (LPWSTR)tdirpath);
	wtoc(dirPath, tdirpath, 4098);

#endif
	String currentPath = String(dirPath);

	String configPath = getArg("--config");

	String finalPath = configPath;
	if(configPath[0] != '/') {

#ifdef _WINDOWS
		finalPath = currentPath+"\\"+configPath;
#else
		finalPath = currentPath+"/"+configPath;
#endif
	}

	finalPath = finalPath.replace(":", "");
	finalPath = finalPath.replace("\\", "/");
	finalPath = finalPath.substr(1, finalPath.length() - 1);

	printf("Reading config file from %s\n", finalPath.c_str());

	Object configFile;
	if(!configFile.loadFromXML(finalPath)) {
		printf("Specified config file doesn't exist!\n");
		return 1;
	}
	printf("OK!\n");
	// start required params

	String entryPoint;
	int defaultWidth;
	int defaultHeight;
	int frameRate = 60;
	int antiAliasingLevel = 0;
	bool fullScreen = false;
	float backgroundColorR = 0.2;
	float backgroundColorG = 0.2;
	float backgroundColorB = 0.2;

	if(configFile.root["entryPoint"]) {
		printf("Entry point: %s\n", configFile.root["entryPoint"]->stringVal.c_str());
		entryPoint = configFile.root["entryPoint"]->stringVal;
	} else {
		printf("Required parameter: \"entryPoint\" is missing from config file!\n");
		return 1;		
	}

	if(configFile.root["defaultWidth"]) {
		printf("Width: %d\n", configFile.root["defaultWidth"]->intVal);
		defaultWidth = configFile.root["defaultWidth"]->intVal;
	} else {
		printf("Required parameter: \"defaultWidth\" is missing from config file!\n");
		return 1;		
	}

	if(configFile.root["defaultHeight"]) {
		printf("Height: %d\n", configFile.root["defaultHeight"]->intVal);
		defaultHeight = configFile.root["defaultHeight"]->intVal;
	} else {
		printf("Required parameter: \"defaultHeight\" is missing from config file!\n");
		return 1;		
	}

	// start optional params

	if(configFile.root["frameRate"]) {
		printf("Frame rate: %d\n", configFile.root["frameRate"]->intVal);
		frameRate = configFile.root["frameRate"]->intVal;
	}

	if(configFile.root["antiAliasingLevel"]) {
		printf("Anti-aliasing level: %d\n", configFile.root["antiAliasingLevel"]->intVal);
		antiAliasingLevel = configFile.root["antiAliasingLevel"]->intVal;
	}

	if(configFile.root["fullScreen"]) {
		fullScreen = configFile.root["fullScreen"]->boolVal;
		if(fullScreen) {
			printf("Full-screen: true\n");
		} else {
			printf("Full-screen: false\n");
		}
	}

	if(configFile.root["backgroundColor"]) {
		ObjectEntry *color = configFile.root["backgroundColor"];
		if((*color)["red"] && (*color)["green"] && (*color)["blue"]) {
			backgroundColorR = (*color)["red"]->NumberVal;
			backgroundColorG = (*color)["green"]->NumberVal;
			backgroundColorB = (*color)["blue"]->NumberVal;
			printf("Background color: %f %f %f\n", backgroundColorR, backgroundColorG, backgroundColorB);

		} else {
			printf("backgroundColor node specified, but missing all three color attributes (red,green,blue). Ignoring.\n");
		}
	}

	zipFile z = zipOpen(getArg("--out").c_str(), 0);
	

	Object runInfo;
	runInfo.root.name = "PolycodeApp";
	runInfo.root.addChild("entryPoint", entryPoint);
	runInfo.root.addChild("defaultHeight", defaultHeight);
	runInfo.root.addChild("defaultWidth", defaultWidth);
	runInfo.root.addChild("frameRate", frameRate);
	runInfo.root.addChild("antiAliasingLevel", antiAliasingLevel);
	runInfo.root.addChild("fullScreen", fullScreen);
	
	ObjectEntry *color = runInfo.root.addChild("backgroundColor");
	color->addChild("red", backgroundColorR);
	color->addChild("green", backgroundColorG);
	color->addChild("blue", backgroundColorB);

	addFileToZip(z, entryPoint, entryPoint, false);

	if(configFile.root["modules"]) {
#ifdef _WINDOWS
		String modulesPath = installPath + "Modules\\";
#else
		String modulesPath = installPath + "Modules/";
#endif

		ObjectEntry *modules = configFile.root["modules"];
		if(modules) {		
			for(int i=0; i < modules->length; i++) {
				printf("Adding module: %s\n", (*modules)[i]->stringVal.c_str());
				String modulePath = modulesPath + (*modules)[i]->stringVal;
#ifdef _WINDOWS
				String moduleAPIPath = modulePath + "\\API";
				String moduleLibPath = modulePath + "\\Lib";
				moduleAPIPath = moduleAPIPath.replace("\\", "/");
				moduleAPIPath = moduleAPIPath.substr(2, moduleAPIPath.length() - 2);	
				moduleLibPath = moduleLibPath.replace("\\", "/");
				moduleLibPath = moduleLibPath.substr(2, moduleLibPath.length() - 2);	

#else
				String moduleAPIPath = modulePath + "/API";
				String moduleLibPath = modulePath + "/Lib";
#endif
				printf("Path:%s\n", moduleAPIPath.c_str());		


				addFolderToZip(z, moduleAPIPath, "", false);
				addFolderToZip(z, moduleLibPath, "__lib", false);

				//String module = configFile.root["entryPoint"]->stringVal;
			}
			runInfo.root.addChild(configFile.root["modules"]);
		}
	}

	if(configFile.root["packedItems"]) {
		ObjectEntry *packed = configFile.root["packedItems"];
		if(packed) {
			for(int i=0; i < packed->length; i++) {
				ObjectEntry *entryPath = (*(*packed)[i])["path"];
				ObjectEntry *entryType = (*(*packed)[i])["type"];
				if(entryPath && entryType) {
					if(entryType->stringVal == "folder") {
						addFolderToZip(z, entryPath->stringVal, entryPath->stringVal, false);
					} else {
						addFileToZip(z, entryPath->stringVal, entryPath->stringVal, false);
					}
				}
			}
			runInfo.root.addChild(configFile.root["packedItems"]);
		}
	}


	runInfo.saveToXML("runinfo_tmp_zzzz.polyrun");
	addFileToZip(z, "runinfo_tmp_zzzz.polyrun", "runinfo.polyrun", true);

	//addFolderToZip(z, getArg("--project"), "");
	
	zipClose(z, "");	

	OSBasics::removeItem("runinfo_tmp_zzzz.polyrun");

	return 0;
}
Exemple #10
0
int main(int argc, char **argv) {
		
	PHYSFS_init(argv[0]);

#if defined(__APPLE__) && defined(__MACH__)
    uint32_t bufsize = 2048;
	char path[bufsize];
	_NSGetExecutablePath(path, &bufsize);

	String basePath = path;
	vector<String> cpts = basePath.split("/");
	String installPath = "";
	for(int i=0; i < cpts.size() - 2; i++) {
		installPath = installPath + cpts[i];
		installPath += String("/");
	}
#elif defined (_WINDOWS)
	char path[2049];
	TCHAR tpath[2049];
	GetModuleFileName(NULL, (LPWSTR)tpath, 2048);
	wtoc(path, tpath, 2048);
	
	String basePath = path;
	vector<String> cpts = basePath.split("\\");
	String installPath = "";
	for(int i=0; i < cpts.size() - 2; i++) {
		installPath = installPath + cpts[i];
		installPath += String("\\");
	}
#else
	String basePath = PHYSFS_getBaseDir();
	vector<String> cpts = basePath.split("/");
	String installPath = "";
	for(int i=0; i < cpts.size() - 2; i++) {
		installPath = installPath + cpts[i];
		installPath += String("/");
	}
#endif

	printf("Polycode build tool v"POLYCODE_VERSION_STRING"\n");

	for(int i=0; i < argc; i++) {
		String argString = String(argv[i]);
		vector<String> bits = argString.split("=");
		if(bits.size() == 2) {
			BuildArg arg;
			arg.name = bits[0];
			arg.value = bits[1];
		//	printf("arg: %s=%s\n", arg.name.c_str(), arg.value.c_str());
			args.push_back(arg);
		}
		
	}
	
	if(getArg("--config") == "") {
		printf("\n\nInput config XML missing. Use --config=path to specify.\n\n");
		return 1;
	}

	
	if(getArg("--out") == "") {
		printf("\n\nOutput file not specified. Use --out=outfile.polyapp to specify.\n\n");
		return 1;		
	}

	char dirPath[4099];
#if defined(__APPLE__) && defined(__MACH__)
	getcwd(dirPath, sizeof(dirPath));
#elif defined (_WINDOWS)
	TCHAR tdirpath[4099];
	GetCurrentDirectory(4098, (LPWSTR)tdirpath);
	wtoc(dirPath, tdirpath, 4098);
#else
	getcwd(dirPath, sizeof(dirPath));
#endif

	String currentPath = String(dirPath);

	String configPath = getArg("--config");

	String finalPath = configPath;
	if(configPath[0] != '/' && configPath[1] !=':') {

#ifdef _WINDOWS
		finalPath = currentPath+"\\"+configPath;
#else
		finalPath = currentPath+"/"+configPath;
#endif
	}

	printf("Reading config file from %s\n", finalPath.c_str());

	Object configFile;
	if(!configFile.loadFromXML(finalPath)) {
		printf("Specified config file doesn't exist!\n");
		return 1;
	}
	printf("OK!\n");
	// start required params

	String entryPoint;
	int defaultWidth;
	int defaultHeight;
	int frameRate = 60;
	int antiAliasingLevel = 0;
	int anisotropyLevel = 0;
	bool vSync = false;
	bool fullScreen = false;
	float backgroundColorR = 0.2;
	float backgroundColorG = 0.2;
	float backgroundColorB = 0.2;
	String textureFiltering = "linear";

	if(configFile.root["entryPoint"]) {
		printf("Entry point: %s\n", configFile.root["entryPoint"]->stringVal.c_str());
		entryPoint = configFile.root["entryPoint"]->stringVal;
	} else {
		printf("Required parameter: \"entryPoint\" is missing from config file!\n");
		return 1;		
	}

	if(configFile.root["defaultWidth"]) {
		printf("Width: %d\n", configFile.root["defaultWidth"]->intVal);
		defaultWidth = configFile.root["defaultWidth"]->intVal;
	} else {
		printf("Required parameter: \"defaultWidth\" is missing from config file!\n");
		return 1;		
	}

	if(configFile.root["defaultHeight"]) {
		printf("Height: %d\n", configFile.root["defaultHeight"]->intVal);
		defaultHeight = configFile.root["defaultHeight"]->intVal;
	} else {
		printf("Required parameter: \"defaultHeight\" is missing from config file!\n");
		return 1;		
	}

	// start optional params

	if(configFile.root["frameRate"]) {
		printf("Frame rate: %d\n", configFile.root["frameRate"]->intVal);
		frameRate = configFile.root["frameRate"]->intVal;
	}

	if(configFile.root["textureFiltering"]) {
		printf("Filtering mode: %s\n", configFile.root["textureFiltering"]->stringVal.c_str());
		textureFiltering = configFile.root["textureFiltering"]->stringVal;
	}

	if(configFile.root["antiAliasingLevel"]) {
		printf("Anti-aliasing level: %d\n", configFile.root["antiAliasingLevel"]->intVal);
		antiAliasingLevel = configFile.root["antiAliasingLevel"]->intVal;
	}

	if(configFile.root["anisotropyLevel"]) {
		printf("Anisotropy level: %d\n", configFile.root["anisotropyLevel"]->intVal);
		anisotropyLevel = configFile.root["anisotropyLevel"]->intVal;
	}
	
	if(configFile.root["vSync"]) {
		vSync = configFile.root["vSync"]->boolVal;
		if(vSync) {
			printf("V-Sync: true\n");
		} else {
			printf("V-Sync: false\n");
		}
	}	

	if(configFile.root["fullScreen"]) {
		fullScreen = configFile.root["fullScreen"]->boolVal;
		if(fullScreen) {
			printf("Full-screen: true\n");
		} else {
			printf("Full-screen: false\n");
		}
	}

	if(configFile.root["backgroundColor"]) {
		ObjectEntry *color = configFile.root["backgroundColor"];
		if((*color)["red"] && (*color)["green"] && (*color)["blue"]) {
			backgroundColorR = (*color)["red"]->NumberVal;
			backgroundColorG = (*color)["green"]->NumberVal;
			backgroundColorB = (*color)["blue"]->NumberVal;
			printf("Background color: %f %f %f\n", backgroundColorR, backgroundColorG, backgroundColorB);

		} else {
			printf("backgroundColor node specified, but missing all three color attributes (red,green,blue). Ignoring.\n");
		}
	}

    struct archive *a;
    
    a = archive_write_new();
    archive_write_set_format_zip(a);
    archive_write_open_filename(a, getArg("--out").c_str());
    
	//zipFile z = zipOpen(getArg("--out").c_str(), 0);
	

	Object runInfo;
	runInfo.root.name = "PolycodeApp";
	runInfo.root.addChild("entryPoint", entryPoint);
	runInfo.root.addChild("defaultHeight", defaultHeight);
	runInfo.root.addChild("defaultWidth", defaultWidth);
	runInfo.root.addChild("frameRate", frameRate);
	runInfo.root.addChild("antiAliasingLevel", antiAliasingLevel);
	runInfo.root.addChild("anisotropyLevel", anisotropyLevel);
	runInfo.root.addChild("vSync", vSync);	
	runInfo.root.addChild("fullScreen", fullScreen);
	runInfo.root.addChild("textureFiltering", String(textureFiltering));
		
	ObjectEntry *color = runInfo.root.addChild("backgroundColor");
	color->addChild("red", backgroundColorR);
	color->addChild("green", backgroundColorG);
	color->addChild("blue", backgroundColorB);

	if(configFile.root["fonts"]) {
		runInfo.root.addChild(configFile.root["fonts"]);
	}
	
	if(configFile.root["modules"]) {
#ifdef _WINDOWS
		String modulesPath = installPath + "Modules\\";
#else
		String modulesPath = installPath + "Modules/";
#endif

		ObjectEntry *modules = configFile.root["modules"];
		if(modules) {		
			for(int i=0; i < modules->length; i++) {
				printf("Adding module: %s\n", (*modules)[i]->stringVal.c_str());
				String modulePath = modulesPath + (*modules)[i]->stringVal;
#ifdef _WINDOWS
				String moduleAPIPath = modulePath + "\\API";
				String moduleLibPath = modulePath + "\\Lib";
				moduleAPIPath = moduleAPIPath.replace("\\", "/");
				moduleAPIPath = moduleAPIPath.substr(2, moduleAPIPath.length() - 2);	
				moduleLibPath = moduleLibPath.replace("\\", "/");
				moduleLibPath = moduleLibPath.substr(2, moduleLibPath.length() - 2);	

#else
				String moduleAPIPath = modulePath + "/API";
				String moduleLibPath = modulePath + "/Lib";
#endif
				printf("Path:%s\n", moduleAPIPath.c_str());		


				addFolderToZip(a, moduleAPIPath, "", false);
				addFolderToZip(a, moduleLibPath, "__lib", false);

				//String module = configFile.root["entryPoint"]->stringVal;
			}
			runInfo.root.addChild(configFile.root["modules"]);
		}
	}

	if(configFile.root["packedItems"]) {
		ObjectEntry *packed = configFile.root["packedItems"];
		if(packed) {
			for(int i=0; i < packed->length; i++) {
				ObjectEntry *entryPath = (*(*packed)[i])["path"];
				ObjectEntry *entryType = (*(*packed)[i])["type"];
				ObjectEntry *entrySource = (*(*packed)[i])["source"];
				if(entryPath && entryType) {
					if (!entrySource) entrySource = entryPath;
					if(entryType->stringVal == "folder") {
						addFolderToZip(a, entrySource->stringVal, entryPath->stringVal, false);
					} else {
						addFileToZip(a, entrySource->stringVal, entryPath->stringVal, false);
					}
				}
			}
			runInfo.root.addChild(configFile.root["packedItems"]);
		}
	}


	runInfo.saveToXML("runinfo_tmp_zzzz.polyrun");
	addFileToZip(a, "runinfo_tmp_zzzz.polyrun", "runinfo.polyrun", true);
	
    archive_write_close(a);
    archive_write_free(a);

#ifdef _WINDOWS
	char *buffer = _getcwd(NULL, 0);
	String workingDir = String(buffer);
	free(buffer);
	OSBasics::removeItem(workingDir+"/runinfo_tmp_zzzz.polyrun");
#else
	OSBasics::removeItem("runinfo_tmp_zzzz.polyrun");
#endif
	return 0;
}
Exemple #11
0
void addToMesh(String prefix, Polycode::Mesh *tmesh, const struct aiScene *sc, const struct aiNode* nd, bool swapZY, bool addSubmeshes, bool listOnly, ObjectEntry *parentSceneObject) {
	int i, nIgnoredPolygons = 0;
	unsigned int n = 0, t;
	// draw all meshes assigned to this node

	for (; n < nd->mNumMeshes; ++n) {
	
		if(!addSubmeshes) {
			tmesh = new Polycode::Mesh(Mesh::TRI_MESH);
            tmesh->indexedMesh = true;
		}
	
		const struct aiMesh* mesh = scene->mMeshes[nd->mMeshes[n]];
        
        Vector3 bBox;
        
		if(listOnly) {
			if(!addSubmeshes) {
				printf("%s%s.mesh\n", prefix.c_str(), nd->mName.data);
			}
		} else {
			printf("Importing mesh:%s (%d vertices) (%d faces) \n", mesh->mName.data, mesh->mNumVertices, mesh->mNumFaces);
		}
		//apply_material(sc->mMaterials[mesh->mMaterialIndex]);
        
		for (t = 0; t < mesh->mNumVertices; ++t) {
            Vertex *vertex = new Vertex();
            int index = t;
            if(mesh->mColors[0] != NULL) {
                vertex->vertexColor.setColorRGBA(mesh->mColors[0][index].r, mesh->mColors[0][index].g, mesh->mColors[0][index].b, mesh->mColors[0][index].a);
            }

            if(mesh->mTangents != NULL)  {
                if(swapZY)
                    vertex->tangent = Vector3(mesh->mTangents[index].x, mesh->mTangents[index].z, -mesh->mTangents[index].y);
                else
                    vertex->tangent = Vector3(mesh->mTangents[index].x, mesh->mTangents[index].y, mesh->mTangents[index].z);
            }

            if(mesh->mNormals != NULL)  {
                if(swapZY)
                    vertex->setNormal(mesh->mNormals[index].x, mesh->mNormals[index].z, -mesh->mNormals[index].y);
                else
                    vertex->setNormal(mesh->mNormals[index].x, mesh->mNormals[index].y, mesh->mNormals[index].z);
            }

            if(mesh->HasTextureCoords(0))
            {
                vertex->setTexCoord(mesh->mTextureCoords[0][index].x, mesh->mTextureCoords[0][index].y);
            }

            if(mesh->HasTextureCoords(1))
            {
                vertex->setSecondaryTexCoord(mesh->mTextureCoords[1][index].x, mesh->mTextureCoords[1][index].y);
            }

            
            for( unsigned int a = 0; a < mesh->mNumBones; a++) {
                aiBone* bone = mesh->mBones[a];
                unsigned int boneIndex = addBone(bone);

                for( unsigned int b = 0; b < bone->mNumWeights; b++) {
                    if(bone->mWeights[b].mVertexId == index) {
                        vertex->addBoneAssignment(boneIndex, bone->mWeights[b].mWeight);
                        hasWeights = true;
                    }
                }
            }

            if(swapZY) {
					vertex->set(mesh->mVertices[index].x, mesh->mVertices[index].z, -mesh->mVertices[index].y);
            } else {
                vertex->set(mesh->mVertices[index].x, mesh->mVertices[index].y, mesh->mVertices[index].z);
            }
            
            if(fabs(vertex->x) > bBox.x) {
                bBox.x = vertex->x;
            }
            if(fabs(vertex->y) > bBox.y) {
                bBox.y = vertex->y;
            }
            if(fabs(vertex->z) > bBox.z) {
                bBox.z = vertex->z;
            }
            
            tmesh->addVertex(vertex);
		}
        

         for (t = 0; t < mesh->mNumFaces; ++t) {
             const struct aiFace* face = &mesh->mFaces[t];
			 if (face->mNumIndices != 3) {
				 nIgnoredPolygons++;
				 continue;
			 }

             for(i = 0; i < face->mNumIndices; i++) {
                 int index = face->mIndices[i];
                 tmesh->addIndex(index);
             }
         }
		
		if(!addSubmeshes && !listOnly) {
			String fileNameMesh = prefix+String(nd->mName.data)+".mesh";			
			OSFILE *outFile = OSBasics::open(fileNameMesh.c_str(), "wb");	
			tmesh->saveToFile(outFile, writeNormals, writeTangents, writeColors, writeBoneWeights, writeUVs, writeSecondaryUVs);
			OSBasics::close(outFile);
			delete tmesh;
            
            ObjectEntry *meshEntry = parentSceneObject->addChild("child");
            meshEntry->addChild("id", String(nd->mName.data));
            meshEntry->addChild("tags", "");
            meshEntry->addChild("type", "SceneMesh");
            meshEntry->addChild("cR", "1");
            meshEntry->addChild("cG", "1");
            meshEntry->addChild("cB", "1");
            meshEntry->addChild("cA", "1");
            meshEntry->addChild("blendMode", "0");
            
            aiVector3D p;
            aiVector3D s;
            aiQuaternion r;
            nd->mTransformation.Decompose(s, r, p);
            
            meshEntry->addChild("sX", s.x);
            meshEntry->addChild("sY", s.y);
            meshEntry->addChild("sZ", s.z);

            meshEntry->addChild("rX", r.x);
            meshEntry->addChild("rY", r.y);
            meshEntry->addChild("rZ", r.z);
            meshEntry->addChild("rW", r.w);
            
            meshEntry->addChild("pX", p.x);
            meshEntry->addChild("pY", p.y);
            meshEntry->addChild("pZ", p.z);
            
            meshEntry->addChild("bbX", bBox.x);
            meshEntry->addChild("bbY", bBox.y);
            meshEntry->addChild("bbZ", bBox.z);
            
            ObjectEntry *sceneMeshEntry = meshEntry->addChild("SceneMesh");
            sceneMeshEntry->addChild("file", fileNameMesh);
            
            String materialName = "Default";
            int materialIndex = mesh->mMaterialIndex;
            if(materialIndex < scene->mNumMaterials) {
                aiString name;
                scene->mMaterials[materialIndex]->Get(AI_MATKEY_NAME,name);
                if(name.length > 0) {
                    materialName = String(name.data);
                }
            }
            sceneMeshEntry->addChild("material", materialName);
		}
		if (nIgnoredPolygons) {
			printf("Ignored %d non-triangular polygons\n", nIgnoredPolygons);
		}
	}
	   
	// draw all children
	for (n = 0; n < nd->mNumChildren; ++n) {
		addToMesh(prefix, tmesh, sc, nd->mChildren[n], swapZY, addSubmeshes, listOnly, parentSceneObject);
	}
}
Exemple #12
0
int exportToFile(String prefix, bool swapZY, bool addSubmeshes, bool listOnly, bool exportEntity) {

    Object sceneObject;
    sceneObject.root.name = "entity";
    ObjectEntry *parentEntry = sceneObject.root.addChild("root");
    
    parentEntry->addChild("id", "");
    parentEntry->addChild("tags", "");
    parentEntry->addChild("type", "Entity");
    parentEntry->addChild("cR", "1");
    parentEntry->addChild("cG", "1");
    parentEntry->addChild("cB", "1");
    parentEntry->addChild("cA", "1");
    parentEntry->addChild("blendMode", "0");
    parentEntry->addChild("sX", 1.0);
    parentEntry->addChild("sY", 1.0);
    parentEntry->addChild("sZ", 1.0);
    
    parentEntry->addChild("rX", 0.0);
    parentEntry->addChild("rY", 0.0);
    parentEntry->addChild("rZ", 0.0);
    parentEntry->addChild("rW", 1.0);
    
    parentEntry->addChild("pX", 0.0);
    parentEntry->addChild("pY", 0.0);
    parentEntry->addChild("pZ", 0.0);
    
    parentEntry->addChild("bbX", 0.0);
    parentEntry->addChild("bbY", 0.0);
    parentEntry->addChild("bbZ", 0.0);
    
    ObjectEntry *children = parentEntry->addChild("children");

		
	Polycode::Mesh *mesh = new Polycode::Mesh(Mesh::TRI_MESH);
    mesh->indexedMesh = true;
	addToMesh(prefix, mesh, scene, scene->mRootNode, swapZY, addSubmeshes, listOnly, children);
    
	
	if(addSubmeshes) {
		String fileNameMesh;
		if(prefix != "") {
			fileNameMesh = prefix+".mesh";			
		} else {
			fileNameMesh = "out.mesh";
		}		

		if(listOnly) {
			printf("%s\n", fileNameMesh.c_str());
		} else {
			OSFILE *outFile = OSBasics::open(fileNameMesh.c_str(), "wb");	
			mesh->saveToFile(outFile, writeNormals, writeTangents, writeColors, writeBoneWeights, writeUVs, writeSecondaryUVs);
			OSBasics::close(outFile);
		}
	}
		
	if(hasWeights) {		
		if(listOnly) {
			printf("%s.skeleton\n", prefix.c_str());
		} else {
			printf("Mesh has weights, exporting skeleton...\n");
		}	
		
		String fileNameSkel;
        if(prefix != "") {
            fileNameSkel = prefix+".skeleton";
        } else {
            fileNameSkel = "out.skeleton";
        }
		ISkeleton *skeleton = new ISkeleton();
	
		for (int n = 0; n < scene->mRootNode->mNumChildren; ++n) {
			if(scene->mRootNode->mChildren[n]->mNumChildren > 0) {
				addToISkeleton(skeleton, NULL, scene, scene->mRootNode->mChildren[n]);
			}
		}

		if(scene->HasAnimations()) {
			printf("Importing animations...\n");
			for(int i=0; i < scene->mNumAnimations;i++) {
				aiAnimation *a = scene->mAnimations[i];
				
				if(listOnly) {
					printf("%s%s.anim\n", prefix.c_str(), a->mName.data);
				} else {
					printf("Importing '%s' (%d tracks)\n", a->mName.data, a->mNumChannels);					
				}	
				
			
				IAnimation *anim = new IAnimation();
				anim->tps = a->mTicksPerSecond;
				anim->name = a->mName.data;
				anim->numTracks = a->mNumChannels;
				anim->length = a->mDuration/a->mTicksPerSecond;
	
				for(int c=0; c < a->mNumChannels; c++) {
					aiNodeAnim *nodeAnim = a->mChannels[c];

					ITrack *track = new ITrack();
					track->nodeAnim = nodeAnim;
					anim->tracks.push_back(track);
				}


				skeleton->addAnimation(anim);
				
			}
		} else {
			printf("No animations in file...\n");
		}

		if(!listOnly) {
			skeleton->saveToFile(fileNameSkel.c_str(), swapZY);
		}
	} else {
		if(!listOnly) {
			printf("No weight data, skipping skeleton export...\n");
		}
	}
    
    if(!listOnly && exportEntity) {
		String entityFileName;
		if(prefix != "") {
			entityFileName = prefix+".entity";
		} else {
			entityFileName = "out.entity";
		}        sceneObject.saveToXML(entityFileName);
    }

	if(mesh) {
		delete mesh;
	}
	return 1;
}
Exemple #13
0
bool PolycodeProject::loadProjectFromFile() {

    if(!configFile.loadFromXML(projectFile)) {
        return false;
    }

    if(!configFile.root.readString("entryPoint", &(data.entryPoint))) {
        data.entryPoint = "Source/Main.lua";
        configFile.root.addChild("entryPoint", "Source/Main.lua");
    }

    if(!configFile.root.readInt("defaultWidth", &(data.defaultWidth))) {
        data.defaultWidth = 640;
        configFile.root.addChild("defaultWidth", 640);
    }

    if(!configFile.root.readInt("defaultHeight", &(data.defaultHeight))) {
        data.defaultHeight = 480;
        configFile.root.addChild("defaultHeight", 480);
    }

    if(!configFile.root.readString("textureFiltering", &(data.filteringMode))) {
        data.filteringMode = "linear";
        configFile.root.addChild("textureFiltering", String("linear"));
    }


    if(!configFile.root.readBool("vSync", &(data.vSync))) {
        data.vSync = false;
        configFile.root.addChild("vSync", false);
    }


    if(!configFile.root.readInt("antiAliasingLevel", &(data.aaLevel))) {
        data.aaLevel = 0;
        configFile.root.addChild("antiAliasingLevel", 0);
    }


    if(!configFile.root.readInt("anisotropyLevel", &(data.anisotropy))) {
        data.anisotropy = 0;
        configFile.root.addChild("anisotropyLevel", 0);
    }

    if(!configFile.root.readInt("frameRate", &(data.frameRate))) {
        data.frameRate = 60;
        configFile.root.addChild("frameRate", 60);
    }

    data.modules.clear();
    if(configFile.root["modules"]) {
        for(int i=0; i < configFile.root["modules"]->length; i++) {
            ObjectEntry *module = (*configFile.root["modules"])[i];

            if(module->type != ObjectEntry::STRING_ENTRY) continue;

            data.modules.push_back(module->stringVal);
            CoreServices::getInstance()->getResourceManager()->addArchive("Standalone/Modules/"+module->stringVal+"/API");

        }
    }

    data.fonts.clear();
    if(configFile.root["fonts"]) {
        for(int i=0; i < configFile.root["fonts"]->length; i++) {
            ObjectEntry *font = (*configFile.root["fonts"])[i];

            String fontName, fontPath;
            if(font->readString("name", &fontName) && font->readString("path", &fontPath)) {
                ProjectFontData fontData = ProjectFontData(fontName, fontPath);
                data.fonts.push_back(fontData);
            }
        }
    }

    if(configFile.root["backgroundColor"]) {
        ObjectEntry *color = configFile.root["backgroundColor"];

        bool haveAllColors = 1;
        haveAllColors &= color->readNumber("red", &(data.backgroundColorR));
        haveAllColors &= color->readNumber("green", &(data.backgroundColorG));
        haveAllColors &= color->readNumber("blue", &(data.backgroundColorB));

        if(!haveAllColors) {
            data.backgroundColorR = 0.0;
            data.backgroundColorG = 0.0;
            data.backgroundColorB = 0.0;

            if(!color) color = configFile.root.addChild("backgroundColor");
            color->addChild("red", 0.0);
            color->addChild("green", 0.0);
            color->addChild("blue", 0.0);
        }
    }

    return true;
}
Exemple #14
0
bool PolycodeProject::saveFile() {


    configFile.root["frameRate"]->intVal = data.frameRate;
    configFile.root["defaultWidth"]->intVal = data.defaultWidth;
    configFile.root["defaultHeight"]->intVal = data.defaultHeight;
    configFile.root["entryPoint"]->stringVal = data.entryPoint;
    configFile.root["entryPoint"]->type = ObjectEntry::STRING_ENTRY;

    configFile.root["textureFiltering"]->type = ObjectEntry::STRING_ENTRY;
    configFile.root["textureFiltering"]->stringVal = data.filteringMode;

    ObjectEntry *color = configFile.root["backgroundColor"];

    (*color)["red"]->NumberVal = data.backgroundColorR;
    (*color)["red"]->type = ObjectEntry::FLOAT_ENTRY;

    (*color)["green"]->NumberVal = data.backgroundColorG;
    (*color)["green"]->type = ObjectEntry::FLOAT_ENTRY;

    (*color)["blue"]->NumberVal = data.backgroundColorB;
    (*color)["blue"]->type = ObjectEntry::FLOAT_ENTRY;

    if(configFile.root["modules"]) {
        configFile.root["modules"]->Clear();
    }

    /*
    for(int j=0; j < data.modules.size(); j++) {
    	if(!configFile.root["modules"]) {
    		configFile.root.addChild("modules");
    	}
    	configFile.root["modules"]->type = ObjectEntry::ARRAY_ENTRY;
    	configFile.root["modules"]->addChild("module", data.modules[j]);

    	CoreServices::getInstance()->getResourceManager()->addArchive("Standalone/Modules/"+data.modules[j]+"/API");

    }
    */

    if(configFile.root["fonts"]) {
        configFile.root["fonts"]->Clear();
    }

    for(int j=0; j < data.fonts.size(); j++) {
        if(!configFile.root["fonts"]) {
            configFile.root.addChild("fonts");
        }
        configFile.root["fonts"]->type = ObjectEntry::ARRAY_ENTRY;

        ObjectEntry *objectEntry = configFile.root["fonts"]->addChild("font");
        objectEntry->addChild("name", data.fonts[j].fontName);
        objectEntry->addChild("path", data.fonts[j].fontPath);

    }

    if(configFile.root["packedItems"]) {
        configFile.root["packedItems"]->Clear();
    }

    vector<OSFileEntry> files = OSBasics::parseFolder(projectFolder, false);

    for(int i=0; i < files.size(); i++) {
        OSFileEntry entry = files[i];

        if(!configFile.root["packedItems"]) {
            configFile.root.addChild("packedItems");
        }

        if(entry.type == OSFileEntry::TYPE_FOLDER) {
            ObjectEntry *objectEntry = configFile.root["packedItems"]->addChild("item");
            objectEntry->addChild("type", "folder");
            objectEntry->addChild("path", entry.name);
        } else {
            if(entry.fullPath != projectFile) {
                ObjectEntry *objectEntry = configFile.root["packedItems"]->addChild("item");
                objectEntry->addChild("type", "file");
                objectEntry->addChild("path", entry.name);
            }
        }
    }


    unsigned int afMap[6] = {0,1,2,4,8,16};
    unsigned int aaMap[4] = {0,2,4,6};

    configFile.root["antiAliasingLevel"]->intVal = data.aaLevel;
    configFile.root["anisotropyLevel"]->intVal = data.anisotropy;
    configFile.root["vSync"]->boolVal = data.vSync;

    configFile.saveToXML(projectFile);

    return true;
}
bool PolycodeProject::loadProjectFromFile() {

	if(!configFile.loadFromXML(projectFile)) {
		return false;
	}
	
	if(configFile.root["entryPoint"]) {	
		data.entryPoint = configFile.root["entryPoint"]->stringVal;
	} else {
		data.entryPoint = "Source/Main.lua";
		configFile.root.addChild("entryPoint", "Source/Main.lua");
	}
	
	if(configFile.root["defaultWidth"]) {	
		data.defaultWidth = configFile.root["defaultWidth"]->intVal;
	} else {
		data.defaultWidth = 640;	
		configFile.root.addChild("defaultWidth", 640);			
	}
	
	if(configFile.root["defaultHeight"]) {	
		data.defaultHeight = configFile.root["defaultHeight"]->intVal;
	} else {
		data.defaultHeight = 480;	
		configFile.root.addChild("defaultHeight", 480);		
	}

	if(configFile.root["vSync"]) {	
		data.vSync = configFile.root["vSync"]->boolVal;
	} else {
		data.vSync = false;
		configFile.root.addChild("vSync", false);		
	}


	if(configFile.root["antiAliasingLevel"]) {
		data.aaLevel = configFile.root["antiAliasingLevel"]->intVal;
	} else {
		data.aaLevel = 0;
		configFile.root.addChild("antiAliasingLevel", 0);		
	}


	if(configFile.root["anisotropyLevel"]) {
		data.anisotropy = configFile.root["anisotropyLevel"]->intVal;
	} else {
		data.anisotropy = 0;
		configFile.root.addChild("anisotropyLevel", 0);		
	}

	if(configFile.root["frameRate"]) {
		data.frameRate = configFile.root["frameRate"]->intVal;	
	} else {
		data.frameRate = 60;
		configFile.root.addChild("frameRate", 60);
	}
	
	data.modules.clear();
	if(configFile.root["modules"]) {
		for(int i=0; i < configFile.root["modules"]->length; i++) {
			ObjectEntry *module = (*configFile.root["modules"])[i];
			data.modules.push_back(module->stringVal);
		}
	}	

	if(configFile.root["backgroundColor"]) {
		ObjectEntry *color = configFile.root["backgroundColor"];
		if((*color)["red"] && (*color)["green"] && (*color)["blue"]) {
			data.backgroundColorR = (*color)["red"]->NumberVal;
			data.backgroundColorG = (*color)["green"]->NumberVal;
			data.backgroundColorB = (*color)["blue"]->NumberVal;
		} else {
			data.backgroundColorR = 0.0;
			data.backgroundColorG = 0.0;
			data.backgroundColorB = 0.0;
			
			ObjectEntry *color = configFile.root.addChild("backgroundColor");			
			color->addChild("red", 0.0);
			color->addChild("green", 0.0);
			color->addChild("blue", 0.0);						
		}
	}

	return true;
}
Exemple #16
0
bool PolycodeProject::loadProjectFromFile() {

	if(!configFile.loadFromXML(projectFile)) {
		return false;
	}
	
	if(configFile.root["entryPoint"]) {	
		data.entryPoint = configFile.root["entryPoint"]->stringVal;
	} else {
		data.entryPoint = "Source/Main.lua";
		configFile.root.addChild("entryPoint", "Source/Main.lua");
	}
	
	if(configFile.root["defaultWidth"]) {	
		data.defaultWidth = configFile.root["defaultWidth"]->intVal;
	} else {
		data.defaultWidth = 640;	
		configFile.root.addChild("defaultWidth", 640);			
	}
	
	if(configFile.root["defaultHeight"]) {	
		data.defaultHeight = configFile.root["defaultHeight"]->intVal;
	} else {
		data.defaultHeight = 480;	
		configFile.root.addChild("defaultHeight", 480);		
	}

	if(configFile.root["vSync"]) {	
		data.vSync = configFile.root["vSync"]->boolVal;
	} else {
		data.vSync = false;
		configFile.root.addChild("vSync", false);		
	}


	if(configFile.root["antiAliasingLevel"]) {
		data.aaLevel = configFile.root["antiAliasingLevel"]->intVal;
	} else {
		data.aaLevel = 0;
		configFile.root.addChild("antiAliasingLevel", 0);		
	}


	if(configFile.root["anisotropyLevel"]) {
		data.anisotropy = configFile.root["anisotropyLevel"]->intVal;
	} else {
		data.anisotropy = 0;
		configFile.root.addChild("anisotropyLevel", 0);		
	}

	if(configFile.root["frameRate"]) {
		data.frameRate = configFile.root["frameRate"]->intVal;	
	} else {
		data.frameRate = 60;
		configFile.root.addChild("frameRate", 60);
	}
	
	data.modules.clear();
	if(configFile.root["modules"]) {
		for(int i=0; i < configFile.root["modules"]->length; i++) {
			ObjectEntry *module = (*configFile.root["modules"])[i];
			data.modules.push_back(module->stringVal);
			CoreServices::getInstance()->getResourceManager()->addArchive("Standalone/Modules/"+module->stringVal+"/API");
			
		}
	}
	
	data.fonts.clear();
	if(configFile.root["fonts"]) {
		for(int i=0; i < configFile.root["fonts"]->length; i++) {
			ObjectEntry *font = (*configFile.root["fonts"])[i];
			ObjectEntry *fontName = (*font)["name"];
			ObjectEntry *fontPath = (*font)["path"];
			
			if(fontName && fontPath) {
				ProjectFontData fontData = ProjectFontData(fontName->stringVal, fontPath->stringVal);
				data.fonts.push_back(fontData);
			}
		}
	}		

	if(configFile.root["backgroundColor"]) {
		ObjectEntry *color = configFile.root["backgroundColor"];
		if((*color)["red"] && (*color)["green"] && (*color)["blue"]) {
			data.backgroundColorR = (*color)["red"]->NumberVal;
			data.backgroundColorG = (*color)["green"]->NumberVal;
			data.backgroundColorB = (*color)["blue"]->NumberVal;
		} else {
			data.backgroundColorR = 0.0;
			data.backgroundColorG = 0.0;
			data.backgroundColorB = 0.0;
			
			ObjectEntry *color = configFile.root.addChild("backgroundColor");			
			color->addChild("red", 0.0);
			color->addChild("green", 0.0);
			color->addChild("blue", 0.0);						
		}
	}

	return true;
}