mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-04 03:15:59 -04:00
parent
69d93bc6e4
commit
ad1e6879df
@ -46,11 +46,13 @@ Texture::Texture(Renderer& renderer, Uint32 format, int access, int w, int h) {
|
|||||||
|
|
||||||
#ifdef SDL2PP_WITH_IMAGE
|
#ifdef SDL2PP_WITH_IMAGE
|
||||||
Texture::Texture(Renderer& renderer, RWops& rwops) {
|
Texture::Texture(Renderer& renderer, RWops& rwops) {
|
||||||
texture_ = IMG_LoadTexture_RW(renderer.Get(), rwops.Get(), 0);
|
if ((texture_ = IMG_LoadTexture_RW(renderer.Get(), rwops.Get(), 0)) == nullptr)
|
||||||
|
throw Exception("IMG_LoadTexture_RW failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture::Texture(Renderer& renderer, const std::string& path) {
|
Texture::Texture(Renderer& renderer, const std::string& path) {
|
||||||
texture_ = IMG_LoadTexture(renderer.Get(), path.c_str());
|
if ((texture_ = IMG_LoadTexture(renderer.Get(), path.c_str())) == nullptr)
|
||||||
|
throw Exception("IMG_LoadTexture failed");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -194,6 +194,8 @@ public:
|
|||||||
/// \param renderer Rendering context to create texture for
|
/// \param renderer Rendering context to create texture for
|
||||||
/// \param rwops RWops used to access an image file
|
/// \param rwops RWops used to access an image file
|
||||||
///
|
///
|
||||||
|
/// \throws SDL2pp::Exception
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Texture(Renderer& renderer, RWops& rwops);
|
Texture(Renderer& renderer, RWops& rwops);
|
||||||
|
|
||||||
@ -203,6 +205,8 @@ public:
|
|||||||
/// \param renderer Rendering context to create texture for
|
/// \param renderer Rendering context to create texture for
|
||||||
/// \param filename Path to an image file
|
/// \param filename Path to an image file
|
||||||
///
|
///
|
||||||
|
/// \throws SDL2pp::Exception
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Texture(Renderer& renderer, const std::string& filename);
|
Texture(Renderer& renderer, const std::string& filename);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user