This repository has been archived on 2024-01-18. You can view files and clone it, but cannot push or open issues or pull requests.
DamesEtCo/src/Ecran.cpp

29 lines
553 B
C++
Raw Normal View History

2023-11-24 20:13:20 +01:00
#include "../includes/Ecran.hpp"
2023-12-01 16:36:50 +01:00
sf::RenderWindow Ecran::window;
2023-11-24 20:13:20 +01:00
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();
}
}