From da05d9dd98315378bdded216184294f376643191 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 22 Aug 2015 14:14:34 +0300 Subject: Use resource manager as global variable. --- src/gui/theme.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/gui/theme.cpp') diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 000994368..90c351476 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -347,8 +347,7 @@ struct SkinHelper final height(), rect(), node(), - image(), - resman() + image() { } @@ -362,7 +361,6 @@ struct SkinHelper final ImageRect *rect; XmlNodePtr *node; Image *image; - ResourceManager *resman; bool loadList(const SkinParameter *const params, const size_t size) A_NONNULL(2) @@ -372,7 +370,7 @@ struct SkinHelper final const SkinParameter ¶m = params[f]; if (partType == param.name) { - rect->grid[param.index] = resman->getSubImage( + rect->grid[param.index] = resourceManager->getSubImage( image, xPos, yPos, width, height); return true; } @@ -430,7 +428,6 @@ Skin *Theme::readSkin(const std::string &filename, const bool full) if (widgetType == "Window") { SkinHelper helper; - helper.resman = ResourceManager::getInstance(); const int globalXPos = XML::getProperty(widgetNode, "xpos", 0); const int globalYPos = XML::getProperty(widgetNode, "ypos", 0); for_each_xml_child_node(partNode, widgetNode) @@ -635,15 +632,13 @@ std::string Theme::resolveThemePath(const std::string &path) Image *Theme::getImageFromTheme(const std::string &path) { - ResourceManager *const resman = ResourceManager::getInstance(); - return resman->getImage(resolveThemePath(path)); + return resourceManager->getImage(resolveThemePath(path)); } ImageSet *Theme::getImageSetFromTheme(const std::string &path, const int w, const int h) { - ResourceManager *const resman = ResourceManager::getInstance(); - return resman->getImageSet(resolveThemePath(path), w, h); + return resourceManager->getImageSet(resolveThemePath(path), w, h); } static int readColorType(const std::string &type) @@ -1143,8 +1138,8 @@ ImageSet *Theme::getImageSetFromThemeXml(const std::string &name, const SDL_Rect &rect2 = image->mBounds; if (rect2.w && rect2.h) { - ResourceManager *const resman = ResourceManager::getInstance(); - ImageSet *const imageSet = resman->getSubImageSet(image, w, h); + ImageSet *const imageSet = resourceManager->getSubImageSet( + image, w, h); theme->unload(skin); return imageSet; } -- cgit v1.2.3-70-g09d2