4 * Created on: Aug 1, 2012
8 #include "app/Application.h"
9 #include "battle/BattleState.h"
10 #include "battle/Monster.h"
11 #include "battle/PartyLayout.h"
12 #include "geometry/Point.h"
13 #include "graphics/Sprite.h"
14 #include "sdl/InitScreen.h"
15 #include "sdl/InitSDL.h"
20 using app::Application;
21 using battle::BattleState;
22 using battle::Monster;
23 using battle::PartyLayout;
24 using geometry::Point;
25 using graphics::Sprite;
26 using sdl::InitScreen;
34 int main(int argc, char **argv) {
35 const int width = 800;
36 const int height = 480;
38 // temporary test data
39 SDL_Surface *bg(SDL_CreateRGBSurface(0, width, height, 32, 0xFF000000, 0xFF0000, 0xFF00, 0xFF));
40 SDL_FillRect(bg, 0, SDL_MapRGB(bg->format, 0xFF, 0xFF, 0xFF));
46 SDL_FillRect(bg, &r, SDL_MapRGB(bg->format, 0, 0, 0));
47 PartyLayout monstersLayout;
48 monstersLayout.AddPosition(Point<Uint8>(50, 100));
49 monstersLayout.AddPosition(Point<Uint8>(100, 100));
50 monstersLayout.AddPosition(Point<Uint8>(150, 100));
51 monstersLayout.AddPosition(Point<Uint8>(200, 100));
52 PartyLayout heroesLayout;
53 heroesLayout.AddPosition(Point<Uint8>(45, 132));
54 heroesLayout.AddPosition(Point<Uint8>(174, 136));
55 heroesLayout.AddPosition(Point<Uint8>(110, 143));
56 heroesLayout.AddPosition(Point<Uint8>(239, 148));
57 SDL_Surface *white100(SDL_CreateRGBSurface(0, 100, 100, 32, 0xFF000000, 0xFF0000, 0xFF00, 0xFF));
58 SDL_FillRect(white100, 0, SDL_MapRGB(bg->format, 0xFF, 0xFF, 0xFF));
59 Sprite dummyMonsterSprite(white100, 100, 100);
61 monster.SetSprite(&dummyMonsterSprite);
65 InitScreen screen(width, height);
67 BattleState *battleState(new BattleState(bg, monstersLayout, heroesLayout));
68 battleState->AddMonster(monster);
69 battleState->AddMonster(monster);
70 battleState->AddMonster(monster);
71 battleState->AddMonster(monster);
72 Application app(&screen, battleState);
76 } catch (exception &e) {
77 cerr << "exception in main(): " << e.what() << endl;