diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-10-14 18:15:53 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-10-14 18:15:53 +0100 |
commit | 0d59b73de4e51a3a5b3c680f3dca97c2b942cc09 (patch) | |
tree | a4db615632e0d0ce7f4edb5cf57e60d39198bc87 /ui/builders/straight.cpp | |
parent | Network candidate links (diff) | |
download | ilt-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/straight.cpp')
-rw-r--r-- | ui/builders/straight.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/ui/builders/straight.cpp b/ui/builders/straight.cpp index 7024746..477b40d 100644 --- a/ui/builders/straight.cpp +++ b/ui/builders/straight.cpp @@ -1,11 +1,6 @@ #include "straight.h" #include <game/geoData.h> -void -BuilderStraight::render(const Shader &) const -{ -} - std::string BuilderStraight::hint() const { @@ -16,6 +11,19 @@ BuilderStraight::hint() const } void +BuilderStraight::move(Network * network, const GeoData * geoData, const SDL_MouseMotionEvent &, const Ray & ray) +{ + if (p1) { + if (const auto p = geoData->intersectRay(ray)) { + candidateLinks.objects = network->candidateStraight(*p1, *p); + } + else { + candidateLinks.removeAll(); + } + } +} + +void BuilderStraight::click(Network * network, const GeoData * geoData, const SDL_MouseButtonEvent & e, const Ray & ray) { switch (e.button) { @@ -23,12 +31,14 @@ BuilderStraight::click(Network * network, const GeoData * geoData, const SDL_Mou if (const auto p = geoData->intersectRay(ray)) { if (p1) { create(network, *p1, *p); + candidateLinks.removeAll(); } p1 = *p; } return; case SDL_BUTTON_MIDDLE: p1.reset(); + candidateLinks.removeAll(); return; } } |