SFML working nicely can open and close the window and set a title

This commit is contained in:
Clément Le Bihan
2020-02-04 15:42:19 +01:00
parent 98168435c1
commit 250f01ec77
4 changed files with 20 additions and 2 deletions
+13 -1
View File
@@ -8,12 +8,13 @@
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics//RenderWindow.hpp>
#include <iostream>
namespace ComSquare::Renderer
{
void SFRenderer::setWindowName(std::string newWindowName)
{
this->window.setTitle(newWindowName);
this->window.setTitle(newWindowName + " - ComSquare");
}
void SFRenderer::drawScreen()
@@ -40,4 +41,15 @@ namespace ComSquare::Renderer
this->texture.create(width, height);
}
void SFRenderer::getEvents()
{
sf::Event event;
while (this->window.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
this->shouldExit = true;
break;
}
}
}
}