From 50c6d68944326c20aa271f238949f7b2136d781c Mon Sep 17 00:00:00 2001 From: MitchellHansen Date: Fri, 17 Mar 2017 00:09:48 -0700 Subject: [PATCH] Switched Utils name back. Converted the current debug text over to ImGui. --- include/Camera.h | 2 +- include/GL_Testing.h | 2 +- include/LightController.h | 2 +- include/LightHandle.h | 2 +- include/Map.h | 2 +- include/{util.cpp => util.hpp} | 0 src/Old_Map.cpp | 2 +- src/Ray.cpp | 2 +- src/main.cpp | 42 +++++++++++++++++++++------------- 9 files changed, 33 insertions(+), 23 deletions(-) rename include/{util.cpp => util.hpp} (100%) diff --git a/include/Camera.h b/include/Camera.h index 740f0ac..cb84706 100644 --- a/include/Camera.h +++ b/include/Camera.h @@ -1,7 +1,7 @@ #pragma once #include #include -#include "util.cpp" +#include "util.hpp" #include "Pub_Sub.h" class Camera : public VrEventSubscriber{ diff --git a/include/GL_Testing.h b/include/GL_Testing.h index c273574..5aeb8aa 100644 --- a/include/GL_Testing.h +++ b/include/GL_Testing.h @@ -1,6 +1,6 @@ #pragma once #include -#include +#include #include #ifdef _WIN32 diff --git a/include/LightController.h b/include/LightController.h index bf524c7..6d7b339 100644 --- a/include/LightController.h +++ b/include/LightController.h @@ -1,7 +1,7 @@ #pragma once #include #include -#include "util.cpp" +#include "util.hpp" #include "Pub_Sub.h" #include "raycaster/RayCaster.h" #include diff --git a/include/LightHandle.h b/include/LightHandle.h index 48c6df8..1846c5a 100644 --- a/include/LightHandle.h +++ b/include/LightHandle.h @@ -1,6 +1,6 @@ #pragma once #include -#include +#include #include #include "Pub_Sub.h" diff --git a/include/Map.h b/include/Map.h index e4c2d5c..e31d00b 100644 --- a/include/Map.h +++ b/include/Map.h @@ -8,7 +8,7 @@ #include #include #include -#include "util.cpp" +#include "util.hpp" #include #include #include diff --git a/include/util.cpp b/include/util.hpp similarity index 100% rename from include/util.cpp rename to include/util.hpp diff --git a/src/Old_Map.cpp b/src/Old_Map.cpp index 9ff9b9e..4d383a5 100644 --- a/src/Old_Map.cpp +++ b/src/Old_Map.cpp @@ -1,7 +1,7 @@ #include #include #include -#include "util.cpp" +#include "util.hpp" #include #include diff --git a/src/Ray.cpp b/src/Ray.cpp index 31820bc..1709da7 100644 --- a/src/Ray.cpp +++ b/src/Ray.cpp @@ -2,7 +2,7 @@ #include #include "Map.h" #include -#include "util.cpp" +#include "util.hpp" Ray::Ray( Map *map, diff --git a/src/main.cpp b/src/main.cpp index 32077ec..9968a84 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,7 +23,7 @@ #endif #pragma once -#include "util.cpp" +#include "util.hpp" #include #include #include @@ -104,6 +104,7 @@ int main() { sf::RenderWindow window(sf::VideoMode(WINDOW_X, WINDOW_Y), "SFML"); window.setMouseCursorVisible(false); window.setKeyRepeatEnabled(false); + window.setFramerateLimit(60); ImGui::SFML::Init(window); window.resetGLStates(); @@ -168,14 +169,6 @@ int main() { // ========== DEBUG ========== fps_counter fps; - fps.set_position(sf::Vector2f(WINDOW_X - 200, WINDOW_Y - 100)); - - sf::Vector2f *dp = camera->get_direction_pointer(); - debug_text cam_text_x(1, 30, &dp->x, "incli: "); - debug_text cam_text_y(2, 30, &dp->y, "asmth: "); - debug_text cam_text_pos_x(3, 30, &camera->get_position_pointer()->x, "x: "); - debug_text cam_text_pos_y(4, 30, &camera->get_position_pointer()->y, "y: "); - debug_text cam_text_pos_z(5, 30, &camera->get_position_pointer()->z, "z: "); // =========================== Input input_handler; @@ -246,23 +239,40 @@ int main() { // Run the raycast raycaster->compute(); - window.clear(sf::Color::Black); - raycaster->draw(&window); // Give the frame counter the frame time and draw the average frame time fps.frame(delta_time); fps.draw(); - cam_text_x.draw(&window); - cam_text_y.draw(&window); + ImGui::Begin("Camera"); + + ImGui::Columns(2); + + ImGui::Text("Camera Inclination"); + ImGui::Text("Camera Azimuth"); + ImGui::Text("Camera Pos_X"); + ImGui::Text("Camera Poz_Y"); + ImGui::Text("Camera Poz_Z"); + + ImGui::NextColumn(); + + sf::Vector2f dir = camera->get_direction(); + sf::Vector3f pos = camera->get_position(); - cam_text_pos_x.draw(&window); - cam_text_pos_y.draw(&window); - cam_text_pos_z.draw(&window); + ImGui::Text(std::to_string(dir.x).c_str()); + ImGui::Text(std::to_string(dir.y).c_str()); + ImGui::Text(std::to_string(pos.x).c_str()); + ImGui::Text(std::to_string(pos.y).c_str()); + ImGui::Text(std::to_string(pos.z).c_str()); + + ImGui::End(); ImGui::Render(); + + + window.draw(sf::CircleShape(0)); window.display(); }