|
|
@ -0,0 +1,34 @@ |
|
|
|
#pragma once |
|
|
|
|
|
|
|
#include <string> |
|
|
|
#include <memory> |
|
|
|
#include <cpptoml.h> |
|
|
|
#include "project.h" |
|
|
|
|
|
|
|
struct Config { |
|
|
|
static Config from_file(std::string path) { |
|
|
|
auto manifest = cpptoml::parse_file(path); |
|
|
|
return Config::from_toml(manifest); |
|
|
|
} |
|
|
|
static Config from_toml(std::shared_ptr<cpptoml::table> manifest) { |
|
|
|
auto config = Config(); |
|
|
|
config.stylepath = manifest->get_as<std::string>("style").value_or(""); |
|
|
|
|
|
|
|
return config; |
|
|
|
} |
|
|
|
|
|
|
|
std::string stylepath; |
|
|
|
}; |
|
|
|
|
|
|
|
struct DemoState { |
|
|
|
DemoState(std::shared_ptr<Config> config) |
|
|
|
: running(true), current_project(nullptr), |
|
|
|
config(config) {} |
|
|
|
|
|
|
|
int width, height; float ratio; |
|
|
|
|
|
|
|
std::shared_ptr<Project> current_project; |
|
|
|
std::shared_ptr<Config> config; |
|
|
|
|
|
|
|
bool running; |
|
|
|
}; |