diff options
author | Aki <please@ignore.pl> | 2023-02-17 00:11:21 +0100 |
---|---|---|
committer | Aki <please@ignore.pl> | 2023-02-17 00:11:21 +0100 |
commit | 69e4074e471bc7e2dcf285fb253bc70d0c8ffbf5 (patch) | |
tree | 3a054dd349715c123427d870fac427e4261cb862 /kurator/src/Battle.cpp | |
parent | c4fce4331d5c80c3e97221eb30070f760838544d (diff) | |
download | kurator-69e4074e471bc7e2dcf285fb253bc70d0c8ffbf5.zip kurator-69e4074e471bc7e2dcf285fb253bc70d0c8ffbf5.tar.gz kurator-69e4074e471bc7e2dcf285fb253bc70d0c8ffbf5.tar.bz2 |
Extracted projectile lines animations to own compile unit
Diffstat (limited to 'kurator/src/Battle.cpp')
-rw-r--r-- | kurator/src/Battle.cpp | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/kurator/src/Battle.cpp b/kurator/src/Battle.cpp index 0918e30..9df0b01 100644 --- a/kurator/src/Battle.cpp +++ b/kurator/src/Battle.cpp @@ -19,6 +19,7 @@ #include "components.h" #include "Grid.h" +#include "lines.h" #include "markers.h" #include "Pause.h" #include "PopupEmitter.h" @@ -78,7 +79,6 @@ time_controls(const char* id, float& time_factor) static void progress_timers(sim::State& ctx); static void move_ui_pops(sim::State& ctx); static void blink_crosses(sim::State& ctx); -static void animate_lines(sim::State& ctx); void @@ -149,17 +149,7 @@ blink_crosses(sim::State& ctx) } -void -animate_lines(sim::State& ctx) -{ - auto lines = ctx.registry.view<Line>(); - for (auto&& [entity, line] : lines.each()) - line.position += (1.0 + line.hlength) / line.duration * ctx.clock.dt; -} - - static void draw_crosses(const sim::State& ctx); -static void draw_lines(const sim::State& ctx); static void draw_pops(const sim::State& ctx); @@ -201,21 +191,6 @@ draw_crosses(const sim::State& ctx) void -draw_lines(const sim::State& ctx) -{ - auto lines = ctx.registry.view<Line>(); - for (const auto& [entity, line] : lines.each()) { - const auto diff = line.end - line.start; - const auto fstart = line.position - line.hlength; - const auto fend = line.position + line.hlength; - const auto start = ctx.camera.to_screen(line.start + diff.scale(fstart > 0.0 ? fstart : 0.0)); - const auto end = ctx.camera.to_screen(line.start + diff.scale(fend > 1.0 ? 1.0 : fend)); - DrawLine(start.x, start.y, end.x, end.y, line.color); - } -} - - -void draw_pops(const sim::State& ctx) { auto pops = ctx.registry.view<CenteredText, sim::Transform, UIOffset>(); |