From 13e810df0a3b67e6bc2d7ff88263199254fa28c5 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Tue, 18 Oct 2016 14:32:26 +1100 Subject: [PATCH] Added a container accessor --- text_box.cpp | 6 +++++- text_box.hpp | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/text_box.cpp b/text_box.cpp index f597d73..7c505cf 100644 --- a/text_box.cpp +++ b/text_box.cpp @@ -45,7 +45,7 @@ void TextBox::PushLine(SDL_Renderer* renderer, TTF_Font* font, SDL_Color color, lineList.emplace_back(renderer, font, color, str, 0, 0); } -void TextBox::PopLine(int num) { +void TextBox::PopLines(int num) { //prevent underflow num < lineList.size() ? num : lineList.size(); @@ -73,3 +73,7 @@ int TextBox::GetX() const { int TextBox::GetY() const { return posY; } + +std::list* TextBox::GetContainer() { + return &lineList; +} \ No newline at end of file diff --git a/text_box.hpp b/text_box.hpp index 0e96bc8..b6b2023 100644 --- a/text_box.hpp +++ b/text_box.hpp @@ -37,7 +37,7 @@ public: void DrawTo(SDL_Renderer*); void PushLine(SDL_Renderer*, TTF_Font*, SDL_Color color, std::string); - void PopLine(int num = 1); + void PopLines(int num = 1); void ClearLines(); int SetX(int i); @@ -45,6 +45,8 @@ public: int GetX() const; int GetY() const; + std::list* GetContainer(); + private: std::list lineList; int posX = 0, posY = 0;