Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include "pong.h"
- #include "zombies.h"
- #include <sstream>
- #include <iostream>
- #include <string>
- #include <cstdlib>
- #include <SFML/Graphics.hpp>
- #define NOMINMAX
- using namespace sf;
- int main()
- {
- int windowWidth = 800;
- int windowHeight = 600;
- sf::ContextSettings settings;
- settings.antialiasingLevel = 8;
- RenderWindow window(VideoMode(windowWidth, windowHeight), "Main Menu", sf::Style::Default, settings);
- window.setFramerateLimit(60);
- Text hud;
- Font font;
- font.loadFromFile("fonts/DS-DIGI.ttf");
- hud.setFont(font);
- hud.setCharacterSize(20);
- hud.setFillColor(sf::Color::White);
- while (window.isOpen())
- {
- Event event;
- while (window.pollEvent(event))
- {
- if (event.type == Event::Closed)
- window.close();
- }
- if (Keyboard::isKeyPressed(sf::Keyboard::Escape))
- {
- window.close();
- }
- else if (Keyboard::isKeyPressed(Keyboard::1))
- {
- begin_pong(); // This calls the 'begin' function in Pong
- }
- else if (Keyboard::isKeyPressed(Keyboard::2))
- {
- begin_zombies(); // This calls the 'begin' function in Zombies
- }
- std::stringstream ss;
- ss << "Press 1 to play Pong" << std::endl << "Press 2 to play Zombies";
- hud.setString(ss.str());
- window.clear(Color(0, 0, 0, 255));
- window.draw(hud);
- window.display();
- }
- return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement