#include "UI.hpp"

#include "../../Window.hpp"
#include <GL/gl3w.h>
#include <imgui_impl_glfw.h>
#include <imgui_impl_opengl3.h>
#include <string>

using namespace render::gl;

UI::UI(GLFWwindow *window): render::UI() {
    // Setup Platform/Renderer bindings
    ImGui_ImplGlfw_InitForOpenGL(window, true);
    ImGui_ImplOpenGL3_Init("#version 130");
    aim = Texture::LoadFromFile("content/textures/ui/Aim.dds", {false, false, Texture::Wrap::MIRRORED_REPEAT, 0, false});
}
UI::~UI() {
    ImGui_ImplGlfw_Shutdown();
    ImGui_ImplOpenGL3_Shutdown();
}

UI::Actions UI::draw(config::client::options &o, state::state &s, const state::reports &r) {
    ImGui_ImplOpenGL3_NewFrame();
    ImGui_ImplGlfw_NewFrame();
    return render::UI::draw(o, s, r, aim->getId());
}
void UI::render() {
    ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
}

void UI::Load(Window& w) {
    UI::sInstance = new UI(w.getPtr());
}