1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#include "editNetwork.h"
#include "builders/straight.h"
#include "text.h"
#include <game/gamestate.h>
#include <game/geoData.h>
EditNetwork::EditNetwork(Network * n) :
network {n}, builderToolbar {
{"ui/icon/network.png", mode.toggle<BuilderStraight>()},
}
{
}
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::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
{
if (builder) {
Text {builder->hint(), {{50, 10}, {0, 15}}, {1, 1, 0}}.render(shader, parentPos);
}
builderToolbar.render(shader, parentPos);
}
|