void initializeGameScene(GameScene &scene, const sf::Vector2f &sceneSize) { bool succeed = scene.arial.loadFromFile("res/arialn.ttf"); if (!succeed) { assert(false); exit(1); } initializeField(scene.field); initializePackman(scene.packman); initializeGhostById(scene.ghosts, GhostId::BLINKY); initializeGhostById(scene.ghosts, GhostId::PINKY); initializeGhostById(scene.ghosts, GhostId::INKY); initializeGhostById(scene.ghosts, GhostId::CLYDE); scene.gameState = GameState::Playing; scene.totalCookieCount = countRemainingCookies(scene.field); scene.gameOverBackground.setFillColor(TRANSPARENT_GRAY); scene.gameOverBackground.setSize(sceneSize); scene.gameOverLabel.setFont(scene.arial); scene.gameOverLabel.setFillColor(sf::Color::Black); scene.gameOverLabel.setPosition(0.5f * sceneSize); }
int main(int, char* []) { sf::ContextSettings settings; settings.antialiasingLevel = 4; sf::RenderWindow window(sf::VideoMode(800, 600), "PacMan Game Clone", sf::Style::Close, settings); Packman packman; initializePackman(packman); Field field; initializeField(field); sf::Clock clock; while (window.isOpen()) { handleEvents(window, packman); update(clock, packman); render(window, packman, field); } return 0; }
//constractor Field::Field(int player_num) { initializeField(player_num); //std::cout << m_panels[0] << " " << m_panels[1] << " " << m_panels[2] << std::endl; //std::cout << (size_t)&m_panels << std::endl; }