aboutsummaryrefslogtreecommitdiff
path: root/src/hud/hud.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/hud/hud.cpp')
-rw-r--r--src/hud/hud.cpp32
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());
+}