Coverage report for gui


src/
File: src/render/scenes/Quit.cpp
Date: 2024-06-25 10:57:02
Lines:
0/12
0.0%
Functions:
0/2
0.0%
Branches:
0/14
0.0%

Line Branch Exec Source
1 #include "Quit.hpp"
2 #include "../core/Core.hpp"
3
4 Quit::Quit(Core *core) : _core(core) {
5 _quitButton = std::make_shared<Button>(sf::Vector2f(100, 500),
6 sf::Vector2f(100, 100), "Quit", _core->getFont());
7 }
8
9 bool Quit::update(sf::Event event, sf::RenderWindow &window) {
10 if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Enter)
11 window.close();
12 if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape)
13 _core->_upperState = GameState::DEFAULT;
14 if (_quitButton->update(event, window))
15 window.close();
16 return true;
17 }
18