Example #1
0
YamlNode * UISlider::SaveToYamlNode(UIYamlLoader * loader)
{
    thumbButton->SetName(UISLIDER_THUMB_SPRITE_CONTROL_NAME);

    YamlNode *node = UIControl::SaveToYamlNode(loader);

    // Sprite value
    float32 value = this->GetValue();
    node->Set("value", value);

    // Sprite min value
    value = this->GetMinValue();
    node->Set("minValue", value);

    // Sprite max value
    value = this->GetMaxValue();
    node->Set("maxValue", value);

    // Min/max background sprites.
    SaveBackground("min", minBackground, node, loader);
    SaveBackground("max", maxBackground, node, loader);

    // Sprites are now embedded into UISlider.
    node->Set("spritesEmbedded", true);

    return node;
}
Example #2
0
int CMapFileIO::SaveMap(const CLevelMap &map, HANDLE hFile) const
{
	XML_MANAGER_HANDLE xml = 0;
	std::wostringstream os;
	xml = CreateWorker();
	if(!xml)
		return 1;
	BeginDoc(xml, L"map");
	XML_NODE_HANDLE root = GetRootNode(xml);
	if(!root)
		return 1;
	XML_NODE_HANDLE node;

	int w, h;
	D3DXVECTOR3 pos;

	//dimensions
	node = AddNode(xml, root, L"dimensions");
	if(!node)
		return 1;
	w = map.GetWidth();
	h = map.GetHeight();
	os << w;
	SetNodeAttr(xml, node, L"width", os.str().c_str());
	os.str(L"");
	os << h;
	SetNodeAttr(xml, node, L"height", os.str().c_str());
	os.str(L"");
	ReleaseNode(node);

	//background
	SaveBackground(*map.GetBackground(), xml, root);

	//player
	SavePlayer( map.GetPlayer(), xml, root );

	//tiles
	SaveTileList(map.m_pTiles, xml, root);

	//creatures
	SaveCreatureList(map.m_pCreatures, xml, root);

	SaveToFileHandle(xml, hFile, true);
	CloseHandle(hFile);
	ReleaseWorker(xml);
	return 0;
}