#pragma once #include "game/geoData.h" #include "gameMainSelector.h" #include "modeHelper.h" #include "toolbar.h" #include "worldOverlay.h" #include #include #include template class Ray; 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, const UIComponent::Position &) override; void render(const SceneShader &) const override; void render(const UIShader & shader, const UIComponent::Position & pos) const override; using NetworkClickPos = std::variant; class Builder { public: virtual ~Builder() = default; virtual void render(const SceneShader & shader) 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: Collection candidateLinks; }; private: Network * network; Builder::Ptr builder; Mode mode {builder}; Toolbar builderToolbar; Texture blue; const Font font; }; template class EditNetworkOf : public EditNetwork { public: template explicit EditNetworkOf(P &&... p) : EditNetwork(gameState->world.findOrCreate(), std::forward

(p)...) { } };