29 lines
626 B
C++
29 lines
626 B
C++
#include "game.h"
|
|
|
|
Game::Game()
|
|
{
|
|
sf::Window window(sf::VideoMode(640, 480), "SFML-Test Application", sf::Style::Default);
|
|
window.setActive();
|
|
}
|
|
|
|
int Game::run()
|
|
{
|
|
clock = std::make_unique<sf::Clock>();
|
|
|
|
// On the game loop
|
|
while (main_window.isOpen())
|
|
{
|
|
sf::Event event;
|
|
while (main_window.pollEvent(event))
|
|
{
|
|
if (event.type == sf::Event::Closed)
|
|
main_window.close();
|
|
|
|
if ((event.type == sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::Escape))
|
|
main_window.close();
|
|
}
|
|
}
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|