diff --git a/SDL2pp/Texture.cc b/SDL2pp/Texture.cc index 697eac3..85923be 100644 --- a/SDL2pp/Texture.cc +++ b/SDL2pp/Texture.cc @@ -98,4 +98,32 @@ Texture::LockHandle Texture::Lock(const Rect& rect) { return LockHandle(this, rect); } +Uint32 Texture::GetFormat() const { + Uint32 format; + if (SDL_QueryTexture(texture_, &format, nullptr, nullptr, nullptr) != 0) + throw Exception("SDL_QueryTexture failed"); + return format; +} + +int Texture::GetAccess() const { + int access; + if (SDL_QueryTexture(texture_, nullptr, &access, nullptr, nullptr) != 0) + throw Exception("SDL_QueryTexture failed"); + return access; +} + +int Texture::GetWidth() const { + int w; + if (SDL_QueryTexture(texture_, nullptr, nullptr, &w, nullptr) != 0) + throw Exception("SDL_QueryTexture failed"); + return w; +} + +int Texture::GetHeight() const { + int h; + if (SDL_QueryTexture(texture_, nullptr, nullptr, nullptr, &h) != 0) + throw Exception("SDL_QueryTexture failed"); + return h; +} + } diff --git a/SDL2pp/Texture.hh b/SDL2pp/Texture.hh index 631fa57..bb5eeac 100644 --- a/SDL2pp/Texture.hh +++ b/SDL2pp/Texture.hh @@ -87,6 +87,11 @@ public: void SetColorMod(Uint8 r = 255, Uint8 g = 255, Uint8 b = 255); LockHandle Lock(const Rect& rect); + + Uint32 GetFormat() const; + int GetAccess() const; + int GetWidth() const; + int GetHeight() const; }; }