diff --git a/src/image.cpp b/src/image.cpp index a238307009d4..790adf496e7c 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -31,6 +31,7 @@ #include "gettext.hpp" #include "sdl/rect.hpp" #include "serialization/string_utils.hpp" +#include "video.hpp" #include "SDL_image.h" @@ -615,6 +616,15 @@ surface load_from_disk(const locator &loc) } } +sdl::ttexture load_texture(const locator &loc, const int access) +{ + surface img = load_from_disk(loc); + if (!img.null()) { + return CVideo::get_window()->create_texture(access, img); + } else { + return sdl::ttexture(); + } +} manager::manager() {} diff --git a/src/image.hpp b/src/image.hpp index 7f8890c8686f..52833d4430af 100644 --- a/src/image.hpp +++ b/src/image.hpp @@ -17,6 +17,7 @@ #include "map_location.hpp" #include "sdl/utils.hpp" +#include "sdl/texture.hpp" #include "terrain_translation.hpp" #include "game_config.hpp" @@ -125,6 +126,9 @@ namespace image { surface load_from_disk(const locator &loc); + sdl::ttexture load_texture(const locator &loc, + const int access = SDL_TEXTUREACCESS_STATIC); + size_t hash_value(const locator::value&);