Horizon
Loading...
Searching...
No Matches
tool_add_vertex.hpp
1#pragma once
2#include "common/polygon.hpp"
3#include "tool_helper_plane.hpp"
4
5namespace horizon {
6
7class ToolAddVertex : public virtual ToolBase, public ToolHelperPlane {
8public:
9 using ToolBase::ToolBase;
10 ToolResponse begin(const ToolArgs &args) override;
11 ToolResponse update(const ToolArgs &args) override;
12 bool can_begin() override;
13 bool is_specific() override
14 {
15 return true;
16 }
17 std::set<InToolActionID> get_actions() const override
18 {
19 using I = InToolActionID;
20 return {
21 I::LMB,
22 I::CANCEL,
23 I::RMB,
24 I::FLIP_DIRECTION,
25 };
26 }
27
28private:
29 Polygon *poly = nullptr;
30 Polygon::Vertex *vertex = nullptr;
31 int vertex_index = 0;
32 unsigned int n_vertices_placed = 0;
33 bool flip_direction = false;
34 void update_tip();
35 void add_vertex(const Coordi &c);
36};
37} // namespace horizon
Definition tool_add_vertex.hpp:7
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
Definition tool_add_vertex.cpp:27
bool can_begin() override
Definition tool_add_vertex.cpp:8
bool is_specific() override
Definition tool_add_vertex.hpp:13
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.
Definition tool_add_vertex.cpp:59
This is what a Tool receives when the user did something.
Definition tool_pub.hpp:23
Common interface for all Tools.
Definition tool_pub.hpp:94
Definition tool_helper_plane.hpp:5
To signal back to the core what the Tool did, a Tool returns a ToolResponse.
Definition tool_pub.hpp:40