mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Refactor ITextureSource use in main menu (#16135)
This commit is contained in:
parent
452160cd00
commit
1214a1d4a6
4 changed files with 23 additions and 21 deletions
|
@ -74,6 +74,7 @@ video::ITexture *MenuTextureSource::getTexture(const std::string &name, u32 *id)
|
|||
if (retval)
|
||||
return retval;
|
||||
|
||||
verbosestream << "MenuTextureSource: loading " << name << std::endl;
|
||||
video::IImage *image = m_driver->createImageFromFile(name.c_str());
|
||||
if (!image)
|
||||
return NULL;
|
||||
|
@ -597,26 +598,16 @@ void GUIEngine::drawFooter(video::IVideoDriver *driver)
|
|||
bool GUIEngine::setTexture(texture_layer layer, const std::string &texturepath,
|
||||
bool tile_image, unsigned int minsize)
|
||||
{
|
||||
video::IVideoDriver *driver = m_rendering_engine->get_video_driver();
|
||||
m_textures[layer].texture = nullptr;
|
||||
|
||||
if (m_textures[layer].texture) {
|
||||
driver->removeTexture(m_textures[layer].texture);
|
||||
m_textures[layer].texture = NULL;
|
||||
}
|
||||
|
||||
if (texturepath.empty() || !fs::PathExists(texturepath)) {
|
||||
if (texturepath.empty() || !fs::PathExists(texturepath))
|
||||
return false;
|
||||
}
|
||||
|
||||
m_textures[layer].texture = driver->getTexture(texturepath.c_str());
|
||||
m_textures[layer].texture = m_texture_source->getTexture(texturepath);
|
||||
m_textures[layer].tile = tile_image;
|
||||
m_textures[layer].minsize = minsize;
|
||||
|
||||
if (!m_textures[layer].texture) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return m_textures[layer].texture != nullptr;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue