summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kurator/CMakeLists.txt1
-rw-r--r--kurator/src/Battle.cpp3
-rw-r--r--kurator/src/colors.cpp28
-rw-r--r--kurator/src/colors.h13
4 files changed, 44 insertions, 1 deletions
diff --git a/kurator/CMakeLists.txt b/kurator/CMakeLists.txt
index 0dc7720..61b348c 100644
--- a/kurator/CMakeLists.txt
+++ b/kurator/CMakeLists.txt
@@ -2,6 +2,7 @@ project(kurator)
add_executable(
${PROJECT_NAME}
src/Battle.cpp
+ src/colors.cpp
src/main.cpp
src/Session.cpp
src/Skybox.cpp
diff --git a/kurator/src/Battle.cpp b/kurator/src/Battle.cpp
index 3f7d39e..7bb4e7d 100644
--- a/kurator/src/Battle.cpp
+++ b/kurator/src/Battle.cpp
@@ -15,6 +15,7 @@
#include <kurator/sim/Point.h>
#include <kurator/universe/ShipType.h>
+#include "colors.h"
#include "components.h"
#include "Session.h"
#include "Title.h"
@@ -32,7 +33,7 @@ Battle::Battle(std::shared_ptr<Session> _session) :
auto& registry = battle->registry();
auto ships = registry.view<sim::Team, universe::ShipType>();
for (const auto& [entity, team, type] : ships.each())
- registry.emplace<Marker>(entity, 5.0, team.id ? GREEN : RED, type.name);
+ registry.emplace<Marker>(entity, 5.0, team_color(team.id), type.name);
}
diff --git a/kurator/src/colors.cpp b/kurator/src/colors.cpp
new file mode 100644
index 0000000..b3fc82a
--- /dev/null
+++ b/kurator/src/colors.cpp
@@ -0,0 +1,28 @@
+#include "colors.h"
+
+#include <raylib.h>
+
+
+namespace kurator
+{
+
+
+Color
+team_color(const int team)
+{
+ switch (team) {
+ case 0:
+ return GREEN;
+ case 1:
+ return RED;
+ case 2:
+ return YELLOW;
+ case 3:
+ return PURPLE;
+ default:
+ return GRAY;
+ }
+}
+
+
+} // namespace kurator
diff --git a/kurator/src/colors.h b/kurator/src/colors.h
new file mode 100644
index 0000000..d477791
--- /dev/null
+++ b/kurator/src/colors.h
@@ -0,0 +1,13 @@
+#pragma once
+
+#include <raylib.h>
+
+
+namespace kurator
+{
+
+
+auto team_color(int team) -> Color;
+
+
+} // namespace kurator