thread pool update + refactor
This commit is contained in:
@@ -201,6 +201,7 @@ void menus::open_world(std::string name, Engine* engine, bool confirmConvert) {
|
||||
try {
|
||||
engine->loadWorldContent(folder);
|
||||
} catch (const contentpack_error& error) {
|
||||
engine->setScreen(std::make_shared<MenuScreen>(engine));
|
||||
// could not to find or read pack
|
||||
guiutil::alert(
|
||||
engine->getGUI(), langs::get(L"error.pack-not-found")+L": "+
|
||||
@@ -208,6 +209,7 @@ void menus::open_world(std::string name, Engine* engine, bool confirmConvert) {
|
||||
);
|
||||
return;
|
||||
} catch (const std::runtime_error& error) {
|
||||
engine->setScreen(std::make_shared<MenuScreen>(engine));
|
||||
guiutil::alert(
|
||||
engine->getGUI(), langs::get(L"Content Error", L"menu")+L": "+
|
||||
util::str2wstr_utf8(error.what())
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#include "menu.h"
|
||||
#include "menu_commons.h"
|
||||
|
||||
#include "../../coders/png.h"
|
||||
#include "../../coders/imageio.h"
|
||||
#include "../../content/PacksManager.h"
|
||||
#include "../../content/ContentLUT.h"
|
||||
#include "../../engine.h"
|
||||
#include "../../files/WorldFiles.h"
|
||||
#include "../../graphics/core/Texture.h"
|
||||
#include "../../graphics/ui/gui_util.h"
|
||||
#include "../../logic/LevelController.h"
|
||||
#include "../../util/stringutil.h"
|
||||
@@ -52,7 +53,8 @@ std::shared_ptr<Container> create_pack_panel(
|
||||
if (assets->getTexture(icon) == nullptr) {
|
||||
auto iconfile = pack.folder/fs::path("icon.png");
|
||||
if (fs::is_regular_file(iconfile)) {
|
||||
assets->store(png::load_texture(iconfile.string()), icon);
|
||||
auto image = imageio::read(iconfile.string());
|
||||
assets->store(Texture::from(image.get()), icon);
|
||||
} else {
|
||||
icon = "gui/no_icon";
|
||||
}
|
||||
@@ -183,12 +185,7 @@ void create_content_panel(Engine* engine, LevelController* controller) {
|
||||
auto mainPanel = menus::create_page(engine, "content", 550, 0.0f, 5);
|
||||
|
||||
auto paths = engine->getPaths();
|
||||
PacksManager manager;
|
||||
manager.setSources({
|
||||
paths->getWorldFolder()/fs::path("content"),
|
||||
paths->getUserfiles()/fs::path("content"),
|
||||
paths->getResources()/fs::path("content")
|
||||
});
|
||||
PacksManager manager = engine->createPacksManager(paths->getWorldFolder());
|
||||
manager.scan();
|
||||
|
||||
std::vector<ContentPack> scanned = manager.getAll(manager.getAllNames());
|
||||
|
||||
Reference in New Issue
Block a user