From f6ed8fc1f51e368bb76905d9f1d2d3735e70a644 Mon Sep 17 00:00:00 2001 From: that Date: Sat, 14 Feb 2015 20:23:16 +0100 Subject: 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 --- gui/animation.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'gui/animation.cpp') diff --git a/gui/animation.cpp b/gui/animation.cpp index 771e1c116..1e9a87d3f 100644 --- a/gui/animation.cpp +++ b/gui/animation.cpp @@ -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) -- cgit v1.2.3