Fix skin texture caching

This commit is contained in:
Eduardo Bart 2012-07-14 18:30:00 -03:00
parent 36e5a5a92f
commit ec5106e7ce
4 changed files with 12 additions and 0 deletions

View File

@ -10,6 +10,7 @@ local skinComboBox
local function onSkinComboBoxOptionChange(self, optionText, optionData) local function onSkinComboBoxOptionChange(self, optionText, optionData)
if Skins.setSkin(optionText) then if Skins.setSkin(optionText) then
g_settings.set('skin', optionText) g_settings.set('skin', optionText)
g_textures.clearTexturesCache()
g_modules.reloadModules() g_modules.reloadModules()
end end
end end

View File

@ -50,6 +50,11 @@ void TextureManager::terminate()
m_emptyTexture = nullptr; m_emptyTexture = nullptr;
} }
void TextureManager::clearTexturesCache()
{
m_textures.clear();
}
TexturePtr TextureManager::getTexture(const std::string& fileName) TexturePtr TextureManager::getTexture(const std::string& fileName)
{ {
TexturePtr texture; TexturePtr texture;

View File

@ -31,6 +31,7 @@ public:
void init(); void init();
void terminate(); void terminate();
void clearTexturesCache();
TexturePtr getTexture(const std::string& fileName); TexturePtr getTexture(const std::string& fileName);
const TexturePtr& getEmptyTexture() { return m_emptyTexture; } const TexturePtr& getEmptyTexture() { return m_emptyTexture; }

View File

@ -36,6 +36,7 @@
#include <framework/util/crypt.h> #include <framework/util/crypt.h>
#include <framework/core/resourcemanager.h> #include <framework/core/resourcemanager.h>
#include <framework/graphics/particlemanager.h> #include <framework/graphics/particlemanager.h>
#include <framework/graphics/texturemanager.h>
void Application::registerLuaFunctions() void Application::registerLuaFunctions()
{ {
@ -225,6 +226,10 @@ void Application::registerLuaFunctions()
g_lua.bindSingletonFunction("g_graphics", "getRenderer", &Graphics::getRenderer, &g_graphics); g_lua.bindSingletonFunction("g_graphics", "getRenderer", &Graphics::getRenderer, &g_graphics);
g_lua.bindSingletonFunction("g_graphics", "getVersion", &Graphics::getVersion, &g_graphics); g_lua.bindSingletonFunction("g_graphics", "getVersion", &Graphics::getVersion, &g_graphics);
// Textures
g_lua.registerSingletonClass("g_textures");
g_lua.bindSingletonFunction("g_textures", "clearTexturesCache", &TextureManager::clearTexturesCache, &g_textures);
// UI // UI
g_lua.registerSingletonClass("g_ui"); g_lua.registerSingletonClass("g_ui");
g_lua.bindSingletonFunction("g_ui", "clearStyles", &UIManager::clearStyles, &g_ui); g_lua.bindSingletonFunction("g_ui", "clearStyles", &UIManager::clearStyles, &g_ui);