#pragma once #include #include "imgui.h" #include "GLFW/glfw3.h" class pixel_shader_drawer; class render_target; class renderer; class texture; class application; extern bool g_is_running; extern bool g_exit_requested; extern application* g_app_instance; struct window_params { std::string title; int width; int height; bool fullscreen; bool borderless; bool resizable; bool minimized; bool maximized; bool hi_dpi; bool always_on_top; }; class CORE_API application { public: application() { g_app_instance = this; } virtual ~application() = default; application(const application&) = delete; application(application&&) = delete; static application* get() { return g_app_instance; } virtual void init(window_params in_window_params, int argc, char** argv); virtual int run(); virtual void shutdown(); virtual void draw_gui() = 0; virtual const char* get_shader_path() = 0; virtual void init_imgui(ImGuiContext* in_context) = 0; [[nodiscard]] std::shared_ptr load_texture(const std::string& path) const; std::shared_ptr create_texture(const unsigned char* data, int width, int height) const; [[nodiscard]] std::shared_ptr create_render_target(int width, int height, texture_format format) const; [[nodiscard]] std::shared_ptr create_pixel_shader_drawer() const; [[nodiscard]] virtual const char* get_entry_model() const = 0; [[nodiscard]] virtual const char* get_draw_ps_vertex_shader_entry() const = 0; // Vertex Shader used for drawing ps [[nodiscard]] renderer* get_renderer() const { return renderer_; } [[nodiscard]] GLFWwindow* get_window() const { return window_; } protected: renderer* renderer_ = nullptr; GLFWwindow* window_ = nullptr; std::shared_ptr async_spdlog_; private: void init_glfw(); void init_imgui(); void destroy_glfw(); void destroy_imgui(); };