Switched Utils name back. Converted the current debug text over to ImGui.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <SFML/System/Vector3.hpp>
|
#include <SFML/System/Vector3.hpp>
|
||||||
#include <SFML/System/Vector2.hpp>
|
#include <SFML/System/Vector2.hpp>
|
||||||
#include "util.cpp"
|
#include "util.hpp"
|
||||||
#include "Pub_Sub.h"
|
#include "Pub_Sub.h"
|
||||||
|
|
||||||
class Camera : public VrEventSubscriber{
|
class Camera : public VrEventSubscriber{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <util.cpp>
|
#include <util.hpp>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <SFML/System/Vector3.hpp>
|
#include <SFML/System/Vector3.hpp>
|
||||||
#include <SFML/System/Vector2.hpp>
|
#include <SFML/System/Vector2.hpp>
|
||||||
#include "util.cpp"
|
#include "util.hpp"
|
||||||
#include "Pub_Sub.h"
|
#include "Pub_Sub.h"
|
||||||
#include "raycaster/RayCaster.h"
|
#include "raycaster/RayCaster.h"
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <SFML/Graphics.hpp>
|
#include <SFML/Graphics.hpp>
|
||||||
#include <util.cpp>
|
#include <util.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "Pub_Sub.h"
|
#include "Pub_Sub.h"
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "util.cpp"
|
#include "util.hpp"
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <SFML/System/Vector3.hpp>
|
#include <SFML/System/Vector3.hpp>
|
||||||
#include <SFML/System/Vector2.hpp>
|
#include <SFML/System/Vector2.hpp>
|
||||||
#include "util.cpp"
|
#include "util.hpp"
|
||||||
#include <Old_Map.h>
|
#include <Old_Map.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "Map.h"
|
#include "Map.h"
|
||||||
#include <Ray.h>
|
#include <Ray.h>
|
||||||
#include "util.cpp"
|
#include "util.hpp"
|
||||||
|
|
||||||
Ray::Ray(
|
Ray::Ray(
|
||||||
Map *map,
|
Map *map,
|
||||||
|
|||||||
42
src/main.cpp
42
src/main.cpp
@@ -23,7 +23,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "util.cpp"
|
#include "util.hpp"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <SFML/Graphics.hpp>
|
#include <SFML/Graphics.hpp>
|
||||||
@@ -104,6 +104,7 @@ int main() {
|
|||||||
sf::RenderWindow window(sf::VideoMode(WINDOW_X, WINDOW_Y), "SFML");
|
sf::RenderWindow window(sf::VideoMode(WINDOW_X, WINDOW_Y), "SFML");
|
||||||
window.setMouseCursorVisible(false);
|
window.setMouseCursorVisible(false);
|
||||||
window.setKeyRepeatEnabled(false);
|
window.setKeyRepeatEnabled(false);
|
||||||
|
window.setFramerateLimit(60);
|
||||||
|
|
||||||
ImGui::SFML::Init(window);
|
ImGui::SFML::Init(window);
|
||||||
window.resetGLStates();
|
window.resetGLStates();
|
||||||
@@ -168,14 +169,6 @@ int main() {
|
|||||||
|
|
||||||
// ========== DEBUG ==========
|
// ========== DEBUG ==========
|
||||||
fps_counter fps;
|
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;
|
Input input_handler;
|
||||||
@@ -246,23 +239,40 @@ int main() {
|
|||||||
// Run the raycast
|
// Run the raycast
|
||||||
raycaster->compute();
|
raycaster->compute();
|
||||||
|
|
||||||
|
|
||||||
window.clear(sf::Color::Black);
|
window.clear(sf::Color::Black);
|
||||||
|
|
||||||
raycaster->draw(&window);
|
raycaster->draw(&window);
|
||||||
|
|
||||||
// Give the frame counter the frame time and draw the average frame time
|
// Give the frame counter the frame time and draw the average frame time
|
||||||
fps.frame(delta_time);
|
fps.frame(delta_time);
|
||||||
fps.draw();
|
fps.draw();
|
||||||
|
|
||||||
cam_text_x.draw(&window);
|
ImGui::Begin("Camera");
|
||||||
cam_text_y.draw(&window);
|
|
||||||
|
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");
|
||||||
|
|
||||||
cam_text_pos_x.draw(&window);
|
ImGui::NextColumn();
|
||||||
cam_text_pos_y.draw(&window);
|
|
||||||
cam_text_pos_z.draw(&window);
|
sf::Vector2f dir = camera->get_direction();
|
||||||
|
sf::Vector3f pos = camera->get_position();
|
||||||
|
|
||||||
|
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();
|
ImGui::Render();
|
||||||
|
|
||||||
|
|
||||||
|
window.draw(sf::CircleShape(0));
|
||||||
window.display();
|
window.display();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user