#include "../BattleState.h"
#include "../../app/Application.h"
#include "../../app/Input.h"
-#include "../../geometry/operators.h"
-#include "../../geometry/Point.h"
+#include "../../geometry/Vector.h"
#include "../../graphics/Font.h"
#include "../../graphics/Frame.h"
using app::Application;
using app::Input;
-using geometry::Point;
using geometry::Vector;
namespace battle {
void RunState::EnterState(Application &c, SDL_Surface *screen) {
ctrl = &c;
- // TODO: push battle animation if enemy is faster
}
void RunState::ExitState(Application &c, SDL_Surface *screen) {
void RunState::HandleEvents(const Input &input) {
if (timer.Finished()) {
+ battle->SetRunaway();
ctrl->PopState(); // pop self
- ctrl->PopState(); // pop battle
}
}
battle->RenderBackground(screen, offset);
battle->RenderMonsters(screen, offset);
battle->RenderHeroes(screen, offset);
- // render small tags
+ battle->RenderSmallHeroTags(screen, offset);
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);
+ battle->Res().titleFrame->Draw(screen, offset, battle->Width(), height);
- Point<int> textPosition(
- (battle->BackgroundWidth() - (std::strlen(battle->Res().escapeText) * battle->Res().titleFont->CharWidth())) / 2,
+ Vector<int> textPosition(
+ (battle->Width() - (std::strlen(battle->Res().escapeText) * battle->Res().titleFont->CharWidth())) / 2,
battle->Res().titleFrame->BorderHeight());
battle->Res().titleFont->DrawString(battle->Res().escapeText, screen, textPosition + offset);
}