summaryrefslogtreecommitdiff
path: root/game.h
blob: cad032e55d16a4190509981c1476453e620b2f34 (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
#ifndef GAME_H
#define GAME_H

#include "scene.h"

#include <boost/asio.hpp>

#include <string>

class Game {
	private:
		static Game *game;
		Scene *scene;

		boost::asio::io_service io_service;
		boost::asio::ip::tcp::socket socket;

	public:
		Game();
		~Game();

		void run(std::string host, unsigned int port);
		void run(std::string host, std::string port);

		void async_read();
		void handle_type(const boost::system::error_code& error, std::size_t bytes_transferred, uint8_t *type);
		void handle_chunk();
		void handle_message();

		static Game& get_instance();
};

#endif