diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-09-30 18:00:09 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2018-01-13 03:39:32 +0100 |
commit | c149d9ac2492cecbd1ba336f231157f69413942b (patch) | |
tree | 9aa071b54b9e34639e8e39e15e48cc6773956aa7 /src/Render.cpp | |
parent | 2017-09-24 (diff) | |
download | AltCraft-c149d9ac2492cecbd1ba336f231157f69413942b.tar AltCraft-c149d9ac2492cecbd1ba336f231157f69413942b.tar.gz AltCraft-c149d9ac2492cecbd1ba336f231157f69413942b.tar.bz2 AltCraft-c149d9ac2492cecbd1ba336f231157f69413942b.tar.lz AltCraft-c149d9ac2492cecbd1ba336f231157f69413942b.tar.xz AltCraft-c149d9ac2492cecbd1ba336f231157f69413942b.tar.zst AltCraft-c149d9ac2492cecbd1ba336f231157f69413942b.zip |
Diffstat (limited to 'src/Render.cpp')
-rw-r--r-- | src/Render.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/Render.cpp b/src/Render.cpp index ffa219a..c607a2d 100644 --- a/src/Render.cpp +++ b/src/Render.cpp @@ -9,7 +9,7 @@ #include <imgui.h> #include "imgui_impl_sdl_gl3.h" -Render::Render(unsigned int windowWidth, unsigned int windowHeight, std::string windowTitle) : timer(std::chrono::milliseconds(0)) { +Render::Render(unsigned int windowWidth, unsigned int windowHeight, std::string windowTitle) : timer(std::chrono::milliseconds(16)) { InitSfml(windowWidth, windowHeight, windowTitle); glCheckError(); InitGlew(); @@ -297,12 +297,13 @@ void Render::RenderGui() { ImGui::Separator(); ImGui::Text("State: %s", stateString.c_str()); ImGui::Text("FPS: %.1f (%.3fms)", ImGui::GetIO().Framerate, 1000.0f / ImGui::GetIO().Framerate); - float gameTime = DebugInfo::gameThreadTime / 100.0f; - ImGui::Text("TPS: %.1f (%.2fms)", 1000.0f/gameTime, gameTime); - ImGui::Text("Sections loaded: %d", (int)DebugInfo::totalSections); - ImGui::Text("SectionsRenderer: %d (%d)", (int)DebugInfo::renderSections, (int)DebugInfo::readyRenderer); + float gameTime = DebugInfo::gameThreadTime / 100.0f; if (world) { - ImGui::Text("Player pos: %.1f %.1f %.1f", world->GameStatePtr()->g_PlayerX, world->GameStatePtr()->g_PlayerY, world->GameStatePtr()->g_PlayerZ); + ImGui::Text("TPS: %.1f (%.2fms)", 1000.0f / gameTime, gameTime); + ImGui::Text("Sections loaded: %d", (int)DebugInfo::totalSections); + ImGui::Text("SectionsRenderer: %d (%d)", (int)DebugInfo::renderSections, (int)DebugInfo::readyRenderer); + ImGui::Text("Player pos: %.1f %.1f %.1f OnGround=%d", world->GameStatePtr()->player->pos.x, world->GameStatePtr()->player->pos.y, world->GameStatePtr()->player->pos.z,world->GameStatePtr()->player->onGround); + ImGui::Text("Player vel: %.1f %.1f %.1f", world->GameStatePtr()->player->vel.x, world->GameStatePtr()->player->vel.y, world->GameStatePtr()->player->vel.z); ImGui::Text("Player health: %.1f/%.1f", world->GameStatePtr()->g_PlayerHealth, 20.0f); } ImGui::End(); @@ -431,6 +432,9 @@ void Render::RenderGui() { static float sense = sensetivity; ImGui::SliderFloat("Sensetivity", &sense, 0.01f, 1.0f); + static float frameTime = 16.0f; + ImGui::SliderFloat("Frame time", &frameTime, 0.0f, 32.0f); + static bool wireframe = isWireframe; ImGui::Checkbox("Wireframe", &wireframe); @@ -445,6 +449,7 @@ void Render::RenderGui() { sensetivity = sense; isWireframe = wireframe; + timer.SetDelayLength(std::chrono::duration<double,std::milli>(frameTime)); } ImGui::Separator(); |