diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2020-07-07 06:40:50 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2020-07-07 06:40:50 +0200 |
| commit | aac94e911b0bab8db5cdb5efb8d4d8f2d4072610 (patch) | |
| tree | a52a7a493076bba6e3ec5a7f9442bb3e77a5e16e /src/hud/hud.cpp | |
| parent | 29339928d7a05ca11786885643631206a978655e (diff) | |
Add code
Diffstat (limited to 'src/hud/hud.cpp')
| -rw-r--r-- | src/hud/hud.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/hud/hud.cpp b/src/hud/hud.cpp new file mode 100644 index 0000000..fb9f65e --- /dev/null +++ b/src/hud/hud.cpp @@ -0,0 +1,32 @@ +#include "hud.hpp" + +HUD::HUD(GLFWwindow* window): + m_ImGuiContext(ImGui::CreateContext()), + m_POpen(true) +{ + ImGui::SetCurrentContext(m_ImGuiContext); + ImGui_ImplGlfw_InitForOpenGL(window, true); + ImGui_ImplOpenGL3_Init("#version 330"); + m_Context=new HUDContext(); +} + +HUD::~HUD(){ + delete(m_Context); +} + +void HUD::Render(){ + ImGui_ImplOpenGL3_NewFrame(); + ImGui_ImplGlfw_NewFrame(); + ImGui::NewFrame(); + + ImGui::SetNextWindowPos(ImVec2(0,0)); + ImGui::SetNextWindowBgAlpha(0.6f); + ImGui::Begin("HUD",&m_POpen,ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav); + ImGui::Text("FPS: %d",m_Context->fps); + ImGui::Text("Current Shader: %s",m_Context->current_shader.c_str()); + ImGui::Text("Simulation Time: %llds",m_Context->time); + ImGui::End(); + + ImGui::Render(); + ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); +} |
