2023-08-25 14:38:06 -07:00
|
|
|
#pragma once
|
|
|
|
#include "RendererBackend.h"
|
|
|
|
#include "config.h"
|
|
|
|
#include "file_browser.h"
|
|
|
|
#include "playback.h"
|
|
|
|
#include "theme.h"
|
|
|
|
#include <libintl.h>
|
|
|
|
#include <iostream>
|
|
|
|
#include <fstream>
|
|
|
|
#include <json/json.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <cmath>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <string>
|
2024-10-19 10:19:08 -07:00
|
|
|
#include <map>
|
2023-08-25 14:38:06 -07:00
|
|
|
#include <SDL.h>
|
|
|
|
#include <SDL_image.h>
|
|
|
|
#include <filesystem>
|
|
|
|
#include <SDL_video.h>
|
|
|
|
#if defined(IMGUI_IMPL_OPENGL_ES2)
|
|
|
|
#include <SDL_opengles2.h>
|
|
|
|
#else
|
|
|
|
#include <SDL_opengl.h>
|
|
|
|
#endif
|
2024-03-26 18:39:02 -07:00
|
|
|
#include <license.hpp>
|
2023-08-25 14:38:06 -07:00
|
|
|
#include "base85.h"
|
2024-03-23 18:41:26 -07:00
|
|
|
#include "IconFontCppHeaders/IconsForkAwesome.h"
|
|
|
|
#include "imgui/imgui.h"
|
|
|
|
#include "imgui/misc/cpp/imgui_stdlib.h"
|
2024-04-25 11:23:38 -07:00
|
|
|
#include <translation.hpp>
|
2023-08-25 14:38:06 -07:00
|
|
|
#ifdef __EMSCRIPTEN__
|
2024-04-24 09:59:51 -07:00
|
|
|
#include "emscripten_mainloop_stub.h"
|
2023-08-25 14:38:06 -07:00
|
|
|
#endif
|
2024-03-23 18:41:26 -07:00
|
|
|
#include "../../../backend.hpp"
|
2024-04-09 10:15:05 -07:00
|
|
|
#include "ui_backend.hpp"
|
2023-08-25 14:38:06 -07:00
|
|
|
using namespace std::filesystem;
|
|
|
|
using std::string;
|
2024-03-26 18:39:02 -07:00
|
|
|
#define IMGUI_FRONTEND
|
2023-08-25 14:38:06 -07:00
|
|
|
class MainLoop : public RendererBackend {
|
|
|
|
bool show_demo_window = false;
|
|
|
|
FileBrowser fileDialog = FileBrowser(false);
|
|
|
|
std::string userdir;
|
|
|
|
float position = 0.0;
|
2024-03-23 18:41:26 -07:00
|
|
|
float length = 0.0;
|
2023-08-25 14:38:06 -07:00
|
|
|
bool prefs_window = false;
|
|
|
|
bool theme_editor = false;
|
|
|
|
bool about_window = false;
|
2024-10-14 21:27:16 -07:00
|
|
|
bool debug_mode = false;
|
2024-10-18 10:45:22 -07:00
|
|
|
bool property_editor = false;
|
2024-03-26 18:39:02 -07:00
|
|
|
bool restart_needed = false;
|
2023-08-25 14:38:06 -07:00
|
|
|
bool stopped = true;
|
2024-03-23 18:41:26 -07:00
|
|
|
std::vector<UIBackend*> backends;
|
|
|
|
UIBackend *cur_backend;
|
2024-04-09 10:15:05 -07:00
|
|
|
friend class ImGuiUIBackend;
|
|
|
|
std::atomic_bool exit_flag;
|
2024-10-19 10:19:08 -07:00
|
|
|
std::map<std::string, bool> boolean_properties;
|
|
|
|
std::map<std::string, double> double_properties;
|
2024-12-11 12:56:17 -08:00
|
|
|
std::map<std::string, int> int_properties;
|
|
|
|
std::map<std::string, std::string> string_properties;
|
2024-10-19 10:19:08 -07:00
|
|
|
std::vector<Property> properties;
|
2024-04-14 13:25:49 -07:00
|
|
|
std::vector<PlaybackStream> streams;
|
2023-08-25 14:38:06 -07:00
|
|
|
public:
|
2024-03-23 18:41:26 -07:00
|
|
|
Playback *playback;
|
2023-10-16 10:44:25 -07:00
|
|
|
vector<std::string> args;
|
2024-04-24 09:59:51 -07:00
|
|
|
void FileLoaded();
|
2023-10-16 10:44:25 -07:00
|
|
|
void LoadFile(std::string file);
|
2023-08-25 14:38:06 -07:00
|
|
|
void Init() override;
|
|
|
|
void GuiFunction() override;
|
|
|
|
void Deinit() override;
|
2023-10-16 10:44:25 -07:00
|
|
|
void Drop(std::string file) override;
|
2023-08-25 14:38:06 -07:00
|
|
|
MainLoop();
|
2024-04-24 09:59:51 -07:00
|
|
|
};
|