int gaugeWidth(width - gaugeX - (align == LEFT ? 1 : 5) * frameOffset.X());
// health gauge, second line
Vector<int> healthGaugeOffset(gaugeX, 2 * frameOffset.Y());
- healthGauge->Draw(screen, position + healthGaugeOffset, gaugeWidth, hero->RelativeHealth(256));
+ healthGauge->Draw(screen, position + healthGaugeOffset, gaugeWidth, hero->RelativeHealth(gaugeWidth));
// mana gauge, third line
Vector<int> manaGaugeOffset(gaugeX, 3 * frameOffset.Y());
- manaGauge->Draw(screen, position + manaGaugeOffset, gaugeWidth, hero->RelativeMana(256));
+ manaGauge->Draw(screen, position + manaGaugeOffset, gaugeWidth, hero->RelativeMana(gaugeWidth));
// ikari gauge, fourth line
Vector<int> ikariGaugeOffset(gaugeX, 4 * frameOffset.Y());
- ikariGauge->Draw(screen, position + ikariGaugeOffset, gaugeWidth, hero->RelativeIP(256));
+ ikariGauge->Draw(screen, position + ikariGaugeOffset, gaugeWidth, hero->RelativeIP(gaugeWidth));
// hero
Vector<int> heroOffset(
namespace graphics {
// TODO: add start and end "ignore" offsets
-void Gauge::Draw(SDL_Surface *dest, Point<int> position, int width, Uint8 level) const {
- int fullWidth(width * level / 255);
+void Gauge::Draw(SDL_Surface *dest, Point<int> position, int width, int fullWidth) const {
SDL_Rect srcRect, destRect;
// start
public:
int MinWidth() const { return startWidth + endWidth; }
int Height() const { return height; }
- void Draw(SDL_Surface *dest, geometry::Point<int> position, int width, Uint8 level) const;
+ void Draw(SDL_Surface *dest, geometry::Point<int> position, int width, int filled) const;
private:
SDL_Surface *surface;
// temporary test data
SDL_Surface *bg(IMG_Load("test-data/battle-bg.png"));
PartyLayout monstersLayout;
- monstersLayout.AddPosition(Point<Uint8>(50, 100));
- monstersLayout.AddPosition(Point<Uint8>(100, 108));
- monstersLayout.AddPosition(Point<Uint8>(150, 100));
- monstersLayout.AddPosition(Point<Uint8>(200, 108));
+ monstersLayout.AddPosition(Point<Uint8>(104, 109));
+ monstersLayout.AddPosition(Point<Uint8>(140, 118));
+ monstersLayout.AddPosition(Point<Uint8>(176, 109));
+ monstersLayout.AddPosition(Point<Uint8>(212, 118));
PartyLayout heroesLayout;
heroesLayout.AddPosition(Point<Uint8>(27, 219));
heroesLayout.AddPosition(Point<Uint8>(104, 227));
heroesLayout.AddPosition(Point<Uint8>(143, 246));
SDL_Surface *monsterImg(IMG_Load("test-data/monster.png"));
- Sprite dummySprite(monsterImg, 96, 96);
+ Sprite dummySprite(monsterImg, 64, 64);
Monster monster;
monster.SetSprite(&dummySprite);
hero.SetMaxHealth(100);
hero.SetHealth(50);
hero.SetMaxMana(100);
- hero.SetMana(0);
+ hero.SetMana(100);
hero.SetIP(255);
SDL_Surface *attackIcons(IMG_Load("test-data/attack-type-icons.png"));