gui: make resources type safe
- add string, int, color and resource loading helpers - use typed resource classes, and some cleanup in loading code - remove abstract GetResource() to enforce type safe access - add height and width query methods to resources and use them - minor cleanup - simplify LoadPlacement Change-Id: I9b81785109a80b3806ad6b50cba4d893b87b0db1
This commit is contained in:
+5
-12
@@ -58,19 +58,12 @@ void MouseCursor::LoadData(xml_node<>* node)
|
||||
child = node->first_node("background");
|
||||
if(child)
|
||||
{
|
||||
attr = child->first_attribute("color");
|
||||
if(attr)
|
||||
ConvertStrToColor(attr->value(), &m_color);
|
||||
|
||||
attr = child->first_attribute("resource");
|
||||
if(attr)
|
||||
m_color = LoadAttrColor(child, "color", m_color);
|
||||
m_image = LoadAttrImage(child, "resource");
|
||||
if(m_image)
|
||||
{
|
||||
m_image = PageManager::FindResource(attr->value());
|
||||
if(m_image)
|
||||
{
|
||||
mRenderW = gr_get_width(m_image->GetResource());
|
||||
mRenderH = gr_get_height(m_image->GetResource());
|
||||
}
|
||||
mRenderW = m_image->GetWidth();
|
||||
mRenderH = m_image->GetHeight();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user