void InputDialog::on_btnOk_clicked() { QString name = inputui->lineEditName->text(); int difficulty = inputui->cmbBoxDifficulty->currentIndex(); if (name == "" || name == NULL){ QMessageBox::warning(this, "Error", "Please provide a name."); return; } this->close(); GameWorld::accessWorld().setPlayerName(name); GameWorld::accessWorld().setDifficulty(difficulty); //create the bricks for a level GameWorld::accessWorld().makeLevel(); //make gamewindow and show it GameWindow* gamewindow = new GameWindow(music); //create the GUIBricks for a level gamewindow->renderLevel(); //set the position of the gamewindow gamewindow->setGeometry(373, 0, 642, 608); music->stop(); //stop the music //show the game window gamewindow->show(); }
int main(int argc, char **argv) { srand(time(NULL)); std::cout << "VECTOR 2048 game\n"; int cell_size = 80; int padding = 15; int wsize = cell_size * 4 + 5 * padding; GameWindow *window = new GameWindow("2048", wsize, wsize+40, false); Camera *camera = new Camera(window->painter()); GameScene *scene = new GameScene(camera); BackgroundLayer * background = new BackgroundLayer(Color(143, 116, 45)); scene->addEntity(background); Board * board = new Board(cell_size, padding); scene->addEntity(board); scene->addKeyListener(board); scene->gameLoop(10); delete scene; delete window; return 0; }
void ScrollingSpriteRenderer::render(GameWindow& gameWindow, float percBehind) { if(oldCamPos_ != gameWindow.getCamera().getPos()) advanceQuads(gameWindow); renderQuads(gameWindow, percBehind); oldCamPos_ = gameWindow.getCamera().getPos(); }
void CraftuxHome::soloGameLaunch() { // Création et génération du monde ServerConnector* connector = new LocalServerConnector(); GameWindow* gameWindow = new GameWindow(connector); this->close(); gameWindow->show(); }
/* * *Program written by Johna Rutz *Game of concentration using pictures from John Campbell's webcomic PicturesForSadChildren.com *(And pictures of coffee in the harder levels) * * */ int main(int argc, char *argv[]) { QApplication a(argc, argv); GameWindow w; w.show(); return a.exec(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); GameWindow gameWindow; gameWindow.show(); return app.exec(); }
void DrawEngine::init( GameWindow& window ) { mGameWindow = &window; mBufferDC = new BitmapDC( window.getHDC() , window.getHWnd() ); mScreenGraphics = new Graphics2D( mBufferDC->getDC() ); mGLGraphics = new GLGraphics2D; mGLGraphics->init( mGameWindow->getWidth() , mGameWindow->getHeight() ); RenderUtility::init(); }
void setFullscreen(GameWindow& mWindow, bool mFullscreen) { fullscreen = mFullscreen; recalculateSizes(); mWindow.setSize(getWidth(), getHeight()); mWindow.setFullscreen(fullscreen); }
int main(int argc, char *argv[]) { GameWindow *window = GameWindow::get_instance(300, 300, 24, false); SDL_ShowCursor(SDL_TRUE); PathManager pman(argv[0]); ArbitraryMenu m; Font font(pman.data_path("JuraMedium.ttf", "fonts"),24); TextManager texts(&font); ConstantCurve curve(0, 1); texts.set_shadow(true); texts.set_shadow_offset(2, 2); texts.set_shadow_convolve(&curve, 8, 1); m.add_item(TextMenuItem::with_manager(&texts, "First", "first", 10, 10)); m.add_item(TextMenuItem::with_manager(&texts, "Second", "second", 10, 40)); m.add_item(TextMenuItem::with_manager(&texts, "Unclickable", "static", 10, 70, MenuItem::STATIC)); m.add_item(TextMenuItem::with_manager(&texts, "Disabled", "disabled", 10, 100, MenuItem::DISABLED)); window->register_graphic(m.get_graphic_group()); bool running = true; while(running) { SDL_Event e; while(SDL_PollEvent(&e) != 0) { switch(e.type) { case SDL_QUIT: running = 0; break; case SDL_KEYDOWN: switch(e.key.keysym.sym) { case SDLK_ESCAPE: running = 0; break; default: break; } break; case SDL_MOUSEMOTION: m.mouse_motion_event(e.motion); break; case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: { MenuItem* over = m.mouse_button_event(e.button); if (over != NULL) { cout << over->get_name() << endl; } } break; } } window->redraw(); SDL_Delay(100); } return 0; }
void setFullscreen(GameWindow& mWindow, bool mFullscreen) { fullscreen = mFullscreen; mWindow.setSize(getWidth(), getHeight()); mWindow.setFullscreen(getFullscreen()); mWindow.setMouseCursorVisible(Config::getMouseVisible()); recalculateSizes(); }
int main(int argc, _TCHAR* argv[]) { GameWindow gw; gw.StartNetworking(); // gw.Start(); return 0; }
void GameSession::start_game(QGraphicsScene *scn) { userwindow->hide(); GameWindow *gamewindow = new GameWindow(scn); gamewindow->show(); /* constructor ? */ }
GameWindow* PlatformWin::createWindow( char const* title , Vec2i const& size , int colorBit , bool bFullScreen ) { GameWindow* win = new GameWindow; if ( !win->create( title , size , colorBit , bFullScreen ) ) { delete win; return NULL; } return win; }
/** * @brief Entrée du programme. * @param argc Correspond au nombre d'arguments. * @param argv Correspond aux arguments donnés. * @return Une boucle infini sur a.exec(). * \n a.exec() correspond est l'application graphique qui * s'occupera de lancer notre programme. */ int main(int argc, char *argv[]) { QApplication a(argc, argv); qRegisterMetaTypeStreamOperators<PlayerLight>("PlayerLight"); Q_INIT_RESOURCE(res); GameWindow game; game.show(); return a.exec(); }
int SmartWinMain(Application & app) { //locale::global(locale(locale::classic(), locale(""), LC_CTYPE)); initialize(app.getAppHandle()); GameWindow *window = new GameWindow; window->splash(_T("GameCatapult DEMO"), IDB_BITMAP1); bool is_fs = false; uint mode = 0; if(startupdialog(window, is_fs, mode)) { window->setUp(is_fs, mode); return app.run(); } return 1; // CANCEL }
void ResizeFunc(GLFWwindow* wnd, int32 width, int32 height) { float HeightRatio = (float)height / WindowFrame.GetMatrixSize().y; double mwidth = WindowFrame.GetMatrixSize().x * HeightRatio; glViewport(0, 0, mwidth, height); glfwSetWindowSize(wnd, mwidth, height); WindowFrame.size.x = mwidth; WindowFrame.size.y = height; WindowFrame.SizeRatio = HeightRatio; }
int loadThread(void* arg) { GameWindow* gameWindow = GameWindow::instance; GLFWwindow* threadContext = gameWindow->GetThreadContext(); glfwMakeContextCurrent(threadContext); Game* game = gameWindow->GetGame(); while(!glfwWindowShouldClose(threadContext)) { game->LoaderUpdate(); SDL_Delay(10); } std::cout << "Using NO context!" << std::endl; glfwMakeContextCurrent(NULL); return 0; }
int main(int argc, char *argv[]) { QApplication a(argc, argv); int fontId = QFontDatabase::addApplicationFont(":recources/fonts/UpheavalPro.ttf"); QString family = QFontDatabase::applicationFontFamilies(fontId).at(0); QFont font(family); a.setFont(font); GameWindow w; w.show(); return a.exec(); }
int main() { Block::loadImage("./gfx/block.png"); Block::initMap(); Event event; Game.Clear(Color(50, 50, 100)); Grid<Block> france(VectorInt(GRID_DIMS, GRID_DIMS), Block::getImageDims(), PointFloat(224, 48)); france.setCellSize(VectorFloat(BLOCK_DIMS, BLOCK_DIMS)); Block::initContainer(&france); for (int i = 0; i < france.getDimensions().x; ++i) { for (int j = 0; j < france.getDimensions().y; ++j) { PointInt temp(i, j); france.set(Block(Block::getRandomColor(7), temp), temp); } } for (int i = 0; i < france.getDimensions().x; ++i) for (int j = 0; j < france.getDimensions().y; ++j) Game.Draw(france.get(PointInt(i, j)).getSprite()); while (Game.IsOpened()) { while (Game.GetEvent(event)) { if (event.Type == sf::Event::Closed) Game.Close(); } Game.Clear(Color(50, 50, 100)); for (int i = 0; i < france.getDimensions().x; ++i) { for (int j = 0; j < france.getDimensions().y; ++j) { if (Game.GetInput().IsMouseButtonDown(sf::Mouse::Button::Left)) france.get(PointInt(i, j)).handleInput(Game.GetInput()); Game.Draw(france.get(PointInt(i, j)).getSprite()); } } Game.Display(); } //TODO: Begin the main game loop }
int main(int argc, char** argv) { GameWindow gameWindow; Snake* snake = new Snake(); //create player snake Fruit* fruit = new Fruit(5, 5); // create initial fruit Dung * dung = new Dung(10, 10); // create initial dung gameWindow.setSnake(snake); //adding snake to the field etc. gameWindow.setFruit(fruit); gameWindow.setDung(dung); SnakeGame* snakeGame = new SnakeGame(&gameWindow); snakeGame->startGame(); return 0; }
void ScrollingQuad::render(GameWindow& gameWindow, float percBehind) { if(quadrant_ != Quadrant::INVALID) { gameWindow.renderOnCamera(spriteSheet_->getTexture(), &src_, &dest_); } }
void TileRenderer::render(GameWindow& gameWindow, float percBehind) { Point adjPos = RenderComponent::getRenderPosition(percBehind); //explicitly converting to int SDL_Rect dst = { (int)adjPos.x, (int)adjPos.y, Constants::TILE_SIZE, Constants::TILE_SIZE }; gameWindow.render(spriteSheet_->getTexture(), spriteSheet_->getFrameRect(tileNum_), &dst); }
int main(int argc, char** argv) { gw.CreateGameWindow(); drawTest(); GameLoop(); return 0; }
////////////// // Initialize bool KanaMemo::OnInit() { // Configuration SetAppName(_T("KanaMemo")); srand((unsigned)time(NULL)); // Get path GetFullPath(argv[0]); GetFolderName(); // Create the window GameWindow *window = new GameWindow(); window->Show(); // Initialization OK return true; }
void ScrollingSpriteRenderer::advanceQuads(GameWindow& gameWindow) { for (int i = 0; i < N_QUADRANTS; i++) { Point currCam = gameWindow.getCamera().getPos(); quads[i].advance(findXBound(currCam), findYBound(currCam)); } }
void setCurrentResolutionAuto(GameWindow& mWindow) { if(fullscreen) { fullscreenAutoResolution = true; applyAutoFullscreenResolution(); } else { windowedAutoResolution = true; applyAutoWindowedResolution(); } mWindow.setSize(getWidth(), getHeight()); mWindow.setFullscreen(getFullscreen()); mWindow.setMouseCursorVisible(Config::getMouseVisible()); recalculateSizes(); }
void MainWindow::connect_accept(QString port, QString ip, QString username) { std::string i; int p; i = ip.toUtf8().constData(); p = port.toInt(); if (username.contains(" ")) { QMessageBox::information(this, QString("Invalid Username"), QString("Spaces are not allowed in username")); return; } #ifdef DEBUG username = "******"; p = 9900; i = "127.0.0.1"; #endif if (client_->connectClient(p, i)) { mDialog.close(); this->hide(); PickYourShip shipDialog; connect(&shipDialog, SIGNAL(shipChosen(QString)), this, SLOT(assignShip(QString))); shipDialog.exec(); Message msg; msg.setID(0); msg.setType(Message::CONNECTION); msg.setData(username.toStdString()); client_->write(&msg); GameWindow *gameWindow = new GameWindow(); gameWindow->setFocus(); gameWindow->start(); } else { QMessageBox::information(this, QString("Connection Error"), QString("Unable to connect to server. Please check your connection settings.")); } }
void UIPortrait::render(GameWindow & window) { sf::RectangleShape frame{ size_ }; frame.setPosition(position_); frame.setFillColor(sf::Color{ 200,200,200,200 }); frame.setOutlineColor(sf::Color{ 100,100,100,255 }); frame.setOutlineThickness(4.0f); window.draw(frame); sf::Text nameText{ player_->getName() + " " + to_string(player_->getLevel()), ui_->getFont(), 30 }; nameText.setPosition(position_ + sf::Vector2f(10,0)); nameText.setColor(sf::Color::Black); window.draw(nameText); healthBar_.render(window); manaBar_.render(window); expBar_.render(window); }
// Start method main int main(int argc, char *argv[]) { QApplication a(argc, argv); // Create splashscreen object QSplashScreen *splash = new QSplashScreen; splash->setPixmap(QPixmap(":/img/images/splash.png")); splash->show(); // Create database object Database *db = new Database(); Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop; splash->showMessage(QObject::tr("Establishing connections..."), topRight, Qt::white); // Database connection if(!db->createConnection()) return 1; // Client connection Clock clock; clock.show(); splash->showMessage(QObject::tr("Setting up main window..."), topRight, Qt::white); // Create game window GameWindow gameWindow; splash->showMessage(QObject::tr("Setting up game..."), topRight, Qt::white); // create game Game *game = new Game(); gameWindow.setCentralWidget(game); gameWindow.show(); splash->finish(&gameWindow); delete splash; return a.exec(); }// End method main
void Cliente::onGame(int code, Json::Value& data){ if(code){ this->ventanaActual->mensaje(data); }else{ int root_x, root_y; ventanaActual->get_position(root_x, root_y); this->ventanaActual->hide(); delete this->ventanaActual; GameWindow* gwin = new GameWindow; this->ventanaActual = gwin; this->ventanaActual->move(root_x, root_y); gwin->signal_mensaje().connect(sigc::mem_fun(this, &Cliente::sendMsj)); Json::Value msj; msj["event"] = EVENT_GAME_MISC; msj["ev-game"] = EVENT_GAME_INFO; this->sendMsj(msj); } }