]> git.localhorst.tv Git - l2e.git/blobdiff - src/main.cpp
added Hero class for battle state
[l2e.git] / src / main.cpp
index b2904b5c6c3edfee8467e3242b1515d3d65ee74d..3ec99459014e6687127018e181b84b2c9b2bbea6 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "app/Application.h"
 #include "battle/BattleState.h"
+#include "battle/Hero.h"
 #include "battle/Monster.h"
 #include "battle/PartyLayout.h"
 #include "geometry/Point.h"
@@ -19,6 +20,7 @@
 
 using app::Application;
 using battle::BattleState;
+using battle::Hero;
 using battle::Monster;
 using battle::PartyLayout;
 using geometry::Point;
@@ -37,28 +39,45 @@ int main(int argc, char **argv) {
 
        // temporary test data
        SDL_Surface *bg(SDL_CreateRGBSurface(0, width, height, 32, 0xFF000000, 0xFF0000, 0xFF00, 0xFF));
-       SDL_FillRect(bg, 0, SDL_MapRGB(bg->format, 0, 0, 0));
+       SDL_FillRect(bg, 0, SDL_MapRGB(bg->format, 0xFF, 0xFF, 0xFF));
+       SDL_Rect r;
+       r.x = 1;
+       r.y = 1;
+       r.w = width - 2;
+       r.h = height - 2;
+       SDL_FillRect(bg, &r, SDL_MapRGB(bg->format, 0, 0, 0));
        PartyLayout monstersLayout;
-       monstersLayout.AddPosition(Point<Uint8>(50, 50));
-       monstersLayout.AddPosition(Point<Uint8>(100, 50));
-       monstersLayout.AddPosition(Point<Uint8>(150, 50));
-       monstersLayout.AddPosition(Point<Uint8>(200, 50));
-       SDL_Surface *white100(SDL_CreateRGBSurface(0, 100, 100, 32, 0xFF000000, 0xFF0000, 0xFF00, 0xFF));
-       SDL_FillRect(white100, 0, SDL_MapRGB(bg->format, 0xFF, 0xFF, 0xFF));
-       Sprite dummyMonsterSprite(white100, 100, 100);
+       monstersLayout.AddPosition(Point<Uint8>(50, 100));
+       monstersLayout.AddPosition(Point<Uint8>(100, 100));
+       monstersLayout.AddPosition(Point<Uint8>(150, 100));
+       monstersLayout.AddPosition(Point<Uint8>(200, 100));
+       PartyLayout heroesLayout;
+       heroesLayout.AddPosition(Point<Uint8>(27, 219));
+       heroesLayout.AddPosition(Point<Uint8>(104, 227));
+       heroesLayout.AddPosition(Point<Uint8>(66, 238));
+       heroesLayout.AddPosition(Point<Uint8>(143, 246));
+       SDL_Surface *white96(SDL_CreateRGBSurface(0, 96, 96, 32, 0xFF000000, 0xFF0000, 0xFF00, 0xFF));
+       SDL_FillRect(white96, 0, SDL_MapRGB(bg->format, 0xFF, 0xFF, 0xFF));
+       Sprite dummySprite(white96, 96, 96);
        Monster monster;
-       monster.SetSprite(&dummyMonsterSprite);
+       monster.SetSprite(&dummySprite);
+       Hero hero;
+       hero.SetSprite(&dummySprite);
 
        try {
                InitSDL sdl;
                InitScreen screen(width, height);
 
-               BattleState *battleState(new BattleState(bg, monstersLayout));
+               BattleState *battleState(new BattleState(bg, monstersLayout, heroesLayout));
                battleState->AddMonster(monster);
                battleState->AddMonster(monster);
                battleState->AddMonster(monster);
                battleState->AddMonster(monster);
-               Application app(screen.Screen(), battleState);
+               battleState->AddHero(hero);
+               battleState->AddHero(hero);
+               battleState->AddHero(hero);
+               battleState->AddHero(hero);
+               Application app(&screen, battleState);
                app.Run();
 
                return 0;