From acb76ffa0f45c5369e103f8868356d333ab2d954 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 11 May 2025 12:22:19 +0100 Subject: Build networks with new interface --- ui/editNetwork.h | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) (limited to 'ui/editNetwork.h') diff --git a/ui/editNetwork.h b/ui/editNetwork.h index 4155534..e155105 100644 --- a/ui/editNetwork.h +++ b/ui/editNetwork.h @@ -1,6 +1,5 @@ #pragma once -#include "game/geoData.h" #include "gameMainSelector.h" #include "worldOverlay.h" #include @@ -13,40 +12,25 @@ class EditNetwork : public GameMainSelector::Component, public WorldOverlay { public: explicit EditNetwork(Network *); - bool click(const SDL_MouseButtonEvent & e, const Ray &) override; - bool move(const SDL_MouseMotionEvent & e, const Ray &) override; - bool handleInput(const SDL_Event & e) override; + bool click(const SDL_MouseButtonEvent &, const Ray &) override; + bool move(const SDL_MouseMotionEvent &, const Ray &) override; + bool handleInput(const SDL_Event &) override; void render(const SceneShader &, const Frustum &) const override; void render(bool & open) override; - using NetworkClickPos = std::variant; - - class Builder { - public: - virtual ~Builder() = default; - virtual void render(const SceneShader & shader, const Frustum &) const; - virtual std::string hint() const = 0; - virtual void click(Network *, const GeoData *, const SDL_MouseButtonEvent &, const Ray &) = 0; - virtual void move(Network *, const GeoData *, const SDL_MouseMotionEvent &, const Ray &) = 0; - - static void setHeightsFor(Network *, const Link::CCollection &, GeoData::SetHeightsOpts = {}); - - using Ptr = std::unique_ptr; - - protected: - SharedCollection candidateLinks; - }; - private: + [[nodiscard]] std::optional resolveRay(const Ray &) const; + Network * network; - Builder::Ptr builder; - Texture blue; + bool continuousMode {false}; + std::optional currentStart; + Link::Collection candidates; }; template class EditNetworkOf : public EditNetwork { public: template - explicit EditNetworkOf(P &&... p) : EditNetwork(gameState->world.findOrCreate(), std::forward

(p)...) + explicit EditNetworkOf(P &&... params) : EditNetwork(gameState->world.findOrCreate(), std::forward

(params)...) { } }; -- cgit v1.2.3