-/*
- * HeroStatus.cpp
- *
- * Created on: Oct 21, 2012
- * Author: holy
- */
-
#include "HeroStatus.h"
#include "Resources.h"
#include "../graphics/Font.h"
#include "../graphics/Sprite.h"
-using geometry::Vector;
+using math::Vector;
namespace menu {
HeroStatus::HeroStatus()
: res(0)
+, party(0)
, hero(0) {
}
int HeroStatus::Width() const {
- return hero->BattleSprite()->Width() + res->normalFont->CharWidth() * 10;
+ return party[hero]->BattleSprite()->Width() + res->statusFont->CharWidth() * 11;
}
int HeroStatus::Height() const {
- return hero->BattleSprite()->Height();
+ return party[hero]->BattleSprite()->Height() + res->statusFont->CharWidth();
}
void HeroStatus::Render(SDL_Surface *screen, const Vector<int> &offset) const {
- if (!hero) return;
+ if (!party) return;
- hero->BattleSprite()->Draw(screen, position + offset, 0, 0);
+ party[hero]->BattleSprite()->Draw(screen, offset, 0, 0);
// for some reason, fonts are shifted by one pixel in the original
Vector<int> nameOffset(
- hero->BattleSprite()->Width(),
- res->normalFont->CharHeight() * 7 / 8);
- nameOffset += position + offset;
- res->normalFont->DrawString(hero->Name(), screen, nameOffset, 5);
+ party[hero]->BattleSprite()->Width(),
+ res->statusFont->CharHeight() * 7 / 8);
+ nameOffset += offset;
+ res->statusFont->DrawString(party[hero]->Name(), screen, nameOffset, 5);
- Vector<int> levelLabelOffset(nameOffset.X() + 6 * res->normalFont->CharWidth(), nameOffset.Y());
+ Vector<int> levelLabelOffset(nameOffset.X() + 6 * res->statusFont->CharWidth(), nameOffset.Y());
res->statusLabels->Draw(screen, levelLabelOffset, 0, 0);
- Vector<int> levelOffset(levelLabelOffset.X() + 2 * res->normalFont->CharWidth(), levelLabelOffset.Y());
- res->normalFont->DrawNumber(hero->Level(), screen, levelOffset, 2);
+ Vector<int> levelOffset(levelLabelOffset.X() + 2 * res->statusFont->CharWidth(), levelLabelOffset.Y());
+ res->statusFont->DrawNumber(party[hero]->Level(), screen, levelOffset, 2);
- Vector<int> healthLabelOffset(nameOffset.X(), nameOffset.Y() + res->normalFont->CharHeight());
+ Vector<int> healthLabelOffset(nameOffset.X(), nameOffset.Y() + res->statusFont->CharHeight());
res->statusLabels->Draw(screen, healthLabelOffset, 0, 1);
- Vector<int> healthOffset(nameOffset.X() + 3 * res->normalFont->CharWidth(), nameOffset.Y() + res->normalFont->CharHeight());
- res->normalFont->DrawNumber(hero->Health(), screen, healthOffset, 3);
+ Vector<int> healthOffset(nameOffset.X() + 3 * res->statusFont->CharWidth(), nameOffset.Y() + res->statusFont->CharHeight());
+ res->statusFont->DrawNumber(party[hero]->Health(), screen, healthOffset, 3);
- Vector<int> healthSeparatorOffset(healthOffset.X() + 3 * res->normalFont->CharWidth(), healthOffset.Y());
- res->normalFont->DrawChar('/', screen, healthSeparatorOffset);
+ Vector<int> healthSeparatorOffset(healthOffset.X() + 3 * res->statusFont->CharWidth(), healthOffset.Y());
+ res->statusFont->DrawChar('/', screen, healthSeparatorOffset);
- Vector<int> maxHealthOffset(healthSeparatorOffset.X() + res->normalFont->CharWidth(), healthOffset.Y());
- res->normalFont->DrawNumber(hero->MaxHealth(), screen, maxHealthOffset, 3);
+ Vector<int> maxHealthOffset(healthSeparatorOffset.X() + res->statusFont->CharWidth(), healthOffset.Y());
+ res->statusFont->DrawNumber(party[hero]->MaxHealth(), screen, maxHealthOffset, 3);
- Vector<int> manaLabelOffset(healthLabelOffset.X(), healthLabelOffset.Y() + res->normalFont->CharHeight());
+ Vector<int> manaLabelOffset(healthLabelOffset.X(), healthLabelOffset.Y() + res->statusFont->CharHeight());
res->statusLabels->Draw(screen, manaLabelOffset, 0, 2);
- Vector<int> manaOffset(healthOffset.X(), healthOffset.Y() + res->normalFont->CharHeight());
- res->normalFont->DrawNumber(hero->Mana(), screen, manaOffset, 3);
+ Vector<int> manaOffset(healthOffset.X(), healthOffset.Y() + res->statusFont->CharHeight());
+ res->statusFont->DrawNumber(party[hero]->Mana(), screen, manaOffset, 3);
Vector<int> manaSeparatorOffset(healthSeparatorOffset.X(), manaOffset.Y());
- res->normalFont->DrawChar('/', screen, manaSeparatorOffset);
+ res->statusFont->DrawChar('/', screen, manaSeparatorOffset);
Vector<int> maxManaOffset(maxHealthOffset.X(), manaOffset.Y());
- res->normalFont->DrawNumber(hero->MaxMana(), screen, maxManaOffset, 3);
+ res->statusFont->DrawNumber(party[hero]->MaxMana(), screen, maxManaOffset, 3);
}
}