Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <memory>
- #include <iostream>
- #include "StateMachine.hpp"
- #include "OptionsMenuState.hpp"
- #include "PlayState.hpp"
- #include "GameState.hpp"
- #include "StateMachine.hpp"
- #include "MenuState.hpp"
- #include <SFML/Graphics/RenderWindow.hpp>
- #include <SFML/Window/Event.hpp>
- OptionsMenuState::OptionsMenuState(StateMachine& machine, sf::RenderWindow& window, bool replace)
- : GameState(machine, window, replace)
- {
- std::cout << "PlayState Init" << std::endl;
- }
- void OptionsMenuState::pause()
- {
- std::cout << "PlayState Pause" << std::endl;
- }
- void OptionsMenuState::resume()
- {
- std::cout << "PlayState Resume" << std::endl;
- }
- void OptionsMenuState::update()
- {
- sf::Event event;
- while (m_window.pollEvent(event))
- {
- switch (event.type)
- {
- case sf::Event::Closed:
- m_machine.quit();
- break;
- case sf::Event::KeyPressed:
- switch (event.key.code)
- {
- case sf::Keyboard::Escape:
- m_machine.quit();
- break;
- //For some reason the "PlayState" below is also Undeclared. \/ \/
- case sf::Keyboard::BackSpace:
- m_next = StateMachine::build<PlayState>(m_machine, m_window, false);
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
- }
- }
- else{
- }
- }
- void OptionsMenuState::draw()
- {
- // Clear the previous drawing
- m_window.clear();
- m_window.display();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement