From 445bc5bbae4c52b92286c6becec8551605f70cad Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sat, 6 Jan 2024 15:54:21 +0100 Subject: [PATCH] namespace --- src/Ecran.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/Ecran.cpp b/src/Ecran.cpp index 3fa854a..942bf1d 100644 --- a/src/Ecran.cpp +++ b/src/Ecran.cpp @@ -3,7 +3,9 @@ #include #include -sf::RenderWindow Ecran::window; +using namespace sf; + +RenderWindow Ecran::window; std::string Ecran::message = ""; @@ -18,8 +20,8 @@ Ecran::Ecran(const uint w, const uint h, const std::string n, const bool pf) { ++count; // Création de la fenêtre SFML - window.create(sf::VideoMode(w, h + bottomTxtPadding), n, - sf::Style::Titlebar | sf::Style::Close); + window.create(VideoMode(w, h + bottomTxtPadding), n, + Style::Titlebar | Style::Close); fps = pf; } @@ -31,29 +33,29 @@ Ecran::~Ecran() { void Ecran::afficher( const std::function dessin, const std::function onLeftClick) const { - sf::Font font; + Font font; font.loadFromFile("assets/open-sans-latin-400-normal.ttf"); - sf::Text text; + Text text; text.setFont(font); text.setCharacterSize(24); text.setPosition(3, hauteur()); - text.setFillColor(sf::Color::White); + text.setFillColor(Color::White); - sf::Clock fpsClock; - sf::Clock printFpsclock; + Clock fpsClock; + Clock printFpsclock; while (window.isOpen()) { - sf::Event event; + Event event; while (window.pollEvent(event)) { // Fermeture de la fenêtre - if (event.type == sf::Event::Closed) { + if (event.type == Event::Closed) { window.close(); } // Récupération des coordonnées du clic de souris - if (event.type == sf::Event::MouseButtonPressed && - event.mouseButton.button == sf::Mouse::Left) { + if (event.type == Event::MouseButtonPressed && + event.mouseButton.button == Mouse::Left) { onLeftClick(event.mouseButton.x, event.mouseButton.y); } }