summaryrefslogtreecommitdiff
path: root/ui/editNetwork.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ui/editNetwork.cpp')
-rw-r--r--ui/editNetwork.cpp48
1 files changed, 42 insertions, 6 deletions
diff --git a/ui/editNetwork.cpp b/ui/editNetwork.cpp
index 6cf0eae..a51d7fb 100644
--- a/ui/editNetwork.cpp
+++ b/ui/editNetwork.cpp
@@ -1,17 +1,53 @@
#include "editNetwork.h"
+#include "builders/straight.h"
+#include "text.h"
+#include <game/gamestate.h>
+#include <game/geoData.h>
-void
-EditNetwork::click(const Ray &)
+EditNetwork::EditNetwork(Network * n) :
+ network {n}, builderToolbar {
+ {"ui/icon/network.png", mode.toggle<BuilderStraight>()},
+ }
{
}
-void
-EditNetwork::move(const Ray &)
+EditNetwork::~EditNetwork() = default;
+
+bool
+EditNetwork::click(const SDL_MouseButtonEvent & e, const Ray & ray)
+{
+ if (builder) {
+ builder->click(network, gameState->geoData.get(), e, ray);
+ return true;
+ }
+ return false;
+}
+
+bool
+EditNetwork::move(const SDL_MouseMotionEvent &, const Ray &)
{
+ return false;
}
bool
-EditNetwork::handleMove()
+EditNetwork::handleInput(const SDL_Event & e, const UIComponent::Position & parentPos)
+{
+ return builderToolbar.handleInput(e, parentPos);
+}
+
+void
+EditNetwork::render(const Shader & shader) const
+{
+ if (builder) {
+ builder->render(shader);
+ }
+}
+
+void
+EditNetwork::render(const UIShader & shader, const UIComponent::Position & parentPos) const
{
- return true;
+ if (builder) {
+ Text {builder->hint(), {{50, 10}, {0, 15}}, {1, 1, 0}}.render(shader, parentPos);
+ }
+ builderToolbar.render(shader, parentPos);
}