heroesLayout->CalculatePositions(background->w, background->h, heroesPositions);
attackChoices.resize(heroes.size());
for (vector<Hero>::size_type i(0), end(heroes.size()); i < end; ++i) {
- heroTags.push_back(HeroTag(&heroes[i], &attackChoices[i], heroTagFrame, activeHeroTagFrame, healthGauge, manaGauge, ikariGauge, HeroTag::Alignment((i + 1) % 2)));
+ heroTags.push_back(HeroTag(&heroes[i], &attackChoices[i], heroTagFrame, activeHeroTagFrame, healthGauge, manaGauge, ikariGauge, heroTagSprites, HeroTag::Alignment((i + 1) % 2)));
}
}
: public app::State {
public:
- BattleState(SDL_Surface *background, const PartyLayout &monstersLayout, const PartyLayout &heroesLayout, const graphics::Sprite *attackIcons, const graphics::Sprite *moveIcons, const graphics::Frame *heroTagFrame, const graphics::Frame *activeHeroTagFrame, const graphics::Gauge *healthGauge, const graphics::Gauge *manaGauge, const graphics::Gauge *ikariGauge)
+ BattleState(SDL_Surface *background, const PartyLayout &monstersLayout, const PartyLayout &heroesLayout, const graphics::Sprite *attackIcons, const graphics::Sprite *moveIcons, const graphics::Frame *heroTagFrame, const graphics::Frame *activeHeroTagFrame, const graphics::Gauge *healthGauge, const graphics::Gauge *manaGauge, const graphics::Gauge *ikariGauge, const graphics::Sprite *heroTagSprites)
: background(background)
, monstersLayout(&monstersLayout)
, heroesLayout(&heroesLayout)
, healthGauge(healthGauge)
, manaGauge(manaGauge)
, ikariGauge(ikariGauge)
+ , heroTagSprites(heroTagSprites)
, attackTypeMenu(attackIcons)
, moveMenu(moveIcons)
, activeHero(-1) { }
const graphics::Gauge *healthGauge;
const graphics::Gauge *manaGauge;
const graphics::Gauge *ikariGauge;
+ const graphics::Sprite *heroTagSprites;
AttackTypeMenu attackTypeMenu;
MoveMenu moveMenu;
std::vector<geometry::Point<int> > monsterPositions;
Vector<int> ikariGaugeOffset(gaugeX, 4 * frameOffset.Y());
ikariGauge->Draw(screen, position + ikariGaugeOffset, gaugeWidth, hero->RelativeIP(gaugeWidth));
+ // labels
+ int labelX((align == LEFT ? 5 : 1) * frameOffset.X());
+ // level
+ Vector<int> levelLabelOffset(gaugeX, frameOffset.Y());
+ sprites->Draw(screen, position + levelLabelOffset, 0, 0);
+ // hp
+ Vector<int> healthLabelOffset(labelX, 2 * frameOffset.Y());
+ sprites->Draw(screen, position + healthLabelOffset, 0, 1);
+ // mp
+ Vector<int> manaLabelOffset(labelX, 3 * frameOffset.Y());
+ sprites->Draw(screen, position + manaLabelOffset, 0, 2);
+ // cm
+ Vector<int> moveLabelOffset(labelX, 4 * frameOffset.Y());
+ sprites->Draw(screen, position + moveLabelOffset, 0, 3);
+ // ip
+ Vector<int> ikariLabelOffset(labelX + 3 * frameOffset.X(), 4 * frameOffset.Y());
+ sprites->Draw(screen, position + ikariLabelOffset, 0, 4);
+
// hero
Vector<int> heroOffset(
(align == LEFT) ? yOffset : width - hero->Sprite()->Width() - yOffset,
namespace graphics {
class Frame;
class Gauge;
+ class Sprite;
}
namespace battle {
};
public:
- HeroTag(const Hero *hero, const AttackChoice *choice, const graphics::Frame *frame, const graphics::Frame *activeFrame, const graphics::Gauge *healthGauge, const graphics::Gauge *manaGauge, const graphics::Gauge *ikariGauge, Alignment align)
- : hero(hero), choice(choice), frame(frame), activeFrame(activeFrame), healthGauge(healthGauge), manaGauge(manaGauge), ikariGauge(ikariGauge), align(align) { }
+ HeroTag(const Hero *hero, const AttackChoice *choice, const graphics::Frame *frame, const graphics::Frame *activeFrame, const graphics::Gauge *healthGauge, const graphics::Gauge *manaGauge, const graphics::Gauge *ikariGauge, const graphics::Sprite *sprites, Alignment align)
+ : hero(hero), choice(choice), frame(frame), activeFrame(activeFrame), healthGauge(healthGauge), manaGauge(manaGauge), ikariGauge(ikariGauge), sprites(sprites), align(align) { }
~HeroTag() { }
public:
const graphics::Gauge *healthGauge;
const graphics::Gauge *manaGauge;
const graphics::Gauge *ikariGauge;
+ const graphics::Sprite *sprites;
Alignment align;
};
Sprite attackIconsSprite(attackIcons, 32, 32);
SDL_Surface *moveIcons(IMG_Load("test-data/move-icons.png"));
Sprite moveIconsSprite(moveIcons, 32, 32);
+ SDL_Surface *heroTagSprites(IMG_Load("test-data/hero-tag-sprites.png"));
+ Sprite heroTagSprite(heroTagSprites, 32, 16);
SDL_Surface *tagFrames(IMG_Load("test-data/tag-frames.png"));
Frame heroTagFrame(tagFrames, 16, 16, 1, 1, 0, 33);
Frame activeHeroTagFrame(tagFrames, 16, 16);
Gauge manaGauge(gauges, 0, 32, 0, 0, 16, 6, 1, 6);
Gauge ikariGauge(gauges, 0, 48, 0, 0, 16, 6, 1, 6);
- BattleState *battleState(new BattleState(bg, monstersLayout, heroesLayout, &attackIconsSprite, &moveIconsSprite, &heroTagFrame, &activeHeroTagFrame, &healthGauge, &manaGauge, &ikariGauge));
+ BattleState *battleState(new BattleState(bg, monstersLayout, heroesLayout, &attackIconsSprite, &moveIconsSprite, &heroTagFrame, &activeHeroTagFrame, &healthGauge, &manaGauge, &ikariGauge, &heroTagSprite));
battleState->AddMonster(monster);
battleState->AddMonster(monster);
battleState->AddMonster(monster);