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/editNetwork.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/editNetwork.cpp')
-rw-r--r-- | ui/editNetwork.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/ui/editNetwork.cpp b/ui/editNetwork.cpp index 3ab7059..9f4a186 100644 --- a/ui/editNetwork.cpp +++ b/ui/editNetwork.cpp @@ -4,12 +4,18 @@ #include "text.h" #include <game/gamestate.h> #include <game/geoData.h> +#include <gfx/gl/shader.h> +#include <gfx/models/texture.h> + +constexpr const glm::u8vec4 TRANSPARENT_BLUE {30, 50, 255, 200}; EditNetwork::EditNetwork(Network * n) : - network {n}, builderToolbar { - {"ui/icon/network.png", mode.toggle<BuilderStraight>()}, - {"ui/icon/network.png", mode.toggle<BuilderJoin>()}, - } + network {n}, + builderToolbar { + {"ui/icon/network.png", mode.toggle<BuilderStraight>()}, + {"ui/icon/network.png", mode.toggle<BuilderJoin>()}, + }, + blue {1, 1, &TRANSPARENT_BLUE} { } @@ -26,8 +32,11 @@ EditNetwork::click(const SDL_MouseButtonEvent & e, const Ray & ray) } bool -EditNetwork::move(const SDL_MouseMotionEvent &, const Ray &) +EditNetwork::move(const SDL_MouseMotionEvent & e, const Ray & ray) { + if (builder) { + builder->move(network, gameState->geoData.get(), e, ray); + } return false; } @@ -41,11 +50,19 @@ void EditNetwork::render(const Shader & shader) const { if (builder) { + blue.Bind(); + shader.setModel(Location {}, Shader::Program::StaticPos); builder->render(shader); } } void +EditNetwork::Builder::render(const Shader & shader) const +{ + candidateLinks.apply<const Renderable>(&Renderable::render, shader); +} + +void EditNetwork::render(const UIShader & shader, const UIComponent::Position & parentPos) const { if (builder) { |