summaryrefslogtreecommitdiff
path: root/main.cpp
blob: f30f67a142018a2b82e7e57393b551c7e1a459bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "video.h"
#include "game.h"

#include "gl.h"

#include <SDL_image.h>
#include <boost/format.hpp>

bool init_sdl_image() {
	int real_flags = IMG_Init(IMG_INIT_PNG | IMG_INIT_JPG);
	if(!(real_flags | IMG_INIT_PNG && real_flags | IMG_INIT_JPG)) {
		std::cerr << "Missing PNG or JPEG libraries" << std::endl;
		return false;
	}
	return true;
}

int main(int argc, char **argv) {
	if(argc != 3) {
		std::cout << (boost::format("Usage: %s HOST PORT") % argv[0]).str() << std::endl;
		return 1;
	}

	if(!init_sdl_image())
		return 1;

	video::width = 1280;
	video::height = 720;
	video::init();

#ifdef WIN32
	win32_gl_init();
#endif

	SDL_ShowCursor(SDL_DISABLE);
	SDL_EnableUNICODE(1);

	Game& game = Game::get_instance();

	game.run(argv[1], argv[2]);

	video::free();

	return 0;
}