Files
FluidSimCpp/include/FluidSim/Desktop/ScenarioMenu.hpp

28 lines
872 B
C++

#pragma once
#include "FluidSim/ScenarioCatalog.hpp"
#include <SFML/Graphics.hpp>
#include <optional>
#include <memory>
namespace fluidsim::port::desktop {
struct ScenarioMenuChoice {
std::optional<std::size_t> example;
std::filesystem::path machine;
bool play{};
};
enum class MenuScreen {Home,Workshop,Scenarios};
class ScenarioMenu {
public:
ScenarioMenu(std::vector<ScenarioExample>,std::vector<std::filesystem::path> machines={});
~ScenarioMenu();
bool handle_event(const sf::Event&,sf::Vector2u);
void draw(sf::RenderWindow&,const sf::Font*);
bool finished()const;
MenuScreen screen()const;
std::optional<ScenarioMenuChoice> take_choice();
private:
struct Impl;
std::unique_ptr<Impl> impl_;
};
std::optional<ScenarioMenuChoice> choose_scenario(sf::RenderWindow&,const sf::Font*,const std::vector<ScenarioExample>&);
}