From bc0d22eec611a2b458956d6cf3d0533f7fbbc23e Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 3 Apr 2020 17:25:17 -0700 Subject: [PATCH] Refactor text boxes to not use the 'active' system This removes the variables graphics.ntextbox, as well as removing 'active' from each text box object. Thus, all text boxes are really real, and you don't have to check its 'active' variable. --- desktop_version/src/Graphics.cpp | 60 ++++++++++---------------------- desktop_version/src/Graphics.h | 1 - desktop_version/src/Textbox.cpp | 2 -- desktop_version/src/Textbox.h | 1 - 4 files changed, 18 insertions(+), 46 deletions(-) diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index b166bf68..6d50beba 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -85,10 +85,6 @@ void Graphics::init() menuoffset = 0; resumegamemode = false; - //Textboxes! - textbox.resize(30); - ntextbox = 0; - //Fading stuff fadebars.resize(15); @@ -580,15 +576,17 @@ void Graphics::drawgui() { textboxcleanup(); //Draw all the textboxes to the screen - for (int i = 0; i= 0 && !textbox[i].active) - { - ntextbox--; - i--; - } } void Graphics::textboxcenter() diff --git a/desktop_version/src/Graphics.h b/desktop_version/src/Graphics.h index 799f66e0..ac563b82 100644 --- a/desktop_version/src/Graphics.h +++ b/desktop_version/src/Graphics.h @@ -265,7 +265,6 @@ public: int trinketr, trinketg, trinketb; std::vector textbox; - int ntextbox; bool showcutscenebars; int cutscenebarspos; diff --git a/desktop_version/src/Textbox.cpp b/desktop_version/src/Textbox.cpp index 1da6b910..30861000 100644 --- a/desktop_version/src/Textbox.cpp +++ b/desktop_version/src/Textbox.cpp @@ -23,7 +23,6 @@ void textboxclass::firstcreate() lw = 0; tl = 0; tm = 0; - active = false; timer = 0; } @@ -42,7 +41,6 @@ void textboxclass::clear() lw = 0; tl = 0; tm = 0; - active = true; timer = 0; } diff --git a/desktop_version/src/Textbox.h b/desktop_version/src/Textbox.h index d9ded508..71490f7e 100644 --- a/desktop_version/src/Textbox.h +++ b/desktop_version/src/Textbox.h @@ -41,7 +41,6 @@ public: int r,g,b; int tr,tg,tb; SDL_Rect textrect; - bool active; int timer; float tl;