Skip to content

Commit

Permalink
Guard occurences of ttexture with an #if.
Browse files Browse the repository at this point in the history
  • Loading branch information
lipk committed Jun 11, 2014
1 parent c88b64b commit 42bb737
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/image.cpp
Expand Up @@ -620,6 +620,7 @@ surface load_from_disk(const locator &loc)
}
}

#if SDL_VERSION_ATLEAST(2,0,0)
sdl::ttexture load_texture(const locator &loc, const int access)
{
surface img = load_from_disk(loc);
Expand All @@ -629,6 +630,7 @@ sdl::ttexture load_texture(const locator &loc, const int access)
return sdl::ttexture();
}
}
#endif

manager::manager() {}

Expand Down Expand Up @@ -897,6 +899,7 @@ surface get_image(const image::locator& i_locator, TYPE type)
return res;
}

#if SDL_VERSION_ATLEAST(2,0,0)
sdl::ttexture get_texture(const locator& loc, TYPE type)
{
if (loc.is_void()) {
Expand Down Expand Up @@ -942,6 +945,7 @@ sdl::ttexture get_texture(const locator& loc, TYPE type)

return result;
}
#endif

surface get_lighted_image(const image::locator& i_locator, const light_string& ls, TYPE type)
{
Expand Down
7 changes: 6 additions & 1 deletion src/image.hpp
Expand Up @@ -126,14 +126,18 @@ namespace image {

surface load_from_disk(const locator &loc);

#if SDL_VERSION_ATLEAST(2,0,0)
sdl::ttexture load_texture(const locator &loc,
const int access = SDL_TEXTUREACCESS_STATIC);
#endif

size_t hash_value(const locator::value&);


typedef cache_type<surface> image_cache;
#if SDL_VERSION_ATLEAST(2,0,0)
typedef cache_type<sdl::ttexture> texture_cache;
#endif
typedef cache_type<bool> bool_cache;

typedef std::map<t_translation::t_terrain, surface> mini_terrain_cache_map;
Expand Down Expand Up @@ -206,8 +210,9 @@ namespace image {
///note that this surface must be freed by the user by calling
///SDL_FreeSurface()
surface get_image(const locator& i_locator, TYPE type=UNSCALED);

#if SDL_VERSION_ATLEAST(2,0,0)
sdl::ttexture get_texture(const locator& loc, TYPE type=UNSCALED);
#endif

///function to get the surface corresponding to an image.
///after applying the lightmap encoded in ls
Expand Down

0 comments on commit 42bb737

Please sign in to comment.