]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/states/RunState.cpp
added escape title frame, text, and font
[l2e.git] / src / battle / states / RunState.cpp
index 08c45e80cd8fb97f1a35f9cbc88783204da4a4a8..7fdc0665c82b6bd09bc64fa2c31d033ae728ad8c 100644 (file)
 #include "../../app/Input.h"
 #include "../../geometry/operators.h"
 #include "../../geometry/Point.h"
+#include "../../graphics/Font.h"
+#include "../../graphics/Frame.h"
+
+#include <cstring>
 
 using app::Application;
 using app::Input;
@@ -61,6 +65,17 @@ void RunState::Render(SDL_Surface *screen) {
        battle->RenderMonsters(screen, offset);
        battle->RenderHeroes(screen, offset);
        // render small tags
+       RenderTitleBar(screen, offset);
+}
+
+void RunState::RenderTitleBar(SDL_Surface *screen, const Vector<int> &offset) {
+       int height(battle->Res().titleFrame->BorderHeight() * 2 + battle->Res().titleFont->CharHeight());
+       battle->Res().titleFrame->Draw(screen, Point<int>(offset.X(), offset.Y()), battle->BackgroundWidth(), height);
+
+       Point<int> textPosition(
+                       (battle->BackgroundWidth() - (std::strlen(battle->Res().escapeText) * battle->Res().titleFont->CharWidth())) / 2,
+                       battle->Res().titleFrame->BorderHeight());
+       battle->Res().titleFont->DrawString(battle->Res().escapeText, screen, textPosition + offset);
 }
 
 }