aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2016-05-17 08:44:01 -0400
committerClyne Sullivan <tullivan99@gmail.com>2016-05-17 08:44:01 -0400
commit04369f067b8ab5b674a55467cc4dad98a9359273 (patch)
tree3446ca7a729a4f59f92fa9a7675ae9fe217ce945 /src/ui.cpp
parent3c51eb91645fb9ab6e6cbe49b354408a6e77d1d1 (diff)
better mob combat stuff
Diffstat (limited to 'src/ui.cpp')
-rw-r--r--src/ui.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/ui.cpp b/src/ui.cpp
index a5bc2d7..f9c52bc 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -58,6 +58,8 @@ static unsigned char fontColor[4] = {255,255,255,255};
* Variables for dialog boxes / options.
*/
+static std::vector<std::pair<vec2, std::string>> textToDraw;
+
static std::vector<std::pair<std::string,vec3>> dialogOptText;
static std::string dialogBoxText;
static std::vector<vec3> merchArrowLoc (2, vec3 { 0, 0, 0 });
@@ -511,6 +513,18 @@ namespace ui {
return putString(x, y, buf.get());
}
+ void putTextL(vec2 c, const char *str, ...) {
+ va_list args;
+ std::unique_ptr<char[]> buf (new char[512]);
+ memset(buf.get(), 0, 512 * sizeof(char));
+
+ va_start(args, str);
+ vsnprintf(buf.get(), 512, str, args);
+ va_end(args);
+
+ textToDraw.push_back(std::make_pair(c, buf.get()));
+ }
+
void dialogBox(std::string name, std::string opt, bool passive, std::string text, ...) {
va_list dialogArgs;
std::unique_ptr<char[]> printfbuf (new char[512]);
@@ -940,7 +954,11 @@ namespace ui {
Mix_PlayChannel(1, dialogClick, 0);
}
+ } else {
+ for (const auto &s : textToDraw)
+ putString(s.first.x, s.first.y, s.second);
}
+
if (!fadeIntensity) {
vec2 hub = {
(SCREEN_WIDTH/2+offset.x)-fontSize*10,
@@ -1154,7 +1172,9 @@ EXIT:
if ((action::make = e.button.button & SDL_BUTTON_RIGHT))
/*player->inv->invHover =*/ edown = false;
- if (dialogBoxExists || pageTexReady) {
+ textToDraw.clear();
+
+ if (dialogBoxExists || pageTexReady) {
// right click advances dialog
if ((e.button.button & SDL_BUTTON_RIGHT))
dialogAdvance();