void MainGame::init() { m_View = GRAPHICS->createView(); m_Window = GRAPHICS->createWindow(); m_Window->setResizable(true); m_Window->setVSync(false); m_Window->setWindowDimension(1280, 720); m_Window->setWindowTitle("Happy pong - client"); he::eventCallback0<void> quitHandler(boost::bind(&he::HappyEngine::quit, HAPPYENGINE)); m_Window->Closed += quitHandler; m_Window->create(); }
/** * Constructeur */ WaitingWindow::WaitingWindow(QWidget *parent) : QWidget(parent), _client(NULL) { setWindowTitle(tr("Reciprocity - En attente du commencement de la partie...")); //On construit le Layout vertical principal QVBoxLayout *layout = new QVBoxLayout; setLayout(layout); //On construit le layout horizontal pour la liste des messages/joueurs QHBoxLayout *h = new QHBoxLayout; layout->addLayout(h); //On construit le widget pour les messages _messages = new QListWidget; h->addWidget(_messages,5); //On construit la vue des joueurs _playerList = new QStringListModel; _playerView = new QListView; _playerView->setModel(_playerList); h->addWidget(_playerView,2); //On construit le layout pour envoyer un message. QHBoxLayout *h2 = new QHBoxLayout; layout->addLayout(h2); //On construit la zone de texte _text = new QLineEdit; h2->addWidget(_text,8); //On construit les boutons d'actions QHBoxLayout *h3 = new QHBoxLayout; //Bouton pour quitter la partie QPushButton *quit = new QPushButton(tr("Quitter")); h3->addWidget(quit); connect(quit,SIGNAL(clicked()),this,SLOT(quitHandler())); //Bouton pour lancer la partie //TODO: Ajouter le fait qu'il doit ĂȘtre admin pour lancer la partie _launch = new QPushButton(tr("Lancer la partie")); _launch->setEnabled(false); connect(_launch,SIGNAL(clicked()),this,SLOT(launchGameRequested())); h3->addWidget(_launch); //Bouton pour kicker un joueur _kick = new QPushButton(tr("Kicker")); _kick->setEnabled(false); h3->addWidget(_kick); //On rajoute le Layout layout->addLayout(h3); }
void MainGame::init() { he::GlobalSettings* const globalSettings(he::GlobalSettings::getInstance()); globalSettings->load(he::Path("settings.cfg")); globalSettings->save(he::Path("settings.cfg")); m_View = GRAPHICS->createView(); m_Window = GRAPHICS->createWindow(); m_Window->setResizable(true); m_Window->setVSync(true); m_Window->setWindowDimension(1280, 720); m_Window->setWindowTitle("HappyThijsTest"); he::eventCallback0<void> quitHandler(std::bind(&he::HappyEngine::quit, HAPPYENGINE)); m_Window->Closed += quitHandler; m_Window->create(true); he::gfx::CameraSettings cameraSettings; cameraSettings.setRelativeViewport(he::RectF(0, 0, 1.0f, 1.0f)); m_Renderer = HENew(he::gfx::Renderer2D); m_View->addRenderPlugin(m_Renderer); m_View->setWindow(m_Window); m_View->init(cameraSettings); m_Renderer->attachToRender(this); m_FpsGraph = HENew(he::tools::FPSGraph)(); m_FpsGraph->setType(he::tools::FPSGraph::Type_TextOnly); m_Renderer->attachToRender(m_FpsGraph); m_AStar = HENew(ht::AStar)(); m_AStar->init(); CONSOLE->attachToRenderer(m_Renderer); PROFILER->attachToRenderer(m_Renderer); }
void MainGame::init() { he::GlobalSettings* const globalSettings(he::GlobalSettings::getInstance()); he::Path path(he::Path::getBinPath().str() + "settings.cfg"); globalSettings->load(path); globalSettings->save(path); he::gfx::CameraSettings cameraSettings; cameraSettings.setRelativeViewport(he::RectF(0, 0, 1, 1)); he::gfx::GraphicsEngine* const graphicsEngine(GRAPHICS); m_Window = graphicsEngine->createWindow(); const bool oculus(globalSettings->getRenderSettings().stereoSetting == he::gfx::StereoSetting_OculusRift); m_Window->setResizable(true); m_Window->setVSync(false); m_Window->setWindowDimension(1280, 800); m_Window->setWindowTitle("HappyPluginTest"); m_Window->setFullscreen(false); m_Window->setOculusRiftEnabled(oculus); he::eventCallback0<void> quitHandler(std::bind(&he::HappyEngine::quit, HAPPYENGINE)); m_Window->Closed += quitHandler; m_Window->create(true); he::ge::EntityManager* const entityMan(he::ge::EntityManager::getInstance()); entityMan->installComponentFactory(HENew(he::ge::EngineEntityComponentFactory)()); entityMan->init(); m_PluginLoader = HENew(he::pl::PluginLoader)(); char* plugins[2] = { "HappyPluginTest", "HappyPlugin2DTest" }; he::HappyMessageBox::Button msgResult( he::HappyMessageBox::showExt("Choose plugin", "Please select your plugin", he::HappyMessageBox::Icon_Info, plugins[0], plugins[1], "Cancel")); const char* chosenPlugin(nullptr); switch (msgResult) { case he::HappyMessageBox::Button_Button1: chosenPlugin = plugins[0]; break; case he::HappyMessageBox::Button_Button2: chosenPlugin = plugins[1]; break; default: break; } if (chosenPlugin) { m_Plugin = m_PluginLoader->loadPlugin(he::Path::getBinPath(), chosenPlugin); if (m_Plugin != nullptr) { m_Plugin->init(m_Window, he::RectF(0, 0, 1.0f, 1.0f)); m_Plugin->onLoadLevel(he::Path("")); m_View = graphicsEngine->createView(); m_View->setWindow(m_Window); m_DebugRenderer = HENew(he::gfx::Renderer2D)(); m_View->addRenderPlugin(m_DebugRenderer); m_View->init(cameraSettings); m_View->setCamera(m_Plugin->getActiveCamera()); PROFILER->attachToRenderer(m_DebugRenderer); CONSOLE->attachToRenderer(m_DebugRenderer); CONSOLE->registerCmd([&]() { m_PluginLoader->reloadPlugin(m_Plugin); }, "reloadPlugin"); m_FpsGraph = HENew(he::tools::FPSGraph)(oculus? 3.0f : 1.0f); m_FpsGraph->setPos(he::vec2(5, 5)); m_FpsGraph->setType(he::tools::FPSGraph::Type_Full); addToTickList(m_FpsGraph); m_DebugRenderer->attachToRender(m_FpsGraph); m_DebugRenderer->attachToRender(this); } else { HAPPYENGINE->quit(); } } else { HAPPYENGINE->quit(); } }