summaryrefslogtreecommitdiffhomepage
path: root/View.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'View.cpp')
-rw-r--r--View.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/View.cpp b/View.cpp
index 50e5549..3360808 100644
--- a/View.cpp
+++ b/View.cpp
@@ -7,18 +7,22 @@
#include <raylib.h>
+#include "Globals.h"
#include "Grid.h"
#include "Label.h"
#include "Timeline.h"
#include "Utils.h"
+const Color BACKGROUND {8, 8, 50, 255};
+const Color LINE {240, 240, 240, 160};
+
+
View::View(std::vector<Grid> grids, Timeline timeline) :
m_camera {},
m_grids {grids},
m_labels {},
m_grid {0},
- m_texture {LoadTexture("resources/wreck.png")},
m_active {nullptr},
m_timeline {timeline}
{
@@ -33,7 +37,6 @@ View::View(std::vector<Grid> grids, Timeline timeline) :
View::~View()
{
- UnloadTexture(m_texture);
}
@@ -62,7 +65,8 @@ View::update(const float dt)
const auto depth = dist(m_camera.position, wreck.position);
const auto length = dist(pos, base);
const bool hover = 8.0f > dist(mouse, pos);
- m_labels.push_back(Label{pos, base, depth, length, hover, std::ref(wreck)});
+ m_labels.push_back(
+ Label{pos, base, depth, length, hover, std::ref(wreck), app.icons.find(wreck.killmail.ship)});
}
std::sort(m_labels.begin(), m_labels.end(), [](auto& a, auto& b){ return a.depth > b.depth; });
m_active = nullptr;
@@ -81,12 +85,12 @@ void
View::draw() const
{
BeginDrawing();
- ClearBackground(RAYWHITE);
+ ClearBackground(BACKGROUND);
BeginMode3D(m_camera);
DrawGrid(12, 1.0f);
EndMode3D();
for (const auto& point : m_labels) {
- Color line = point.hover ? ORANGE : GRAY;
+ Color line = point.hover ? ORANGE : LINE;
Color icon = point.hover ? ORANGE : WHITE;
if (!point.hover && point.wreck.get().time > m_timeline.current()) {
line.a = 20;
@@ -94,7 +98,7 @@ View::draw() const
}
if (point.length > 8)
DrawLine(point.base.x, point.base.y, point.pos.x, point.pos.y, line);
- DrawTexture(m_texture, point.pos.x - 8, point.pos.y - 8, icon);
+ DrawTexture(point.texture, point.pos.x - 8, point.pos.y - 8, icon);
}
DrawFPS(5, 5);
DrawText(TextFormat("%d", m_labels.size()), 5, 25, 20, DARKGRAY);