From c7cc2f4adc08effc34453e22762cf23a99f89981 Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 19 Mar 2021 20:03:08 -0700 Subject: [PATCH] Add createtextboxreal() and createtextboxflipme() createtextboxreal() is the same as createtextbox(), but with a flipme parameter added to create text boxes that have their flipme attribute set to true. createtextbox() just calls createtextboxreal() with flipme set to false, and createtextboxflipme() just calls createtextboxreal() with flipme set to true; this is because I do not want to use C++ function overloading. --- desktop_version/src/Graphics.cpp | 34 ++++++++++++++++++++++++++++++-- desktop_version/src/Graphics.h | 26 +++++++++++++++++++++++- 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 6a2773aa..db9bc54b 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -1282,8 +1282,15 @@ void Graphics::textboxadjust(void) } -void Graphics::createtextbox( std::string t, int xp, int yp, int r, int g, int b) -{ +void Graphics::createtextboxreal( + std::string t, + int xp, + int yp, + int r, + int g, + int b, + bool flipme +) { m = textbox.size(); if(m<20) @@ -1295,11 +1302,34 @@ void Graphics::createtextbox( std::string t, int xp, int yp, int r, int g, int b if (xp == -1) text.xp = 160 - (((length / 2) + 1) * 8); text.yp = yp; text.initcol(r, g, b); + text.flipme = flipme; text.resize(); textbox.push_back(text); } } +void Graphics::createtextbox( + std::string t, + int xp, + int yp, + int r, + int g, + int b +) { + createtextboxreal(t, xp, yp, r, g, b, false); +} + +void Graphics::createtextboxflipme( + std::string t, + int xp, + int yp, + int r, + int g, + int b +) { + createtextboxreal(t, xp, yp, r, g, b, true); +} + void Graphics::drawfade(void) { int usethisamount = lerp(oldfadeamount, fadeamount); diff --git a/desktop_version/src/Graphics.h b/desktop_version/src/Graphics.h index 1f98ad7a..ee901c3f 100644 --- a/desktop_version/src/Graphics.h +++ b/desktop_version/src/Graphics.h @@ -51,7 +51,31 @@ public: void setwarprect(int a, int b, int c, int d); - void createtextbox(std::string t, int xp, int yp, int r, int g, int b); + void createtextboxreal( + std::string t, + int xp, + int yp, + int r, + int g, + int b, + bool flipme + ); + void createtextbox( + std::string t, + int xp, + int yp, + int r, + int g, + int b + ); + void createtextboxflipme( + std::string t, + int xp, + int yp, + int r, + int g, + int b + ); void textboxcenterx(void);