Exemple #1
0
void XMLData::read()
{
	// read until EOF or end token
	
	for (;;) {
		std::string* token;
		token = readToken();
		if (!token || (token && !strncmp(token->c_str(), "</", 2))) {
			if (token) {
				delete token;
			}
			return;
		}
		if (token->c_str()[0] == '<') {
			if (debug) {
				std::cout << "Reading sub tag\n";
			}
			std::string* name = getName(token);
			if (debug)
				std::cout << "Token is " << name->c_str() << "\n";
			XMLData* newdata = new XMLData(name, file);
			delete name;
			newdata->read();
			nodes.push_back(newdata);
		}
		else {
			value += token->c_str();
		}
		delete token;
	}
}
Exemple #2
0
//----------------------------------------------------------------------------
bool Project::SaveConfig(const std::string &filename)
{
    // xml
    XMLData data;
    data.Create();

    XMLNode projNode = data.NewChild("project");

    // general
    XMLNode generalNode = projNode.NewChild("general");
    generalNode.SetAttributeString("name", GetName().c_str());
    generalNode.SetAttributeString("screenorientation", _ToSOStr(mScreenOrientation));
    generalNode.SetAttributeInt("width", (int)mSize.Width);
    generalNode.SetAttributeInt("height", (int)mSize.Height);
    std::string colorStr =
        StringHelp::IntToString((int)(mBackgroundColor[0] * 255.0f)) + "," +
        StringHelp::IntToString((int)(mBackgroundColor[1] * 255.0f)) + "," +
        StringHelp::IntToString((int)(mBackgroundColor[2] * 255.0f)) + "," +
        StringHelp::IntToString((int)(mBackgroundColor[3] * 255.0f));
    generalNode.SetAttributeString("backcolor", colorStr);
    std::string projColorStr =
        StringHelp::IntToString((int)(mProjBackgroundColor[0] * 255.0f)) + "," +
        StringHelp::IntToString((int)(mProjBackgroundColor[1] * 255.0f)) + "," +
        StringHelp::IntToString((int)(mProjBackgroundColor[2] * 255.0f)) + "," +
        StringHelp::IntToString((int)(mProjBackgroundColor[3] * 255.0f));
    generalNode.SetAttributeString("projcolor", projColorStr);

    // scene
    XMLNode sceneNode = projNode.NewChild("scene");
    sceneNode.SetAttributeString("filename", mSceneFilename.c_str());

    // render setting
    XMLNode renderNode = projNode.NewChild("render_setting");

    // language
    XMLNode languageNode = projNode.NewChild("language");

    // publish
    XMLNode publish = projNode.NewChild("publish");

    // setting
    XMLNode settingNode = projNode.NewChild("edit_setting");
    settingNode.SetAttributeFloat("uicamerapercent", mEdit_UICameraPercent);

    if (data.SaveFile(filename))
    {
        return true;
    }

    return false;
}
Exemple #3
0
void XMLData::write(std::ofstream& out, int tabs = 0)
{
	if (value == "") {
		for (int i = 0; i < tabs; i++) {
			out << "\t";
		}

		out << "<" << name->c_str() << ">" << std::endl;

		std::list<XMLData*>::iterator it = nodes.begin();

		while (it != nodes.end()) {
			XMLData* node = dynamic_cast<XMLData*>(*it);
			node->write(out, tabs+1);
			it++;
		}

		for (int i = 0; i < tabs; i++) {
			out << "\t";
		}

		out << "</" << name->c_str() << ">" << std::endl;
	}
	else {
		for (int i = 0; i < tabs; i++) {
			out << "\t";
		}

		out << "<" << name->c_str() << ">";

		out << value;
		
		std::list<XMLData*>::iterator it = nodes.begin();

		while (it != nodes.end()) {
			XMLData* node = dynamic_cast<XMLData*>(*it);
			node->write(out, tabs+1);
			it++;
		}

		out << "</" << name->c_str() << ">" << std::endl;
	}
}
//----------------------------------------------------------------------------
bool EngineLoop::WriteBoost()
{
	XMLData data;

	data.Create();

	XMLNode boostNode = data.NewChild("boost");
	boostNode.SetAttributeString("name", "boost");

	XMLNode configNode = boostNode.NewChild("config");

	XMLNode varNode_config = configNode.NewChild("var");
	varNode_config.SetAttributeInt("width", (int)mBoostSize.Width);
	varNode_config.SetAttributeInt("height", (int)mBoostSize.Height);

	XMLNode playNode = boostNode.NewChild("play");
	XMLNode varNode_play = playNode.NewChild("var");
	varNode_play.SetAttributeString("projectname", mProjectName);
	varNode_play.SetAttributeString("playlogicmode", GetPlayLogicModeStr());

	return data.SaveFile("Data/boost.xml");
}
//----------------------------------------------------------------------------
bool GameManager::LoadBoost (const char *filename)
{
	XMLData data;

	int bufferSize = 0;
	char *buffer = 0;
	ResourceManager::GetSingleton().GetBuffer(filename, bufferSize, buffer);

	if (!buffer || bufferSize==0)
		return false;

	if (data.LoadBuffer(buffer, bufferSize))
	{
		delete1<char>(buffer);

		data.GetNodeByPath("Config.var").AttribToInt("width", mBoostWidth);
		data.GetNodeByPath("Config.var").AttribToInt("height", mBoostHeight);
		mProjectPath = data.GetNodeByPath("Play.var").AttributeToString("projectPath");

		return true;
	}

	return false;
}
Exemple #6
0
void load(
	Animation_Set *anim_set,
	std::string info_filename,
	std::string path_to_files,
	std::map< std::pair<std::string, int>, std::vector<Bone> > &bones)
{
	XMLData *xml = new XMLData(info_filename);
	std::list<XMLData *>::iterator it;
	std::list<XMLData *> nodes = xml->get_nodes();

	std::string sub_bak = anim_set->get_sub_animation_name();

	for (it = nodes.begin(); it != nodes.end(); it++) {
		XMLData *sub = *it;
		XMLData *tmp;
		std::string name = sub->get_name();
		tmp = sub->find("frames");
		std::string framesS;
		if (tmp)
			framesS = tmp->get_value();
		else
			framesS = "1";
		int nframes = atoi(framesS.c_str());
		for (int i = 0; i < nframes; i++) {
			anim_set->set_sub_animation(name, true);
			anim_set->get_current_animation()->set_frame(i);
			int w = anim_set->get_current_animation()->get_current_frame()->get_width();
			int h = anim_set->get_current_animation()->get_current_frame()->get_height();
			std::string filename = path_to_files + "/" + name + "/" + General::itos(i+1) + ".xml";
			std::vector<Bone> bones2;
			load(bones2, w, h, filename);
			std::pair<std::string, int> p;
			p.first = name;
			p.second = i;
			bones[p] = bones2;
		}
	}

	anim_set->set_sub_animation(sub_bak);

	delete xml;
}
//----------------------------------------------------------------------------
bool EngineLoop::LoadBoost(const std::string &filename)
{
	XMLData data;

	int bufferSize = 0;
	char *buffer = 0;
	ResourceManager::GetSingleton().LoadBuffer(filename, bufferSize, buffer);
	if (!buffer || bufferSize == 0) return false;

	if (data.LoadBuffer(buffer, bufferSize))
	{
		mBoostSize.Width = data.GetNodeByPath("config.var").AttributeToFloat("width");
		mBoostSize.Height = data.GetNodeByPath("config.var").AttributeToFloat("height");
		mProjectName = data.GetNodeByPath("play.var").AttributeToString("projectname");
		mPlayLogicMode = _StrToPlayLogicMode(data.GetNodeByPath("play.var").AttributeToString("playlogicmode"));

		return true;
	}

	return false;
}
bool Whack_a_Skunk_Loop::init(void)
{
	engine->clear_touches();

	if (inited) {
		return true;
	}
	Loop::init();

	regular_skunk = new Animation_Set();
	regular_skunk->load("mini_games/whack_a_skunk/skunk");
	silver_skunk = new Animation_Set();
	silver_skunk->load("mini_games/whack_a_skunk/silver_skunk");
	gold_skunk = new Animation_Set();
	gold_skunk->load("mini_games/whack_a_skunk/gold_skunk");
	fake_skunk = new Animation_Set();
	fake_skunk->load("mini_games/whack_a_skunk/mallard");
	skunk_size.w = regular_skunk->get_current_animation()->get_current_frame()->get_bitmap()->get_width();
	skunk_size.h = regular_skunk->get_current_animation()->get_current_frame()->get_bitmap()->get_height();

	bg_bitmap = Wrap::load_bitmap("mini_games/whack_a_skunk/board.png");

	hand = new Animation_Set();
	hand->load("mini_games/whack_a_skunk/hands");
	hand_size.w = hand->get_current_animation()->get_current_frame()->get_bitmap()->get_width();
	hand_size.h = hand->get_current_animation()->get_current_frame()->get_bitmap()->get_height();

	font_w = 15;
	font_h = 19;
	font = new Animation_Set();
	font->load("mini_games/whack_a_skunk/font");

	XMLData *xml = new XMLData("mini_games/whack_a_skunk/board.xml");

	for (int i = 0; i < 9; i++) {
		char buf[2];
		buf[0] = '0'+i;
		buf[1] = 0;
		XMLData *node = xml->find(std::string(buf));
		XMLData *x_node = node->find("x");
		XMLData *y_node = node->find("y");
		Skunk_Hole h;
		h.x = atoi(x_node->get_value().c_str());
		h.y = atoi(y_node->get_value().c_str());
		h.status = NIL;
		h.miss_count = -1;
		holes.push_back(h);
	}

	delete xml;

	bg_w = al_get_bitmap_width(bg_bitmap->bitmap);
	bg_h = al_get_bitmap_height(bg_bitmap->bitmap);

	top_offset.x = (cfg.screen_w-bg_w)/2;
	top_offset.y = cfg.screen_h-bg_h;

	next_diff = max_next - min_next;
	next_count = 0;

	misses = 0;
	hits = 0;

	star_bmp = Wrap::load_bitmap("mini_games/whack_a_skunk/star.png");
	pow_bmp = Wrap::load_bitmap("mini_games/whack_a_skunk/pow.png");
	kratch_bmp = Wrap::load_bitmap("mini_games/whack_a_skunk/kratch.png");
	mask_front = Wrap::load_bitmap("mini_games/whack_a_skunk/mask-front.png");
	mask_middle = Wrap::load_bitmap("mini_games/whack_a_skunk/mask-middle.png");
	mask_back = Wrap::load_bitmap("mini_games/whack_a_skunk/mask-back.png");
	highlight_front = Wrap::load_bitmap("mini_games/whack_a_skunk/highlight-front.png");
	highlight_middle = Wrap::load_bitmap("mini_games/whack_a_skunk/highlight-middle.png");
	highlight_back = Wrap::load_bitmap("mini_games/whack_a_skunk/highlight-back.png");
	mask_fronthighlight = Wrap::load_bitmap("mini_games/whack_a_skunk/mask-fronthighlight.png");
	mask_middlehighlight = Wrap::load_bitmap("mini_games/whack_a_skunk/mask-middlehighlight.png");
	mask_backhighlight = Wrap::load_bitmap("mini_games/whack_a_skunk/mask-backhighlight.png");

	start_time = al_current_time();

	// Load SFX
	hit_sample = Sound::load("mini_games/whack_a_skunk/sfx/bash.ogg");
	miss_sample = Sound::load("mini_games/whack_a_skunk/sfx/bash_no_skunk.ogg");
	taunt_sample = Sound::load_set("mini_games/whack_a_skunk/sfx/taunt", "ogg");

	return true;
}
int main() {
	XMLData* xml = XMLData::getInstance();
	xml->parseXML("sim/codes.xml");

	srand(time(0));

	vector<bool> location = decToBinary(3, xml->LIMB_NB_LENGTH());
	vector<bool> location2 = decToBinary(1, xml->LIMB_NB_LENGTH());
	location.insert(location.end(), location2.begin(), location2.end());


/* Ear Strand */
	cout << "First Ear" << endl;
	EarStrand first_earStrand(2, location);

	cout << "First Ear Sequence : " << binaryToString(first_earStrand.getSequence()) << endl;
	cout << "First Ear getNumber() : " << first_earStrand.getNumber() << endl;
	cout << "First Ear getNumberBin() : " << binaryToString(first_earStrand.getNumberBin()) << endl;
	cout << "First Ear getLocations() : " <<  binaryToString(first_earStrand.getLocations()) << endl;
	cout << "First Ear getLocationOf(0) :" << binaryToString(first_earStrand.getLocationOf(0)) << endl;
	cout << "First Ear getLocationOf(1) :" << binaryToString(first_earStrand.getLocationOf(1)) << endl;

	cout << "___________________________________" << endl;

/* Eye Strand */

	vector<bool> eyeColour = hexToBinary("FFFFFF");

	location = decToBinary(2, xml->LIMB_NB_LENGTH());
	location2 = decToBinary(14, xml->LIMB_NB_LENGTH());
	vector<bool> location3 = decToBinary(1, xml->LIMB_NB_LENGTH());
	location.insert(location.end(), location2.begin(), location2.end());
	location.insert(location.end(), location3.begin(), location3.end());

	cout << "First Eye" << endl;
	EyeStrand first_eyeStrand(eyeColour, 3, location);

	cout << "First Eye Sequence : " << binaryToString(first_eyeStrand.getSequence()) << endl;
	cout << "First Eye getNumber() : " << first_eyeStrand.getNumber() << endl;
	cout << "First Eye getNumberBin() : " << binaryToString(first_eyeStrand.getNumberBin()) << endl;
	cout << "First Eye getLocations() : " <<  binaryToString(first_eyeStrand.getLocations()) << endl;
	cout << "First Eye getLocationOf(0) :" << binaryToString(first_eyeStrand.getLocationOf(0)) << endl;
	cout << "First Eye getLocationOf(1) :" << binaryToString(first_eyeStrand.getLocationOf(1)) << endl;
	cout << "First Eye getLocationOf(2) :" << binaryToString(first_eyeStrand.getLocationOf(2)) << endl;
	cout << "First Eye getColor() :" << first_eyeStrand.getColor() << endl;
	cout << "First Eye getColorBin() :" << binaryToString(first_eyeStrand.getColorBin()) << endl;

	cout << "___________________________________" << endl;

/* Creature */
	DNA dna1;
	dna1.addStrand(&first_earStrand);
	dna1.addStrand(&first_eyeStrand);

	Creature creature1(0, dna1);
	DNA dna12 = creature1.getDNA();
	vector<Strand*> vectorStrand1 = dna12.getDNAStrand();
	EarStrand* first_creature_earStrand = (EarStrand*) vectorStrand1[0];
	EyeStrand* first_creature_eyeStrand = (EyeStrand*) vectorStrand1[1];

	cout << "First Creature ID : " << creature1.getID() << endl;
	cout << "First Creature First Sequence Type : " << vectorStrand1[0]->getStrandType() << endl;
	cout << "First Creature Second Sequence Type : " << vectorStrand1[1]->getStrandType() << endl;
	cout << "-------------------------" << endl;
	cout << "First Creature Ear Sequence : " << binaryToString(first_creature_earStrand->getSequence()) << endl;
	cout << "First Creature Ear getNumber() : " << first_creature_earStrand->getNumber() << endl;
	cout << "First Creature Ear getNumberBin() : " << binaryToString(first_creature_earStrand->getNumberBin()) << endl;
	cout << "First Creature Ear getLocations() : " <<  binaryToString(first_creature_earStrand->getLocations()) << endl;
	cout << "First Creature Ear getLocationOf(0) :" << binaryToString(first_creature_earStrand->getLocationOf(0)) << endl;
	cout << "First Creature Ear getLocationOf(1) :" << binaryToString(first_creature_earStrand->getLocationOf(1)) << endl;
	cout << "----------------------------" << endl;
	cout << "First Creature Eye Sequence : " << binaryToString(first_creature_eyeStrand->getSequence()) << endl;
	cout << "First Creature Eye getNumber() : " << first_creature_eyeStrand->getNumber() << endl;
	cout << "First Creature Eye getNumberBin() : " << binaryToString(first_creature_eyeStrand->getNumberBin()) << endl;
	cout << "First Creature Eye getLocations() : " <<  binaryToString(first_creature_eyeStrand->getLocations()) << endl;
	cout << "First Creature Eye getLocationOf(0) :" << binaryToString(first_creature_eyeStrand->getLocationOf(0)) << endl;
	cout << "First Creature Eye getLocationOf(1) :" << binaryToString(first_creature_eyeStrand->getLocationOf(1)) << endl;
	cout << "First Creature Eye getLocationOf(2) :" << binaryToString(first_creature_eyeStrand->getLocationOf(2)) << endl;
	cout << "First Creature Eye getColor() :" << first_creature_eyeStrand->getColor() << endl;
	cout << "First Creature Eye getColorBin() :" << binaryToString(first_creature_eyeStrand->getColorBin()) << endl;
	cout << "----------------------------" << endl;


	return 0;
}
//----------------------------------------------------------------------------
bool ResourceManager::AddTexPack (const std::string &texPackPath)
{
	if (mTexPacks.find(texPackPath) != mTexPacks.end())
		return false;

	int bufferSize = 0;
	char *buffer = 0;
	if (GetBuffer(texPackPath, bufferSize, buffer))
	{
		std::string outPath;
		std::string outBaseName;
		std::string outExt;
		StringHelp::SplitFullFilename(texPackPath, outPath, outBaseName, outExt);

		XMLData data;
		if (data.LoadBuffer(buffer, bufferSize))
		{
			XMLNode rootNode = data.GetRootNode();
			std::string imagePath = rootNode.AttributeToString("imagePath");
			int width = rootNode.AttributeToInt("width");
			int height = rootNode.AttributeToInt("height");
			TexPack pack;
			pack.ImagePath = imagePath;
			pack.Width = width;
			pack.Height = height;

			XMLNode childNode = rootNode.IterateChild();
			while (!childNode.IsNull())
			{
				std::string eleName;
				int x = 0;
				int y = 0;
				int w = 0;
				int h = 0;
				int oX = 0;
				int oY = 0;
				int oW = 0;
				int oH = 0;
				bool rolated = false;

				if (childNode.HasAttribute("n"))
					eleName = childNode.AttributeToString("n");
				if (childNode.HasAttribute("x"))
					x = childNode.AttributeToInt("x");
				if (childNode.HasAttribute("y"))
					y = childNode.AttributeToInt("y");
				if (childNode.HasAttribute("w"))
					w = childNode.AttributeToInt("w");
				if (childNode.HasAttribute("h"))
					h = childNode.AttributeToInt("h");
				if (childNode.HasAttribute("oX"))
					oX = childNode.AttributeToInt("oX");
				if (childNode.HasAttribute("oY"))
					oY = childNode.AttributeToInt("oY");
				if (childNode.HasAttribute("oW"))
					oW = childNode.AttributeToInt("oW");
				if (childNode.HasAttribute("oH"))
					oH = childNode.AttributeToInt("oH");
				if (childNode.HasAttribute("r"))
					rolated = (std::string(childNode.AttributeToString("r"))=="y");
				
				TexPackElement ele;
				ele.X = x;
				ele.Y = y;
				ele.W = w;
				ele.H = h;
				ele.OX = oX;
				ele.OY = oY;
				ele.OW = oW;
				ele.OH = oH;
				ele.Rolated = rolated;
				ele.TexWidth = width;
				ele.TexHeight = height;
				ele.ElementName = eleName;
				ele.ImagePathFull = outPath+imagePath;

				pack.Elements.push_back(ele);

				std::string allStr = texPackPath+eleName;
				mPackElements[allStr] = ele;

				childNode = rootNode.IterateChild(childNode);
			}

			mTexPacks[texPackPath] = pack;
		}

		delete1(buffer);

		return true;
	}

	return false;
}
//----------------------------------------------------------------------------
bool FontBitmapImpl::Initlize (int fontWidth, int fontHeight, 
	const char *fontFilename, CharCodingType codingType, unsigned int fontExtStyle)
{
	Font::Initlize(fontWidth, fontHeight, fontFilename, codingType, fontExtStyle);

	mFontFilename = fontFilename;

	if (CCT_UTF8 == codingType)
	{
		mCharCodingObj = new0 CharCodingUTF8();
	}
	else if (CCT_GBK == codingType)
	{
		mCharCodingObj = new0 CharCodingGBK();
	}

	mGlyphMap = this;

	std::string outPath;
	std::string outBaseFilename;
	StringHelp::SplitFilename(fontFilename, outPath, outBaseFilename);

	int bufferSize = 0;
	char *buffer = 0;
	if (PX2_RM.LoadBuffer(fontFilename, bufferSize, buffer))
	{
		XMLData data;
		if (data.LoadBuffer(buffer, bufferSize))
		{
			float imageWidth = 0.0f;
			float imageHeight = 0.0f;

			XMLNode rootNode = data.GetRootNode();
			XMLNode child = rootNode.IterateChild();
			while (!child.IsNull())
			{
				const std::string &nodeName = child.GetName();

				if ("image" == nodeName)
				{
					const char *text = child.GetText();
					std::string imagePath = outPath + text;

					mFontTex = DynamicCast<Texture2D>(PX2_RM.BlockLoad(imagePath));
					if (mFontTex)
					{
						imageWidth = (float)mFontTex->GetWidth();
						imageHeight = (float)mFontTex->GetHeight();
					}
				}
				else if ("symbol" == nodeName)
				{
					std::string ch = child.GetChild("char").GetText();
					int x = StringHelp::StringToInt(child.GetChild("x").GetText());
					int y = StringHelp::StringToInt(child.GetChild("y").GetText());
					int width = StringHelp::StringToInt(child.GetChild("width").GetText());
					int height = StringHelp::StringToInt(child.GetChild("height").GetText());

					unsigned int unicode = mCharCodingObj->ToUnicode((const unsigned char*)ch.c_str());

					BitmapFontGlyph glyph;
					glyph.X = x;
					glyph.Y = y;
					glyph.numWidth = width;
					glyph.numHeight = height;

					float u0 = (float)x/imageWidth;
					float v0 = 1.0f-(float)(y+height)/imageHeight;
					float u1 = (x+width)/imageWidth;
					float v1 = v0 + (float)height/imageHeight;
					glyph.RectUV = Rectf(u0, v0, u1, v1);

					mMapGlyph[unicode] = glyph;
				}

				child = rootNode.IterateChild(child);
			}
		}
	}

	return true;
}
Exemple #12
0
//----------------------------------------------------------------------------
bool Project::Load(const std::string &filename)
{
    std::string name;
    int width = 0;
    int height = 0;
    std::string sceneFilename;
    std::string uiFilename;
    std::string languageFilename;

    char *buffer = 0;
    int bufferSize = 0;
    if (PX2_RM.LoadBuffer(filename, bufferSize, buffer))
    {
        XMLData data;
        if (data.LoadBuffer(buffer, bufferSize))
        {
            XMLNode rootNode = data.GetRootNode();

            // general
            XMLNode generalNode = rootNode.GetChild("general");
            if (!generalNode.IsNull())
            {
                name = generalNode.AttributeToString("name");

                SetScreenOrientation(_FromSOStr(generalNode.AttributeToString("screenorientation")));

                width = generalNode.AttributeToInt("width");
                height = generalNode.AttributeToInt("height");

                std::string colorStr = generalNode.AttributeToString("backcolor");
                StringTokenizer stk(colorStr, ",");
                Float4 color = Float4::MakeColor(
                                   StringHelp::StringToInt(stk[0]),
                                   StringHelp::StringToInt(stk[1]),
                                   StringHelp::StringToInt(stk[2]),
                                   StringHelp::StringToInt(stk[3]));

                std::string projcolorStr = generalNode.AttributeToString("projcolor");
                StringTokenizer stkprojcolor(projcolorStr, ",");
                Float4 projcolor = Float4::MakeColor(
                                       StringHelp::StringToInt(stkprojcolor[0]),
                                       StringHelp::StringToInt(stkprojcolor[1]),
                                       StringHelp::StringToInt(stkprojcolor[2]),
                                       StringHelp::StringToInt(stkprojcolor[3]));

                Sizef size = Sizef((float)width, (float)height);
                SetName(name);
                SetSize(size);
                mViewRect = Rectf(0.0f, 0.0f, size.Width, size.Height);
                SetBackgroundColor(color);
                SetProjBackgroundColor(projcolor);
            }

            // scene
            XMLNode sceneNode = rootNode.GetChild("scene");
            if (!sceneNode.IsNull())
            {
                sceneFilename = sceneNode.AttributeToString("filename");
                SetSceneFilename(sceneFilename);
            }

            XMLNode renderNode = rootNode.GetChild("render_setting");
            if (!renderNode.IsNull())
            {
            }

            // language
            XMLNode languageNode = rootNode.GetChild("language");

            // publish
            XMLNode publishNode = rootNode.GetChild("publish");

            // setting
            XMLNode settingNode = rootNode.GetChild("setting");
            if (!settingNode.IsNull())
            {
                if (settingNode.HasAttribute("uicamerapercent"))
                    mEdit_UICameraPercent = settingNode.AttributeToFloat("uicamerapercent");
            }

            // split file names
            std::string outPath;
            std::string outBaseName;
            std::string outExt;
            StringHelp::SplitFullFilename(filename, outPath, outBaseName, outExt);

            // ui
            mUIFilename = outPath + outBaseName + "_ui.px2obj";
        }
    }
    else
    {
        return false;
    }

    return true;
}
Exemple #13
0
int main(int argc, char **argv) {

	XMLData* xml = XMLData::getInstance();
	string file;
	if(argc < 2) {
		file = "sim/codes.xml";
	}
	else {
		file = argv[1];
	}
	xml->parseXML(file);

	cout << "Hairiness : ";
	cout << "types=" << xml->HAIR_TYPE_LENGTH() << " (";
	for(auto const& value : xml->getHairTypes()) {
		cout << value << ";";
	}
	cout << ")" << endl;

	cout << endl << "Limbs : ";
	cout << "nb=" << xml->LIMB_NB_LENGTH() << " - size=" << xml->LIMB_SIZE_LENGTH() << " - types=" << xml->LIMB_TYPE_LENGTH() << " (";
	for(auto const& value : xml->getLimbTypes()) {
		cout << value << ";";
	}
	cout << ")" << endl;

	cout << endl << "Ears : ";
	cout << "nb=" << xml->EAR_NB_LENGTH() << endl;

	cout << endl << "Eyes : ";
	cout << "nb=" << xml->EYE_NB_LENGTH() << endl;

	cout << endl << "Nostrils : ";
	cout << "nb=" << xml->NOSTRIL_NB_LENGTH() << endl;

	cout << endl << "Mouth : ";
	cout << "types=" << xml->MOUTH_WIDTH_LENGTH() << " (";
	for(auto const& value : xml->getMouthWidthTypes()) {
		cout << value << ";";
	}
	cout << ")" << endl;
	cout << "Teeth : ";
	cout << "nb=" << xml->TEETH_NB_LENGTH() << " - types=" << xml->TEETH_TYPE_LENGTH() << " (";
	for(auto const& value : xml->getTeethTypes()) {
		cout << value << ";";
	}
	cout << ")" << endl;


	return 0;
}