4 * Created on: Aug 5, 2012
8 #include "BattleState.h"
10 #include "PartyLayout.h"
11 #include "../graphics/Sprite.h"
15 using app::Application;
21 void BattleState::AddMonster(const Monster &m) {
22 if (monsters.size() >= monstersLayout->NumPositions()) {
23 throw std::overflow_error("too many monsters for layout");
25 monsters.push_back(m);
29 void BattleState::EnterState(Application &ctrl, SDL_Surface *screen) {
30 monstersLayout->CalculatePositions(background->w, background->h, monsterPositions);
33 void BattleState::ExitState() {
38 void BattleState::HandleEvent(const SDL_Event &) {
42 void BattleState::UpdateWorld(float deltaT) {
46 void BattleState::Render(SDL_Surface *screen) {
47 // TODO: center background if screen bigger
48 SDL_BlitSurface(background, 0, screen, 0);
49 for (vector<Monster>::size_type i(0), end(monsters.size()); i < end; ++i) {
50 monsters[i].Sprite()->DrawCenterBottom(screen, monsterPositions[i]);