Example #1
0
int main(int argc, char *argv[])
{
	std::cout << "Hello" << std::endl;
	std::cout << argv[0] << std::endl;

    resource::init(argv[0]);

	SDL_Init(SDL_INIT_EVERYTHING);
	IMG_Init(IMG_INIT_JPG | IMG_INIT_PNG);

	Window* window = new Window();

#if OPENWAR_USE_GLEW
	GLenum err = glewInit();
	if (err != GLEW_OK)
	{
		std::cout << "glewInit() -> " << glewGetErrorString(err) << std::endl;
		return -1;
	}
#endif
    
	OpenWarSurface* surface = new OpenWarSurface(glm::vec2(640, 480), 1);
	window->SetSurface(surface);

	BattleScenario* scenario = CreateBattleScenario();
	std::vector<BattleCommander*> commanders(1, scenario->GetCommanders().front());
	surface->ResetBattleViews(scenario, commanders);
    
	while (!Window::IsDone())
		Window::ProcessEvents();

	SDL_Quit();
    
	return 0;
}
Example #2
0
int main(int argc, char *argv[])
{
    Resource::init(argv[0]);

#ifdef OPENWAR_USE_SDL
	SDL_Init(SDL_INIT_EVERYTHING);
	IMG_Init(IMG_INIT_JPG | IMG_INIT_PNG);
    TTF_Init();
#endif
#ifdef OPENWAR_USE_SDL_MIXER
	Mix_Init(0);
#endif

	SurfaceAdapter* surfaceAdapter = new SurfaceAdapter("openwar");

#if OPENWAR_USE_GLEW
	GLenum err = glewInit();
	if (err != GLEW_OK)
	{
		std::cout << "glewInit() -> " << glewGetErrorString(err) << std::endl;
		return -1;
	}
#endif
    
    GraphicsContext* gc = new GraphicsContext(1, 1);
	OpenWarSurface* surface = new OpenWarSurface(gc);

	surfaceAdapter->SetSurface(surface);

	BattleScenario* battleScenario = CreateBattleScenario();
	std::vector<BattleCommander*> battleCommanders(1, battleScenario->GetCommanders().front());
	surface->ResetBattleViews(battleScenario, battleCommanders);

	while (!SurfaceAdapter::IsDone())
		SurfaceAdapter::ProcessEvents();

	SDL_Quit();

	return 0;
}