#include "Subconscious.hpp" #include "WorldScene.hpp" #include /*** public methods ***/ Subconscious::Subconscious() : _window(sf::VideoMode(800, 600), "Subconscious") { _window.setVerticalSyncEnabled(true); _window.setFramerateLimit(90); } Subconscious::~Subconscious() {} void Subconscious::run() { _running = true; while (_running && _window.isOpen()) { gameUpdate(); gameRender(); } } void Subconscious::demo() { Scene *demoScene = new WorldScene(); _currentScene = demoScene; _scenes.push_back(demoScene); run(); } /*** private methods ***/ void Subconscious::gameUpdate() { sf::Event event; while (_window.pollEvent(event)) { if (event.type == sf::Event::Closed) { _window.close(); } } } void Subconscious::gameRender() { _window.clear(); if (_currentScene != nullptr) { _currentScene->render(_window); } _window.display(); }