From 5a6e023061695fecfbc4611f2e7eb6e127ca4faf Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Sat, 7 May 2016 16:07:28 +1000 Subject: [PATCH] Added an accessor for the button's image --- button.cpp | 6 +++++- button.hpp | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/button.cpp b/button.cpp index d58fed8..189c6ef 100644 --- a/button.cpp +++ b/button.cpp @@ -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 !( diff --git a/button.hpp b/button.hpp index fe6c707..76325f9 100644 --- a/button.hpp +++ b/button.hpp @@ -58,6 +58,8 @@ public: int GetX() const; int GetY() const; + Image* GetImage(); + protected: bool CheckBounds(int x, int y);