]> git.localhorst.tv Git - l2e.git/blobdiff - src/main.cpp
added empty battle state
[l2e.git] / src / main.cpp
index 0fce8fe511640d4e9f3fdb7fa9feceaa224e7e1a..780b8c27b70c85e004d77d45e0a1a3b6e8358971 100644 (file)
@@ -5,6 +5,42 @@
  *      Author: holy
  */
 
+#include "app/Application.h"
+#include "battle/BattleState.h"
+#include "sdl/InitScreen.h"
+#include "sdl/InitSDL.h"
+
+#include <exception>
+#include <iostream>
+
+using app::Application;
+using battle::BattleState;
+using sdl::InitScreen;
+using sdl::InitSDL;
+
+using std::cerr;
+using std::cout;
+using std::endl;
+using std::exception;
+
 int main(int argc, char **argv) {
-       return 0;
+       const int width = 800;
+       const int height = 480;
+
+       // temporary
+       SDL_Surface *bg(SDL_CreateRGBSurface(0, width, height, 32, 0xFF000000, 0xFF0000, 0xFF00, 0xFF));
+       SDL_FillRect(bg, 0, SDL_MapRGB(bg->format, 0, 0, 0));
+
+       try {
+               InitSDL sdl;
+               InitScreen screen(width, height);
+
+               Application app(screen.Screen(), new BattleState(bg));
+               app.Run();
+
+               return 0;
+       } catch (exception &e) {
+               cerr << "exception in main(): " << e.what() << endl;
+               return 1;
+       }
 }