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
diff --git a/gui/animation.cpp b/gui/animation.cpp
index 771e1c1..1e9a87d 100644
--- a/gui/animation.cpp
+++ b/gui/animation.cpp
@@ -43,9 +43,7 @@
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 @@
// 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)