#pragma once #include "RendererBackend.h" #include "config.h" #include "file_browser.h" #include "playback.h" #include "theme.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #if defined(IMGUI_IMPL_OPENGL_ES2) #include #else #include #endif #include #include "base85.h" #include "IconFontCppHeaders/IconsForkAwesome.h" #include "imgui/imgui.h" #include "imgui/misc/cpp/imgui_stdlib.h" #include #ifdef __EMSCRIPTEN__ #include "emscripten_mainloop_stub.h" #endif #include "../../../backend.hpp" #include "ui_backend.hpp" using namespace std::filesystem; using std::string; #define IMGUI_FRONTEND class MainLoop : public RendererBackend { bool show_demo_window = false; FileBrowser fileDialog = FileBrowser(false); std::string userdir; float position = 0.0; float length = 0.0; bool prefs_window = false; bool theme_editor = false; bool about_window = false; bool debug_mode = false; bool property_editor = false; bool restart_needed = false; bool stopped = true; bool enable_cat = false; std::string cat_setting = "__default__"; std::vector backends; UIBackend *cur_backend; friend class ImGuiUIBackend; std::atomic_bool exit_flag; std::map boolean_properties; std::map double_properties; std::map int_properties; std::map string_properties; std::vector properties; std::vector streams; std::map cats; SDL_Texture *cat = nullptr; SDL_Texture *LoadCatFromMemory(const void *ptr, size_t len, const char *name); SDL_Texture *LoadCat(File *file); SDL_Texture *LoadCat(std::string path); void AddCat(std::string name, SDL_Texture *tex); public: Playback *playback; vector args; void FileLoaded(); void LoadFile(std::string file); void Init() override; void GuiFunction() override; void Deinit() override; void Drop(std::string file) override; MainLoop(); };