コード例 #1
0
CClientGameEngine::CClientGameEngine(boost::program_options::variables_map vm) : CGameEngine(false), m_syncTime(0.f)
{
	boost::shared_ptr<CSFMLLog> logger = CSFMLLog::init();

	boost::shared_ptr<CSoundEngine> soundEngine(new CSoundEngine());
	setSoundEngine(soundEngine);

	UInt16 width = vm["width"].as<UInt16>();
	UInt16 height = vm["height"].as<UInt16>();
	getLevel()->setScreenSize(sf::Vector2i(800,height+1));

	boost::shared_ptr<sf::RenderWindow> renderWindow(new sf::RenderWindow(sf::VideoMode(width,height,32),"Tour devel 0.1b"));
	boost::shared_ptr<CRenderEngine> renderEngine = boost::shared_ptr<CRenderEngine>(new CRenderEngine(renderWindow, logger));
	setRenderEngine(renderEngine);
	m_inputEngine = boost::shared_ptr<CInputEngine>(new CInputEngine(renderWindow));

	boost::shared_ptr<CClientSession> session(new CClientSession());
	boost::shared_ptr<CClientEventEngine> eventEngine = boost::shared_ptr<CClientEventEngine>(new CClientEventEngine(session));
	setEventEngine(eventEngine);
	m_clientSession = session;
	m_clientEventEngine = eventEngine;

	std::string host = vm["h"].as<std::string>();
	std::string port = vm["p"].as<std::string>();;

	session->connect(host,port);

	CLog::debug("Client started");
}
コード例 #2
0
ファイル: window.cpp プロジェクト: ahmidou/aphid
Window::Window()
{
	m_shouldDisplayFeather = true;
	std::cout<<"Initializing Mallard main window ";
    glWidget = new GLWidget;
	m_tools = new ToolBox;
	m_barbEdit = new BarbEdit(this);
	m_renderEdit = new RenderEdit(this);
	
	glWidget->setInteractContext(m_tools);
	m_brushControl = new BrushControl(glWidget->brush(), this);
	m_featherEdit = new FeatherEdit(this);
	FeatherExample::FeatherLibrary = glWidget;
	m_timeControl = new TimeControl(this);
	glWidget->setPlayback(m_timeControl);
	
	m_sceneEdit = new SceneEdit(glWidget, this);
	
	addToolBar(m_tools);

	setCentralWidget(glWidget);
    setWorkTitle(tr("untitled"));
	createActions();
	createMenus();
    
	connect(m_tools, SIGNAL(contextChanged(int)), this, SLOT(receiveToolContext(int)));
	connect(m_tools, SIGNAL(contextChanged(int)), m_brushControl, SLOT(receiveToolContext(int)));
    connect(m_tools, SIGNAL(actionTriggered(int)), this, SLOT(receiveToolAction(int)));
	connect(m_tools, SIGNAL(stateChanged(int)), this, SLOT(receiveToolState(int)));
	connect(m_brushControl, SIGNAL(brushChanged()), glWidget, SLOT(receiveBrushChanged()));
	connect(m_brushControl, SIGNAL(paintModeChanged(int)), glWidget, SLOT(receivePaintMode(int)));
	connect(glWidget, SIGNAL(sceneNameChanged(QString)), this, SLOT(setWorkTitle(QString)));
	connect(glWidget, SIGNAL(sendMessage(QString)), this, SLOT(showMessage(QString)));
	connect(m_featherEdit, SIGNAL(textureLoaded(QString)), glWidget, SLOT(receiveFeatherEditBackground(QString)));
	connect(m_featherEdit, SIGNAL(featherAdded()), glWidget, SLOT(receiveFeatherAdded()));
	connect(glWidget, SIGNAL(sendFeatherEditBackground(QString)), m_featherEdit, SLOT(receiveTexture(QString)));
	connect(m_timeControl, SIGNAL(currentFrameChanged(int)), glWidget, SLOT(updateOnFrame(int)));
	connect(m_featherEdit->uvView(), SIGNAL(selectionChanged()), m_barbEdit->barbControl(), SLOT(receiveSelectionChanged()));
	connect(glWidget, SIGNAL(featherSelectionChanged()), m_barbEdit->barbControl(), SLOT(receiveSelectionChanged()));
	connect(m_featherEdit->uvView(), SIGNAL(shapeChanged()), m_barbEdit->barbView(), SLOT(receiveShapeChanged()));
	connect(glWidget, SIGNAL(renderResChanged(QSize)), m_renderEdit, SLOT(resizeRenderView(QSize)));
	connect(glWidget, SIGNAL(renderEngineChanged(QString)), m_renderEdit, SLOT(setRenderEngine(QString)));
	connect(glWidget, SIGNAL(renderStarted(QString)), m_renderEdit, SLOT(startRender(QString)));
	connect(m_renderEdit, SIGNAL(cancelRender()), glWidget, SLOT(receiveCancelRender()));
	connect(m_barbEdit->barbControl(), SIGNAL(shapeChanged()), glWidget, SLOT(receiveBarbChanged()));
	connect(glWidget, SIGNAL(sceneOpened()), m_sceneEdit, SLOT(reloadScene()));
	connect(m_sceneEdit->model(), SIGNAL(cameraChanged()), glWidget, SLOT(receiveCameraChanged()));
	
	std::cout<<"Ready\n";
	statusBar()->showMessage(tr("Ready"));
}