GameClient::GameClient()
{
	// Initialize the game network client
	m_gameNetworkClient = new GameNetworkClient;

	// React if the server connection is lost
	m_gameNetworkClient->onConnectionClosed.connect(
		boost::bind(&GameClient::handleConnectionClosed, this));

	m_game = GamePtr(new Game(m_gameNetworkClient));
}
GamePtr NullFactory::createGame() const {
    return GamePtr(new NullGame());
}
Exemple #3
0
#include "GL.h"
#include "Game.h"
#include "Application.h"

const int WINDOW_OFFSET_X = 100;
const int WINDOW_OFFSET_Y = 100;

const unsigned FRAME_INTERVAL = 25; //msec. 40 fps
const unsigned SNAKE_INTERVAL = 150;

GamePtr Application::_game = GamePtr(new Game());

Application::Application(int argc, char** argv) 
{
    GLInit(argc, argv);
}

void Application::CreateWindow(const char* name, unsigned width, unsigned height)
{
    _windowHandler = GLCreateWindow(name, width, height, WINDOW_OFFSET_X, WINDOW_OFFSET_Y);
    
    if (_windowHandler)
        _BindHandlers();
    else
        printf("%s: Can't create window", __FUNCTION__);
}

void Application::_BindHandlers()
{
    GLRegisterDisplayCallback(_DisplayHandler);
    GLRegisterKeyboardCallback(_KeyboardHandlerASCII, _KeyboardSpecialHandler);