mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-04 03:15:59 -04:00
Implement texture property getters
This commit is contained in:
parent
f5fa211cfe
commit
a97d100372
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user