예제 #1
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;
}
//----------------------------------------------------------------------------
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");
}