int main() { // Create the main window sf::RenderWindow window(sf::VideoMode(screenWidth, screenHeight), "Space Tetris"); tetrisGameManager gameManager; textureManager images; if(!images.addAllCommonTextures()) return 255; sf::FloatRect screenRectSpaceInv(tetrisGameManager::getTetrisGameSize().x,0, screenWidth - tetrisGameManager::getTetrisGameSize().x,screenHeight); spaceInvManager playMan(images,screenRectSpaceInv); // enemyManager eneMan(images,screenRectSpaceInv); //the size of screen playing in.) while (window.isOpen()) { // Process events sf::Event event; while (window.pollEvent(event)) { // Close window : exit switch(event.type) { case sf::Event::Closed: window.close(); break; default: break; } } // Clear screen window.clear(sf::Color::Black); // Draw tetris grid gameManager.updateGrid(window); // remove from code because playermanager will replace the need for it. //eneMan.update(window); playMan.update(window,screenRectSpaceInv); // Update the window window.display(); } return EXIT_SUCCESS; }
void Player::play(bool smallScreen, int player) { this->player = player; // 1:ball, 2:man // Set screen size if (smallScreen) { resWidth = 1366; resHeight = 768; } else { resWidth = 1920; resHeight = 1080; } // run corresponding player if (player==1) playBall(); if (player==2) playMan(); }