Base content package + ContentLoader

This commit is contained in:
MihailRis
2023-12-01 16:26:42 +03:00
parent 6708e1ef86
commit c8a283c645
33 changed files with 317 additions and 111 deletions
+8 -2
View File
@@ -13,6 +13,7 @@
#include "files/settings_io.h"
#include "files/engine_paths.h"
#include "content/Content.h"
#include "content/ContentLoader.h"
#include "coders/png.h"
#include "graphics/Atlas.h"
@@ -20,6 +21,8 @@
#include "util/command_line.h"
using std::filesystem::path;
int main(int argc, char** argv) {
EnginePaths paths;
if (!parse_cmdline(argc, argv, paths))
@@ -28,14 +31,17 @@ int main(int argc, char** argv) {
platform::configure_encoding();
ContentBuilder contentBuilder;
setup_definitions(&contentBuilder);
// TODO: implement worlds indexing
ContentLoader loader(paths.getResources()/path("content/base"));
loader.load(&contentBuilder);
std::unique_ptr<Content> content(contentBuilder.build());
try {
EngineSettings settings;
toml::Wrapper wrapper = create_wrapper(settings);
std::filesystem::path settings_file = platform::get_settings_file();
std::filesystem::path controls_file = platform::get_controls_file();
path settings_file = platform::get_settings_file();
path controls_file = platform::get_controls_file();
if (std::filesystem::is_regular_file(settings_file)) {
std::cout << "-- loading settings" << std::endl;
std::string content = files::read_string(settings_file);