summaryrefslogtreecommitdiffhomepage
path: root/View.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'View.cpp')
-rw-r--r--View.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/View.cpp b/View.cpp
index 3aba502..c4b0e5a 100644
--- a/View.cpp
+++ b/View.cpp
@@ -7,13 +7,14 @@
#include <raylib.h>
+#include "Label.h"
#include "Source.h"
View::View(std::unique_ptr<Source> source) :
m_camera {},
m_source {std::move(source)},
- m_projected {},
+ m_labels {},
m_grid {0}
{
m_camera.position = Vector3{10.0f, 10.0f, 10.0f};
@@ -38,8 +39,8 @@ View::update(const float dt)
const int height = GetScreenHeight();
const int width = GetScreenWidth();
const auto killmails = grids.at(m_grid).killmails;
- m_projected.clear();
- m_projected.reserve(killmails.size());
+ m_labels.clear();
+ m_labels.reserve(killmails.size());
for (const auto& km : killmails) {
const auto pos = GetWorldToScreen(km.position, m_camera);
const float depth =
@@ -50,9 +51,9 @@ View::update(const float dt)
if (0 > pos.x || width < pos.x || 0 > pos.y || height < pos.y)
continue;
const auto base = GetWorldToScreen({km.position.x, 0.0f, km.position.z}, m_camera);
- m_projected.push_back(Projected{pos, base, depth});
+ m_labels.push_back(Label{pos, base, depth});
}
- std::sort(m_projected.begin(), m_projected.end(), [](auto& a, auto& b){ return a.depth > b.depth; });
+ std::sort(m_labels.begin(), m_labels.end(), [](auto& a, auto& b){ return a.depth > b.depth; });
}
@@ -64,14 +65,14 @@ View::draw() const
BeginMode3D(m_camera);
DrawGrid(12, 1.0f);
EndMode3D();
- for (const auto& point : m_projected) {
+ for (const auto& point : m_labels) {
DrawLine(point.base.x, point.base.y, point.pos.x, point.pos.y, LIGHTGRAY);
DrawCircle(point.pos.x, point.pos.y, 3, RED);
}
DrawFPS(5, 5);
int y = 25;
const int height = GetScreenHeight();
- for (const auto& point : m_projected) {
+ for (const auto& point : m_labels) {
DrawText(TextFormat("%5.1f x %5.1f x %5.1f", point.pos.x, point.pos.y, point.depth), 5, y, 10, DARKGRAY);
y += 10;
if (y > height)