Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include "zombie_main.h"
- #include <sstream>
- #include <iostream>
- #include <string>
- #include <cstdlib>
- #include <SFML/Graphics.hpp>
- #define NOMINMAX
- using namespace sf;
- using namespace std;
- int begin_zombies() {
- cout << "Beginning Zombie game.";
- int windowWidth = 800;
- int windowHeight = 600;
- sf::ContextSettings settings;
- settings.antialiasingLevel = 8;
- RenderWindow window(VideoMode(windowWidth, windowHeight), "Undead Rising", sf::Style::Default, settings);
- Text hud;
- Text message;
- Font font;
- font.loadFromFile("fonts/DS-DIGI.ttf");
- hud.setFont(font);
- hud.setCharacterSize(20);
- hud.setFillColor(sf::Color::White);
- message.setFont(font);
- message.setCharacterSize(14);
- message.setFillColor(sf::Color::Red);
- message.setPosition(1, 75); // from left, from top
- while (window.isOpen())
- {
- Event event;
- while (window.pollEvent(event))
- {
- if (event.type == Event::Closed)
- window.close();
- }
- if (Keyboard::isKeyPressed(sf::Keyboard::Escape))
- {
- window.close();
- }
- std::stringstream hud_text;
- hud_text << "This is the generic zombie game.";
- hud.setString(hud_text.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