Added an accessor for the button's image
This commit is contained in:
+5
-1
@@ -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 !(
|
||||
|
||||
@@ -58,6 +58,8 @@ public:
|
||||
int GetX() const;
|
||||
int GetY() const;
|
||||
|
||||
Image* GetImage();
|
||||
|
||||
protected:
|
||||
bool CheckBounds(int x, int y);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user