//
//  GameMain.h
//  Meteor
//
//  Created by Cesar Parent on 07/01/2016.
//  Copyright © 2016 Cesar Parent. All rights reserved.
//

#ifndef GameMain_h
#define GameMain_h

#include "../defines.h"
#include "../CPFoundation.h"
#include "Game.h"

NS_BEGIN

template <typename T, class... Arg> int
GameMain(Arg&&... args) {
    try {
        Game::instance().startWithScene(alloc<T>(std::forward<Arg>(args)...));
        return 0;
    } catch(std::exception& e) {
        std::cerr << "Runtime Error: " << e.what() << std::endl;
        SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Runtime Error", e.what(), nullptr);
        return -1;
    }
}

NS_END

#endif /* GameMain_h */
