diff options
Diffstat (limited to 'View.cpp')
-rw-r--r-- | View.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -91,7 +91,7 @@ void View::draw_end() { SDL_RenderPresent(this->renderer); } -void View::draw_rect(Rectangle r, Color c) { +void View::fill_rect(Rectangle r, Color c) { SDL_SetRenderDrawColor(this->renderer, c.red, c.green, c.blue, 255); SDL_FRect rect = { .x = static_cast<float>(r.x), @@ -102,6 +102,24 @@ void View::draw_rect(Rectangle r, Color c) { SDL_RenderFillRect(this->renderer, &rect); } +void View::draw_rect(Rectangle r, Color c, unsigned border_width) { + SDL_SetRenderDrawColor(this->renderer, c.red, c.green, c.blue, 255); + SDL_FRect rect; + rect.x = r.x; + rect.y = r.y; + rect.w = r.width; + rect.h = border_width; + SDL_RenderFillRect(this->renderer, &rect); + rect.y = r.y + r.height - border_width; + SDL_RenderFillRect(this->renderer, &rect); + rect.y = r.y; + rect.h = r.height; + rect.w = border_width; + SDL_RenderFillRect(this->renderer, &rect); + rect.x = r.x + r.width - border_width; + SDL_RenderFillRect(this->renderer, &rect); +} + typedef struct { void (* callback)(std::vector<std::string> files, void* data); void * data; |