diff --git a/src/engine.cpp b/src/engine.cpp index 54ae6876..ab66cdec 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -12,6 +12,9 @@ #include "audio/Audio.h" #include "assets/Assets.h" #include "assets/AssetsLoader.h" +#include "world/WorldGenerators.h" +#include "voxels/DefaultWorldGenerator.h" +#include "voxels/FlatWorldGenerator.h" #include "window/Window.h" #include "window/Events.h" #include "window/Camera.h" @@ -80,6 +83,12 @@ Engine::Engine(EngineSettings& settings, EnginePaths* paths) menus::create_version_label(this); } setLanguage(settings.ui.language); + addWorldGenerators(); +} + +void addWorldGenerators() { + WorldGenerators::addWorldGenerator("core:default"); + WorldGenerators::addWorldGenerator("core:flat"); } void Engine::updateTimers() { @@ -251,4 +260,4 @@ EnginePaths* Engine::getPaths() { std::shared_ptr Engine::getScreen() { return screen; -} +} \ No newline at end of file diff --git a/src/frontend/menu.cpp b/src/frontend/menu.cpp index 0879978f..6807c855 100644 --- a/src/frontend/menu.cpp +++ b/src/frontend/menu.cpp @@ -19,6 +19,7 @@ #include "../files/WorldConverter.h" #include "../files/WorldFiles.h" #include "../world/World.h" +#include "../world/WorldGenerators.h" #include "../world/Level.h" #include "../window/Events.h" #include "../window/Window.h" @@ -38,6 +39,10 @@ using glm::vec4; namespace fs = std::filesystem; using namespace gui; +namespace menus { + std::string generatorID; +} + inline uint64_t randU64() { srand(time(NULL)); return rand() ^ (rand() << 8) ^ @@ -82,7 +87,6 @@ static std::shared_ptr