]> git.localhorst.tv Git - l2e.git/blob - src/main.cpp
added battle party layout class
[l2e.git] / src / main.cpp
1 /*
2  * main.cpp
3  *
4  *  Created on: Aug 1, 2012
5  *      Author: holy
6  */
7
8 #include "app/Application.h"
9 #include "battle/BattleState.h"
10 #include "battle/PartyLayout.h"
11 #include "geometry/Point.h"
12 #include "sdl/InitScreen.h"
13 #include "sdl/InitSDL.h"
14
15 #include <exception>
16 #include <iostream>
17
18 using app::Application;
19 using battle::BattleState;
20 using battle::PartyLayout;
21 using geometry::Point;
22 using sdl::InitScreen;
23 using sdl::InitSDL;
24
25 using std::cerr;
26 using std::cout;
27 using std::endl;
28 using std::exception;
29
30 int main(int argc, char **argv) {
31         const int width = 800;
32         const int height = 480;
33
34         // temporary
35         SDL_Surface *bg(SDL_CreateRGBSurface(0, width, height, 32, 0xFF000000, 0xFF0000, 0xFF00, 0xFF));
36         SDL_FillRect(bg, 0, SDL_MapRGB(bg->format, 0, 0, 0));
37         PartyLayout monstersLayout;
38         monstersLayout.AddPosition(Point<Uint8>(50, 50));
39         monstersLayout.AddPosition(Point<Uint8>(100, 50));
40         monstersLayout.AddPosition(Point<Uint8>(150, 50));
41         monstersLayout.AddPosition(Point<Uint8>(200, 50));
42
43         try {
44                 InitSDL sdl;
45                 InitScreen screen(width, height);
46
47                 Application app(screen.Screen(), new BattleState(bg, monstersLayout));
48                 app.Run();
49
50                 return 0;
51         } catch (exception &e) {
52                 cerr << "exception in main(): " << e.what() << endl;
53                 return 1;
54         }
55 }