looper/backends/ui/imgui/main.h

66 lines
1.6 KiB
C
Raw Normal View History

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>
#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"
#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
#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;
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-03-26 18:39:02 -07:00
bool restart_needed = false;
2023-08-25 14:38:06 -07:00
bool stopped = true;
std::vector<UIBackend*> backends;
UIBackend *cur_backend;
2024-04-09 10:15:05 -07:00
friend class ImGuiUIBackend;
std::atomic_bool exit_flag;
2024-04-14 13:25:49 -07:00
std::vector<PlaybackStream> streams;
2023-08-25 14:38:06 -07:00
public:
Playback *playback;
vector<std::string> args;
2024-04-24 09:59:51 -07:00
void FileLoaded();
void LoadFile(std::string file);
2023-08-25 14:38:06 -07:00
void Init() override;
void GuiFunction() override;
void Deinit() override;
void Drop(std::string file) override;
2023-08-25 14:38:06 -07:00
MainLoop();
2024-04-24 09:59:51 -07:00
};