1
0
Fork 0
Univerxel/src/client/render/gl/UI.cpp

33 lines
840 B
C++

#include "UI.hpp"
#include "../../Window.hpp"
#include <GL/gl3w.h>
#include <imgui_impl_glfw.h>
#include <imgui_impl_opengl3.h>
#include "Texture.hpp"
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::CreatePtr("ui/Aim", 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);
}
void UI::render() {
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
}
void UI::Load(Window& w) {
UI::sInstance = new UI(w.getPtr());
}