summaryrefslogtreecommitdiff
path: root/game.h
blob: 7b3ad550fcddb42dd9f7f875f0e2b73eb397d149 (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
#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();
		void handle_player();

		static Game& get_instance();
};

#endif