terravisor/include/interface.h

29 lines
800 B
C++

#ifndef INTERFACE_H_
#define INTERFACE_H_
#include <GLFW/glfw3.h>
#include <imgui.h>
#include <string>
#include <vector>
#include <functional>
struct Window {
std::string name;
ImVec2 size;
ImVec2 position;
bool isOpen = true;
std::function<void()> renderContent;
Window(const std::string& name, std::function<void()> renderFunc)
: name(name), size(ImVec2(512, 512)), position(ImVec2(0, 0)), renderContent(renderFunc) {}
};
namespace Interface {
void ApplyUIScaling(GLFWwindow* window);
void AddWindow(std::vector<Window>& windows, const std::string& name, std::function<void()> renderFunc);
Window* GetWindowByName(std::vector<Window>& windows, const std::string& name);
void RenderWindows(std::vector<Window>& windows);
}
#endif // INTERFACE_H_