32 lines
947 B
C++
32 lines
947 B
C++
#pragma once
|
|
#include "GLFW/glfw3.h"
|
|
#include "misc/singleton/singleton.h"
|
|
#include <map>
|
|
#include <memory>
|
|
#include <thread>
|
|
|
|
class plugin_host;
|
|
|
|
class CORE_API window_manager : public singleton_t<window_manager> {
|
|
public:
|
|
void init(singleton_initliazer& initliazer) override;
|
|
void release(singleton_release_guard& release_guard) override;
|
|
|
|
std::shared_ptr<GLFWwindow> create_window(int width, int height, const char* title);
|
|
void* create_plugin_window(plugin_host* host);
|
|
void destroy_plugin_window(plugin_host* host);
|
|
const char* get_name() override { return "window_manager"; }
|
|
void update();
|
|
private:
|
|
std::vector<std::weak_ptr<GLFWwindow>> windows_;
|
|
|
|
struct host_info {
|
|
int32_t x;
|
|
int32_t y;
|
|
std::shared_ptr<GLFWwindow> window;
|
|
};
|
|
void on_host_window_close(GLFWwindow* window);
|
|
std::map<plugin_host*, host_info> host_infos_;
|
|
};
|
|
|
|
DEFINE_SINGLETON_INSTANCE(window_manager) |