4 * Created on: Aug 1, 2012
8 #include "app/Application.h"
9 #include "battle/BattleState.h"
10 #include "battle/Hero.h"
11 #include "battle/Monster.h"
12 #include "battle/PartyLayout.h"
13 #include "geometry/Point.h"
14 #include "graphics/Sprite.h"
15 #include "sdl/InitScreen.h"
16 #include "sdl/InitSDL.h"
21 using app::Application;
22 using battle::BattleState;
24 using battle::Monster;
25 using battle::PartyLayout;
26 using geometry::Point;
27 using graphics::Sprite;
28 using sdl::InitScreen;
36 int main(int argc, char **argv) {
37 const int width = 800;
38 const int height = 480;
40 // temporary test data
41 SDL_Surface *bg(SDL_CreateRGBSurface(0, width, height, 32, 0xFF000000, 0xFF0000, 0xFF00, 0xFF));
42 SDL_FillRect(bg, 0, SDL_MapRGB(bg->format, 0xFF, 0xFF, 0xFF));
48 SDL_FillRect(bg, &r, SDL_MapRGB(bg->format, 0, 0, 0));
49 PartyLayout monstersLayout;
50 monstersLayout.AddPosition(Point<Uint8>(50, 100));
51 monstersLayout.AddPosition(Point<Uint8>(100, 100));
52 monstersLayout.AddPosition(Point<Uint8>(150, 100));
53 monstersLayout.AddPosition(Point<Uint8>(200, 100));
54 PartyLayout heroesLayout;
55 heroesLayout.AddPosition(Point<Uint8>(27, 219));
56 heroesLayout.AddPosition(Point<Uint8>(104, 227));
57 heroesLayout.AddPosition(Point<Uint8>(66, 238));
58 heroesLayout.AddPosition(Point<Uint8>(143, 246));
59 SDL_Surface *white96(SDL_CreateRGBSurface(0, 96, 96, 32, 0xFF000000, 0xFF0000, 0xFF00, 0xFF));
60 SDL_FillRect(white96, 0, SDL_MapRGB(bg->format, 0xFF, 0xFF, 0xFF));
61 Sprite dummySprite(white96, 96, 96);
63 monster.SetSprite(&dummySprite);
65 hero.SetSprite(&dummySprite);
69 InitScreen screen(width, height);
71 BattleState *battleState(new BattleState(bg, monstersLayout, heroesLayout));
72 battleState->AddMonster(monster);
73 battleState->AddMonster(monster);
74 battleState->AddMonster(monster);
75 battleState->AddMonster(monster);
76 battleState->AddHero(hero);
77 battleState->AddHero(hero);
78 battleState->AddHero(hero);
79 battleState->AddHero(hero);
80 Application app(&screen, battleState);
84 } catch (exception &e) {
85 cerr << "exception in main(): " << e.what() << endl;