#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;
void RunState::HandleEvents(const Input &input) {
if (timer.Finished()) {
+ battle->SetRunaway();
ctrl->PopState(); // pop self
- ctrl->PopState(); // pop battle
}
}
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);
}
}