27 lines
520 B
C++
27 lines
520 B
C++
|
#include "../includes/Ecran.hpp"
|
||
|
|
||
|
Ecran::Ecran(const uint w, const uint h, const std::string n) {
|
||
|
// Création de la fenêtre SFML
|
||
|
window.create(sf::VideoMode(w, h), n);
|
||
|
}
|
||
|
|
||
|
Ecran::~Ecran() {}
|
||
|
|
||
|
void Ecran::afficher(std::function<void()> dessin) {
|
||
|
while (window.isOpen()) {
|
||
|
sf::Event event;
|
||
|
while (window.pollEvent(event)) {
|
||
|
if (event.type == sf::Event::Closed) {
|
||
|
window.close();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
window.clear();
|
||
|
|
||
|
// Appel d'une fonction dessin
|
||
|
dessin();
|
||
|
|
||
|
window.display();
|
||
|
}
|
||
|
}
|