From 42c3d9d2156303f4b7a64001276a746dc4a67b95 Mon Sep 17 00:00:00 2001 From: Anthony Date: Mon, 1 Apr 2024 15:29:00 +0200 Subject: [PATCH] SDL 3 + curl thread download manager --- software/library/library_manager.cpp | 7 + software/library/library_manager.h | 5 + story-editor/CMakeLists.txt | 41 +++-- story-editor/src/gui.cpp | 107 +++++++------ story-editor/src/gui.h | 10 +- story-editor/src/i_story_manager.h | 18 ++- story-editor/src/library_window.cpp | 195 +++++++++++++++++------- story-editor/src/library_window.h | 43 +++++- story-editor/src/main_window.cpp | 12 +- story-editor/src/main_window.h | 18 --- story-editor/src/node_editor_window.cpp | 2 + 11 files changed, 313 insertions(+), 145 deletions(-) diff --git a/software/library/library_manager.cpp b/software/library/library_manager.cpp index 4fd2b68..0d4bc1f 100644 --- a/software/library/library_manager.cpp +++ b/software/library/library_manager.cpp @@ -12,9 +12,16 @@ LibraryManager::LibraryManager() {} void LibraryManager::Initialize(const std::string &library_path) { m_library_path = library_path; + CheckDirectories(); Scan(); } +void LibraryManager::CheckDirectories() +{ + std::filesystem::path dlDir = std::filesystem::path(m_library_path) / "store"; + std::filesystem::create_directories(dlDir); +} + void LibraryManager::Scan() { std::filesystem::path directoryPath(m_library_path); diff --git a/software/library/library_manager.h b/software/library/library_manager.h index 85f713b..830e7a2 100644 --- a/software/library/library_manager.h +++ b/software/library/library_manager.h @@ -24,12 +24,17 @@ public: void Scan(); std::shared_ptr NewProject(); + void CheckDirectories(); std::shared_ptr GetStory(const std::string &uuid); + void SetStoreUrl(const std::string &store_url) { m_storeUrl = store_url; } + std::string GetStoreUrl() const { return m_storeUrl; } + private: std::string m_library_path; std::vector> m_projectsList; + std::string m_storeUrl; }; #endif // LIBRARYMANAGER_H diff --git a/story-editor/CMakeLists.txt b/story-editor/CMakeLists.txt index 31c7b53..ee12900 100644 --- a/story-editor/CMakeLists.txt +++ b/story-editor/CMakeLists.txt @@ -60,24 +60,36 @@ add_compile_definitions(IMGUI_INCLUDE="imgui.h") add_subdirectory(libs/ImGuiFileDialog) # ========================================================================================================================= -# SDL +# SDL2 # ========================================================================================================================= -Set(FETCHCONTENT_QUIET FALSE) +# FetchContent_Declare( +# sdl2 +# GIT_REPOSITORY https://github.com/libsdl-org/SDL.git +# GIT_TAG origin/SDL2 +# GIT_SHALLOW TRUE +# GIT_PROGRESS TRUE +# ) + +# set(BUILD_SHARED_LIBS TRUE) +# set(SDL_STATIC TRUE) +# FetchContent_MakeAvailable(sdl2) + +# ========================================================================================================================= +# SDL3 +# ========================================================================================================================= FetchContent_Declare( - sdl2 + sdl3 GIT_REPOSITORY https://github.com/libsdl-org/SDL.git - GIT_TAG origin/SDL2 + GIT_TAG prerelease-3.1.0 GIT_SHALLOW TRUE GIT_PROGRESS TRUE ) set(BUILD_SHARED_LIBS TRUE) set(SDL_STATIC TRUE) -FetchContent_MakeAvailable(sdl2) - -# add_subdirectory(libs/SDL) -# include_directories(libs/SDL/include) +FetchContent_MakeAvailable(sdl3) +include_directories(${sdl3_SOURCE_DIR}/include) # ========================================================================================================================= # SDL3-Image @@ -155,8 +167,8 @@ set(SRCS libs/imgui-node-editor/crude_json.cpp libs/ImGuiFileDialog/ImGuiFileDialog.cpp - ${imgui_SOURCE_DIR}/backends/imgui_impl_sdl2.cpp - ${imgui_SOURCE_DIR}/backends/imgui_impl_sdlrenderer2.cpp + ${imgui_SOURCE_DIR}/backends/imgui_impl_sdl3.cpp + ${imgui_SOURCE_DIR}/backends/imgui_impl_sdlrenderer3.cpp ${imgui_SOURCE_DIR}/backends/imgui_impl_opengl3.cpp ${imgui_SOURCE_DIR}/imgui.cpp ${imgui_SOURCE_DIR}/imgui_widgets.cpp @@ -243,16 +255,17 @@ target_compile_definitions(${STORY_EDITOR_PROJECT} PUBLIC cimg_display=0) target_compile_definitions(${STORY_EDITOR_PROJECT} PUBLIC "$<$:DEBUG>") -target_link_directories(${STORY_EDITOR_PROJECT} PUBLIC ${sdl2_BINARY_DIR} ${curl_BINARY_DIR}) -message(${sdl2_BINARY_DIR}) -set(SDL2_BIN_DIR ${sdl2_BINARY_DIR}) +target_link_directories(${STORY_EDITOR_PROJECT} PUBLIC ${sdl3_BINARY_DIR} ${curl_BINARY_DIR}) + + +set(SDL2_BIN_DIR ${sdl3_BINARY_DIR}) if(UNIX) target_link_libraries(${STORY_EDITOR_PROJECT} pthread OpenGL::GL dl - SDL2 + SDL3 libcurl_static OpenSSL::SSL OpenSSL::Crypto ) diff --git a/story-editor/src/gui.cpp b/story-editor/src/gui.cpp index a6bd109..c91bec0 100644 --- a/story-editor/src/gui.cpp +++ b/story-editor/src/gui.cpp @@ -11,23 +11,34 @@ your use of the corresponding standard functions. #include #include -#include "imgui_impl_sdl2.h" -#include "imgui_impl_sdlrenderer2.h" -#include -#include + +#include "imgui_internal.h" +// SDL2 --------------------------------- +// #include "imgui_impl_sdl2.h" +// #include "imgui_impl_sdlrenderer2.h" +// #include +// #if defined(IMGUI_IMPL_OPENGL_ES2) +// #include +// #else +// #include +//#endif + +// SDL3 --------------------------------- +#include "imgui_impl_sdl3.h" +#include "imgui_impl_sdlrenderer3.h" +#include #if defined(IMGUI_IMPL_OPENGL_ES2) -#include +#include #else -#include +#include #endif + #include "IconsMaterialDesignIcons.h" #include "IconsFontAwesome5_c.h" #include "qoi.h" -#include "platform_folders.h" - static void glfw_error_callback(int error, const char* description) { fprintf(stderr, "GLFW Error %d: %s\n", error, description); @@ -50,8 +61,6 @@ static std::string GetFileExtension(const std::string &fileName) // Simple helper function to load an image into a OpenGL texture with common settings bool LoadTextureFromFile(const char* filename, Gui::Image &img) { - - std::string ext = GetFileExtension(filename); SDL_Surface* surface = nullptr; @@ -64,8 +73,12 @@ bool LoadTextureFromFile(const char* filename, Gui::Image &img) img.w = desc.width; img.h = desc.height; - surface = SDL_CreateRGBSurfaceFrom((void*)pixels, img.w, img.h, channels * 8, channels * img.w, - 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000); + // SDL3 + surface = SDL_CreateSurfaceFrom((void*)pixels, img.w, img.h, 4 * img.w, SDL_PIXELFORMAT_RGBA8888); + + // SDL2 + // surface = SDL_CreateRGBSurfaceFrom((void*)pixels, img.w, img.h, channels * 8, channels * img.w, + // 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000); if (pixels != NULL) { @@ -84,12 +97,12 @@ bool LoadTextureFromFile(const char* filename, Gui::Image &img) } - // SDL3 - // SDL_Surface* surface = SDL_CreateSurfaceFrom((void*)data, img.w, img.h, 4 * img.w, SDL_PIXELFORMAT_RGBA8888); + //SDL3 + surface = SDL_CreateSurfaceFrom((void*)data, img.w, img.h, 4 * img.w, SDL_PIXELFORMAT_RGBA32); // SDL2 - surface = SDL_CreateRGBSurfaceFrom((void*)data, img.w, img.h, channels * 8, channels * img.w, - 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000); + // surface = SDL_CreateRGBSurfaceFrom((void*)data, img.w, img.h, channels * 8, channels * img.w, + // 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000); stbi_image_free(data); } @@ -105,8 +118,8 @@ bool LoadTextureFromFile(const char* filename, Gui::Image &img) fprintf(stderr, "Failed to create SDL texture: %s\n", SDL_GetError()); } -// SDL_DestroySurface(surface); // SDL3 - SDL_FreeSurface(surface); // SDL2 + SDL_DestroySurface(surface); // SDL3 + // SDL_FreeSurface(surface); // SDL2 return true; @@ -129,8 +142,11 @@ Gui::Gui() bool Gui::Initialize() { - // Setup SDL - if (SDL_Init(SDL_INIT_EVERYTHING) != 0) + // Setup SDL2 + // if (SDL_Init(SDL_INIT_EVERYTHING) != 0) + + // Setup SDL3 + if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMEPAD) != 0) { printf("Error: SDL_Init(): %s\n", SDL_GetError()); return -1; @@ -143,17 +159,17 @@ bool Gui::Initialize() SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIDDEN); // SDL3 - //window = SDL_CreateWindow("Dear ImGui SDL3+SDL_Renderer example", 1280, 720, window_flags); + window = SDL_CreateWindow("Story Editor", 1280, 720, window_flags); // SDL2 - window = SDL_CreateWindow("Story Editor", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, window_flags); + // window = SDL_CreateWindow("Story Editor", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, window_flags); if (window == nullptr) { printf("Error: SDL_CreateWindow(): %s\n", SDL_GetError()); return -1; } - renderer = SDL_CreateRenderer(window, 0, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED); + renderer = SDL_CreateRenderer(window, nullptr, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED); if (renderer == nullptr) { SDL_Log("Error: SDL_CreateRenderer(): %s\n", SDL_GetError()); @@ -170,6 +186,7 @@ bool Gui::Initialize() io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; + io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; io.Fonts->AddFontFromFileTTF( std::string(m_executablePath + "/fonts/roboto.ttf").c_str(), 20); @@ -201,13 +218,12 @@ bool Gui::Initialize() // Setup Platform/Renderer backends // SDL3 -// ImGui_ImplSDL3_InitForSDLRenderer(window, renderer); -// ImGui_ImplSDLRenderer3_Init(renderer); - + ImGui_ImplSDL3_InitForSDLRenderer(window, renderer); + ImGui_ImplSDLRenderer3_Init(renderer); // SDL2 - ImGui_ImplSDL2_InitForSDLRenderer(window, renderer); - ImGui_ImplSDLRenderer2_Init(renderer); + // ImGui_ImplSDL2_InitForSDLRenderer(window, renderer); + // ImGui_ImplSDLRenderer2_Init(renderer); // Load Fonts // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. @@ -237,20 +253,19 @@ bool Gui::PollEvent() while (SDL_PollEvent(&event)) { // SDL3 - /* + ImGui_ImplSDL3_ProcessEvent(&event); if (event.type == SDL_EVENT_QUIT) done = true; if (event.type == SDL_EVENT_WINDOW_CLOSE_REQUESTED && event.window.windowID == SDL_GetWindowID(window)) done = true; -*/ // SLD2 - ImGui_ImplSDL2_ProcessEvent(&event); - if (event.type == SDL_QUIT) - done = true; - if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(window)) - done = true; + // ImGui_ImplSDL2_ProcessEvent(&event); + // if (event.type == SDL_QUIT) + // done = true; + // if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(window)) + // done = true; } return done; @@ -262,12 +277,12 @@ void Gui::StartFrame() // Start the Dear ImGui frame // SDL3 -// ImGui_ImplSDLRenderer3_NewFrame(); -// ImGui_ImplSDL3_NewFrame(); + ImGui_ImplSDLRenderer3_NewFrame(); + ImGui_ImplSDL3_NewFrame(); // SDL2 - ImGui_ImplSDLRenderer2_NewFrame(); - ImGui_ImplSDL2_NewFrame(); + // ImGui_ImplSDLRenderer2_NewFrame(); + // ImGui_ImplSDL2_NewFrame(); ImGui::NewFrame(); } @@ -284,8 +299,8 @@ void Gui::EndFrame() ImGui::Render(); - //ImGui_ImplSDLRenderer3_RenderDrawData(ImGui::GetDrawData()); // SDL3 - ImGui_ImplSDLRenderer2_RenderDrawData(ImGui::GetDrawData()); // SDL2 + ImGui_ImplSDLRenderer3_RenderDrawData(ImGui::GetDrawData()); // SDL3 + // ImGui_ImplSDLRenderer2_RenderDrawData(ImGui::GetDrawData()); // SDL2 SDL_RenderPresent(renderer); } @@ -295,12 +310,12 @@ void Gui::Destroy() // Cleanup // SDL3 -// ImGui_ImplSDLRenderer3_Shutdown(); -// ImGui_ImplSDL3_Shutdown(); + ImGui_ImplSDLRenderer3_Shutdown(); + ImGui_ImplSDL3_Shutdown(); // SDL2 - ImGui_ImplSDLRenderer2_Shutdown(); - ImGui_ImplSDL2_Shutdown(); + // ImGui_ImplSDLRenderer2_Shutdown(); + // ImGui_ImplSDL2_Shutdown(); ImGui::DestroyContext(); @@ -495,7 +510,7 @@ void Gui::ApplyTheme() -#include "imgui_internal.h" + namespace ImGui { void LoadingIndicatorCircle(const char* label, const float indicator_radius, const ImVec4& main_color, const ImVec4& backdrop_color, diff --git a/story-editor/src/gui.h b/story-editor/src/gui.h index 78321cb..b3f1fc8 100644 --- a/story-editor/src/gui.h +++ b/story-editor/src/gui.h @@ -53,10 +53,10 @@ private: std::string m_executablePath; }; -namespace ImGui { -void LoadingIndicatorCircle(const char* label, const float indicator_radius, - const ImVec4& main_color, const ImVec4& backdrop_color, - const int circle_count, const float speed); -} +// namespace ImGui { +// void LoadingIndicatorCircle(const char* label, const float indicator_radius, +// const ImVec4& main_color, const ImVec4& backdrop_color, +// const int circle_count, const float speed); +// } #endif // GUI_H diff --git a/story-editor/src/i_story_manager.h b/story-editor/src/i_story_manager.h index c34171a..1727078 100644 --- a/story-editor/src/i_story_manager.h +++ b/story-editor/src/i_story_manager.h @@ -5,10 +5,26 @@ #include #include #include +#include #include "resource.h" #include "connection.h" +template +struct Callback; + +template +struct Callback { + template + static Ret callback(Args... args) { + return func(args...); + } + static std::function func; +}; + +template +std::function Callback::func; + class IStoryManager { public: @@ -36,8 +52,6 @@ public: virtual void Pause() = 0; virtual void Next() = 0; virtual void Previous() = 0; - - }; #endif // I_STORY_MANAGER_H diff --git a/story-editor/src/library_window.cpp b/story-editor/src/library_window.cpp index 12ea18d..c23a2a2 100644 --- a/story-editor/src/library_window.cpp +++ b/story-editor/src/library_window.cpp @@ -3,61 +3,44 @@ #include "ImGuiFileDialog.h" #include #include "IconsMaterialDesignIcons.h" +#include "i_story_manager.h" +#include -#define CPPHTTPLIB_OPENSSL_SUPPORT -#include "httplib.h" -#define CA_CERT_FILE "./ca-bundle.crt" +typedef int (*xfer_callback_t)(void *clientp, curl_off_t dltotal, curl_off_t dlnow, + curl_off_t ultotal, curl_off_t ulnow); -#include -int xfer_callback(void *clientp, curl_off_t dltotal, curl_off_t dlnow, - curl_off_t ultotal, curl_off_t ulnow) +void download_file(CURL *curl, + const std::string &url, + const std::string &output_file, + std::function finished_callback) { - return 0; -} - -void download_file(const std::string &output_file = "pi.txt") -{ - - CURL *curl_download; FILE *fp; CURLcode res; - std::string url = "http://www.gecif.net/articles/mathematiques/pi/pi_1_million.txt"; - curl_download = curl_easy_init(); - - if (curl_download) + if (curl) { //SetConsoleTextAttribute(hConsole, 11); fp = fopen(output_file.c_str(),"wb"); - curl_easy_setopt(curl_download, CURLOPT_URL, url.c_str()); - curl_easy_setopt(curl_download, CURLOPT_WRITEFUNCTION, NULL); - curl_easy_setopt(curl_download, CURLOPT_WRITEDATA, fp); - curl_easy_setopt(curl_download, CURLOPT_NOPROGRESS, 0); - //progress_bar : the fonction for the progress bar - curl_easy_setopt(curl_download, CURLOPT_XFERINFOFUNCTION, xfer_callback); - - + curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp); std::cout<<" Start download"<status << std::endl; - std::cout << res->get_header_value("Content-Type") << std::endl; - m_storeRawJson = res->body; - ParseStoreData(); - //std::cout << res->body << std::endl; - } else { - std::cout << "error code: " << res.error() << std::endl; - - auto result = cli.get_openssl_verify_result(); - if (result) { - std::cout << "verify error: " << X509_verify_cert_error_string(result) <::func = std::bind( + &LibraryWindow::TransferCallback, + this, + std::placeholders::_1, + std::placeholders::_2, + std::placeholders::_3, + std::placeholders::_4, + std::placeholders::_5); + curl_easy_setopt(m_curl, CURLOPT_XFERINFOFUNCTION, static_cast(Callback::callback)); + } } + static bool canValidateDialog = false; inline void InfosPane(const char *vFilter, IGFDUserDatas vUserDatas, bool *vCantContinue) // if vCantContinue is false, the user cant validate the dialog { @@ -131,6 +173,14 @@ inline void InfosPane(const char *vFilter, IGFDUserDatas vUserDatas, bool *vCant *vCantContinue = canValidateDialog; } +std::string LibraryWindow::ToLocalStoreFile(const std::string &url) +{ + auto filename = StoryProject::GetFileName(m_store_url); + + filename = m_libraryManager.LibraryPath() + "/store/" + filename; + std::cout << "Store file: " << filename << std::endl; + return filename; +} void LibraryWindow::Draw() { @@ -178,8 +228,6 @@ void LibraryWindow::Draw() // ============================================================================ if (ImGui::BeginTabItem("Local library ##LocalTabBar", nullptr, ImGuiTabItemFlags_None)) { - - if (ImGui::Button("Scan library")) { m_libraryManager.Scan(); @@ -226,12 +274,47 @@ void LibraryWindow::Draw() ImGui::EndTabItem(); } - + // ============================================================================ - // LOCAL TABLE + // STORE STORY LIST // ============================================================================ if (ImGui::BeginTabItem("Remote Store##StoreTabBar", nullptr, ImGuiTabItemFlags_None)) { + ImGui::InputTextWithHint("##store_url", "Store URL", m_store_url, IM_ARRAYSIZE(m_store_url)); + ImGui::SameLine(); + if (ImGui::Button("Load")) + { + m_storeIndexFilename = ToLocalStoreFile(m_store_url); + m_downloadQueue.push({ + "dl", + m_store_url, + m_storeIndexFilename, + std::bind(&LibraryWindow::ParseStoreData, this, std::placeholders::_1) + }); + } + + static TransferProgress progressItem; + static std::string currentDownload; + static float progress = 0.0f; + if (m_transferProgress.try_pop(progressItem)) + { + if (progressItem.total > 0) + { + // currentDownload = "" + progress += (progressItem.current / progressItem.total); + } + else + { + progress = 0.0; + } + } + // Typically we would use ImVec2(-1.0f,0.0f) or ImVec2(-FLT_MIN,0.0f) to use all available width, + // or ImVec2(width,0.0f) for a specified width. ImVec2(0.0f,0.0f) uses ItemWidth. + ImGui::ProgressBar(progress, ImVec2(0.0f, 0.0f)); + // ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + + // ImGui::Text("Current download: "); + if (ImGui::BeginTable("store_table", 3, tableFlags)) { ImGui::TableSetupColumn("Title", ImGuiTableColumnFlags_WidthFixed); diff --git a/story-editor/src/library_window.h b/story-editor/src/library_window.h index e480dc2..abdeafc 100644 --- a/story-editor/src/library_window.h +++ b/story-editor/src/library_window.h @@ -1,14 +1,41 @@ #pragma once +#include #include "window_base.h" #include "library_manager.h" #include "i_story_manager.h" +#include "thread_safe_queue.h" + +#include struct StoryInf { int age; std::string title; }; +struct DownloadCommand { + std::string order; + std::string url; + std::string filename; + std::function finished_callback; +}; + + +struct TransferProgress { + long total; + long current; + + TransferProgress() { + total = 0; + current = 0; + } + + TransferProgress(int t, int c) { + total = t; + current = c; + } +}; + class LibraryWindow : public WindowBase { public: @@ -17,13 +44,27 @@ public: void Initialize(); virtual void Draw() override; + ~LibraryWindow(); private: IStoryManager &m_storyManager; LibraryManager &m_libraryManager; + CURL *m_curl; + char m_store_url[1024]; + std::thread m_downloadThread; + ThreadSafeQueue m_downloadQueue; + ThreadSafeQueue m_transferProgress; + std::mutex m_downloadMutex; + bool m_cancel{false}; + std::vector m_store; + std::string m_storeIndexFilename; std::string m_storeRawJson; - void ParseStoreData(); + void ParseStoreData(bool success); + void DownloadThread(); + int TransferCallback(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow); + + std::string ToLocalStoreFile(const std::string &url); }; diff --git a/story-editor/src/main_window.cpp b/story-editor/src/main_window.cpp index 92abd30..56cb6ac 100644 --- a/story-editor/src/main_window.cpp +++ b/story-editor/src/main_window.cpp @@ -1,6 +1,6 @@ #include "main_window.h" #include -#include +#include #include "platform_folders.h" #include "media_converter.h" @@ -372,6 +372,8 @@ void MainWindow::DrawMainMenuBar() void MainWindow::Initialize() { + LoadParams(); + // GUI Init m_gui.Initialize(); // gui.ApplyTheme(); @@ -380,8 +382,9 @@ void MainWindow::Initialize() m_emulatorWindow.Initialize(); m_nodeEditorWindow.Initialize(); m_PropertiesWindow.Initialize(); + m_libraryWindow.Initialize(); + - LoadParams(); } @@ -691,7 +694,7 @@ void MainWindow::Loop() m_gui.StartFrame(); - ImGui::DockSpaceOverViewport(ImGui::GetMainViewport()); + ImGui::DockSpaceOverViewport(ImGui::GetMainViewport()); DrawMainMenuBar(); // DrawStatusBar(); @@ -979,6 +982,9 @@ void MainWindow::LoadParams() m_libraryManager.Initialize(library_path); } + nlohmann::json store_url = j["store_url"]; + m_libraryManager.SetStoreUrl(store_url); + } catch(std::exception &e) { diff --git a/story-editor/src/main_window.h b/story-editor/src/main_window.h index 98c6cea..f332d1d 100644 --- a/story-editor/src/main_window.h +++ b/story-editor/src/main_window.h @@ -63,24 +63,6 @@ struct DebugContext }; - -template -struct Callback; - -template -struct Callback { - template - static Ret callback(Args... args) { - return func(args...); - } - static std::function func; -}; - -template -std::function Callback::func; - - - class MainWindow : public IStoryManager, public IAudioEvent { public: diff --git a/story-editor/src/node_editor_window.cpp b/story-editor/src/node_editor_window.cpp index fdc5537..fff3ec3 100644 --- a/story-editor/src/node_editor_window.cpp +++ b/story-editor/src/node_editor_window.cpp @@ -1,4 +1,6 @@ #include "node_editor_window.h" + + #include "imgui.h" #include "imgui_internal.h" #include