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:
+3
-5
@@ -43,9 +43,7 @@ GUIAnimation::GUIAnimation(xml_node<>* node) : GUIObject(node)
|
||||
child = node->first_node("resource");
|
||||
if (child)
|
||||
{
|
||||
attr = child->first_attribute("name");
|
||||
if (attr)
|
||||
mAnimation = (AnimationResource*) PageManager::FindResource(attr->value());
|
||||
mAnimation = LoadAttrAnimation(child, "name");
|
||||
}
|
||||
|
||||
// Load the placement
|
||||
@@ -77,8 +75,8 @@ GUIAnimation::GUIAnimation(xml_node<>* node) : GUIObject(node)
|
||||
// Fetch the render sizes
|
||||
if (mAnimation && mAnimation->GetResource())
|
||||
{
|
||||
mRenderW = gr_get_width(mAnimation->GetResource());
|
||||
mRenderH = gr_get_height(mAnimation->GetResource());
|
||||
mRenderW = mAnimation->GetWidth();
|
||||
mRenderH = mAnimation->GetHeight();
|
||||
|
||||
// Adjust for placement
|
||||
if (mPlacement != TOP_LEFT && mPlacement != BOTTOM_LEFT)
|
||||
|
||||
Reference in New Issue
Block a user