本文整理汇总了C++中CColor::ParseString方法的典型用法代码示例。如果您正苦于以下问题:C++ CColor::ParseString方法的具体用法?C++ CColor::ParseString怎么用?C++ CColor::ParseString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CColor
的用法示例。
在下文中一共展示了CColor::ParseString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Xeromyces_ReadColor
// Reads Custom Color
void CGUI::Xeromyces_ReadColor(XMBElement Element, CXeromyces* pFile)
{
// Read the color and stor in m_PreDefinedColors
XMBAttributeList attributes = Element.GetAttributes();
//IGUIObject* object = new CTooltip;
CColor color;
CStr name = attributes.GetNamedItem(pFile->GetAttributeID("name"));
// Try parsing value
CStr value (Element.GetText());
if (! value.empty())
{
// Try setting color to value
if (!color.ParseString(value, 255.f))
{
LOGERROR(L"GUI: Unable to create custom color '%hs'. Invalid color syntax.", name.c_str());
}
else
{
// input color
m_PreDefinedColors[name] = color;
}
}
}
示例2:
bool __ParseString<CColor>(const CStrW& Value, CColor& Output)
{
// First, check our database in g_GUI for pre-defined colors
// If it fails, it won't do anything with Output
if (g_GUI->GetPreDefinedColor(Value.ToUTF8(), Output))
return true;
return Output.ParseString(Value.ToUTF8());
}
示例3: Xeromyces_ReadColor
void CGUI::Xeromyces_ReadColor(XMBElement Element, CXeromyces* pFile)
{
XMBAttributeList attributes = Element.GetAttributes();
CColor color;
CStr name = attributes.GetNamedItem(pFile->GetAttributeID("name"));
// Try parsing value
CStr value(Element.GetText());
if (value.empty())
return;
// Try setting color to value
if (!color.ParseString(value))
{
LOGERROR("GUI: Unable to create custom color '%s'. Invalid color syntax.", name.c_str());
return;
}
m_PreDefinedColors[name] = color;
}
示例4: LoadXml
void CTerrainProperties::LoadXml(XMBElement node, CXeromyces *pFile, const VfsPath& UNUSED(pathname))
{
#define ELMT(x) int elmt_##x = pFile->GetElementID(#x)
#define ATTR(x) int attr_##x = pFile->GetAttributeID(#x)
// Terrain Attribs
ATTR(mmap);
ATTR(groups);
ATTR(movementclass);
ATTR(angle);
ATTR(size);
#undef ELMT
#undef ATTR
XERO_ITER_ATTR(node, attr)
{
if (attr.Name == attr_groups)
{
// Parse a comma-separated list of groups, add the new entry to
// each of them
CParser parser;
CParserLine parserLine;
parser.InputTaskType("GroupList", "<_$value_,>_$value_");
if (!parserLine.ParseString(parser, attr.Value))
continue;
m_Groups.clear();
for (size_t i=0;i<parserLine.GetArgCount();i++)
{
std::string value;
if (!parserLine.GetArgString(i, value))
continue;
CTerrainGroup *pType = g_TexMan.FindGroup(value);
m_Groups.push_back(pType);
}
}
else if (attr.Name == attr_mmap)
{
CColor col;
if (!col.ParseString(attr.Value, 255))
continue;
// m_BaseColor is BGRA
u8 *baseColor = (u8*)&m_BaseColor;
baseColor[0] = (u8)(col.b*255);
baseColor[1] = (u8)(col.g*255);
baseColor[2] = (u8)(col.r*255);
baseColor[3] = (u8)(col.a*255);
m_HasBaseColor = true;
}
else if (attr.Name == attr_angle)
{
m_TextureAngle = DEGTORAD(attr.Value.ToFloat());
}
else if (attr.Name == attr_size)
{
m_TextureSize = attr.Value.ToFloat();
}
else if (attr.Name == attr_movementclass)
{
m_MovementClass = attr.Value;
}
}
}