Added an accessor for the button's image

This commit is contained in:
2016-05-07 16:07:28 +10:00
parent 2cf1c5e5f0
commit 5a6e023061
2 changed files with 7 additions and 1 deletions
+5 -1
View File
@@ -42,7 +42,7 @@ void Button::SetBackgroundTexture(SDL_Renderer* renderer, SDL_Texture* texture)
//get the w & h, & create
int w = 0, h = 0;
SDL_QueryTexture(texture, nullptr, nullptr, &w, &h);
image.Create(renderer, w, h);
image.Create(renderer, w, h, {0, 0, 0, 0});
//copy
SDL_SetRenderTarget(renderer, image.GetTexture());
@@ -156,6 +156,10 @@ int Button::GetY() const {
return posY;
}
Image* Button::GetImage() {
return ℑ
}
bool Button::CheckBounds(int x, int y) {
//return if true (x, y) is within bounds, otherwise return false
return !(
+2
View File
@@ -58,6 +58,8 @@ public:
int GetX() const;
int GetY() const;
Image* GetImage();
protected:
bool CheckBounds(int x, int y);