summaryrefslogtreecommitdiff
path: root/ui/builders/join.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-10-14 18:15:53 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2022-10-14 18:15:53 +0100
commit0d59b73de4e51a3a5b3c680f3dca97c2b942cc09 (patch)
treea4db615632e0d0ce7f4edb5cf57e60d39198bc87 /ui/builders/join.cpp
parentNetwork candidate links (diff)
downloadilt-0d59b73de4e51a3a5b3c680f3dca97c2b942cc09.tar.bz2
ilt-0d59b73de4e51a3a5b3c680f3dca97c2b942cc09.tar.xz
ilt-0d59b73de4e51a3a5b3c680f3dca97c2b942cc09.zip
Builders manage a collection of candidate links rendered by the base builder
Diffstat (limited to 'ui/builders/join.cpp')
-rw-r--r--ui/builders/join.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/ui/builders/join.cpp b/ui/builders/join.cpp
index cc2ca2d..caa635f 100644
--- a/ui/builders/join.cpp
+++ b/ui/builders/join.cpp
@@ -1,11 +1,6 @@
#include "join.h"
#include <game/geoData.h>
-void
-BuilderJoin::render(const Shader &) const
-{
-}
-
std::string
BuilderJoin::hint() const
{
@@ -16,6 +11,19 @@ BuilderJoin::hint() const
}
void
+BuilderJoin::move(Network * network, const GeoData *, const SDL_MouseMotionEvent &, const Ray & ray)
+{
+ if (p1) {
+ if (const auto p = network->intersectRayNodes(ray)) {
+ candidateLinks.objects = network->candidateJoins(p1->pos, p->pos);
+ }
+ else {
+ candidateLinks.removeAll();
+ }
+ }
+}
+
+void
BuilderJoin::click(Network * network, const GeoData *, const SDL_MouseButtonEvent & e, const Ray & ray)
{
switch (e.button) {
@@ -24,6 +32,7 @@ BuilderJoin::click(Network * network, const GeoData *, const SDL_MouseButtonEven
if (p1) {
create(network, p1, p);
p1.reset();
+ candidateLinks.removeAll();
}
else {
p1 = p;