using app::Application;
using app::Input;
+using graphics::Font;
+using graphics::Frame;
using math::Vector;
+using std::strlen;
namespace battle {
void RunState::OnResize(int width, int height) {
+ const Resources &res = battle->Res();
+ const Frame &frame = *res.titleFrame;
+ const Font &font = *res.titleFont;
+
framePosition = battle->ScreenOffset();
frameSize = Vector<int> (
battle->Width(),
- battle->Res().titleFrame->BorderHeight() * 2 + battle->Res().titleFont->CharHeight());
+ frame.BorderHeight() * 2 + font.CharHeight());
textPosition = Vector<int>(
- (battle->Width() - std::strlen(battle->Res().escapeText) * battle->Res().titleFont->CharWidth()) / 2,
- battle->Res().titleFrame->BorderHeight());
+ (battle->Width() - strlen(res.escapeText) * font.CharWidth()) / 2,
+ frame.BorderHeight());
}
}
void RunState::RenderTitleBar(SDL_Surface *screen) {
-const Resources &res = battle->Res();
+ const Resources &res = battle->Res();
res.titleFrame->Draw(screen, framePosition, frameSize.X(), frameSize.Y());
res.titleFont->DrawString(res.escapeText, screen, textPosition);
}
public:
explicit RunState(BattleState *battle)
- : battle(battle){ }
+ : battle(battle) { }
public:
-
virtual void HandleEvents(const app::Input &);
virtual void UpdateWorld(Uint32 deltaT);
virtual void Render(SDL_Surface *);