More GUI code changes (broken build)
This commit is contained in:
parent
644bb85d99
commit
3566b7e563
28 changed files with 178 additions and 120 deletions
|
|
@ -8,6 +8,12 @@
|
|||
#include <Helpers/NetworkingObjects/NetObjGenericSerializedClass.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
#include "../../GUIStuff/ElementHelpers/TextLabelHelpers.hpp"
|
||||
#include "../../GUIStuff/ElementHelpers/LayoutHelpers.hpp"
|
||||
#include "../../GUIStuff/ElementHelpers/TextBoxHelpers.hpp"
|
||||
#include "../../GUIStuff/ElementHelpers/CheckBoxHelpers.hpp"
|
||||
#include "../../GUIStuff/Elements/DropDown.hpp"
|
||||
|
||||
using namespace NetworkingObjects;
|
||||
|
||||
GridModifyTool::GridModifyTool(DrawingProgram& initDrawP):
|
||||
|
|
@ -108,15 +114,18 @@ void GridModifyTool::input_mouse_motion_callback(const InputManager::MouseMotion
|
|||
}
|
||||
|
||||
void GridModifyTool::gui_toolbox() {
|
||||
using namespace GUIStuff;
|
||||
using namespace ElementHelpers;
|
||||
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
t.gui.push_id("Grid modify tool");
|
||||
t.gui.text_label_centered("Edit Grid");
|
||||
text_label_centered(t.gui, "Edit Grid");
|
||||
NetworkingObjects::NetObjTemporaryPtr<WorldGrid> gLock = grid.lock();
|
||||
if(gLock) {
|
||||
WorldGrid& g = *gLock;
|
||||
t.gui.input_text_field("grid name", "Name", &g.name);
|
||||
t.gui.checkbox_field("Visible", "Visible", &g.visible);
|
||||
t.gui.checkbox_field("Display in Front", "Display in front of canvas", &g.displayInFront);
|
||||
input_text_field(t.gui, "grid name", "Name", &g.name);
|
||||
checkbox_boolean_field(t.gui, "Visible", "Visible", &g.visible);
|
||||
checkbox_boolean_field(t.gui, "Display in Front", "Display in front of canvas", &g.displayInFront);
|
||||
size_t typeSelected = static_cast<size_t>(g.gridType);
|
||||
std::vector<std::string> listOfGridTypes = {
|
||||
"Circle Points",
|
||||
|
|
@ -124,25 +133,25 @@ void GridModifyTool::gui_toolbox() {
|
|||
"Square Lines",
|
||||
"Horizontal Lines"
|
||||
};
|
||||
t.gui.left_to_right_line_layout([&]() {
|
||||
t.gui.text_label("Type");
|
||||
t.gui.dropdown_select("filepicker select type", &typeSelected, listOfGridTypes, 200.0f);
|
||||
left_to_right_line_layout(t.gui, [&]() {
|
||||
text_label(t.gui, "Type");
|
||||
t.gui.element<DropDown<size_t>>("filepicker select type", &typeSelected, listOfGridTypes, 200.0f);
|
||||
});
|
||||
g.gridType = static_cast<WorldGrid::GridType>(typeSelected);
|
||||
uint32_t sDiv = g.subdivisions;
|
||||
t.gui.input_scalar_field<uint32_t>("Subdivisions", "Subdivisions", &sDiv, 1, 10);
|
||||
input_scalar_field<uint32_t>(t.gui, "Subdivisions", "Subdivisions", &sDiv, 1, 10);
|
||||
g.set_subdivisions(sDiv);
|
||||
bool divOut = g.removeDivisionsOutwards;
|
||||
t.gui.checkbox_field("Subdivide outwards", "Subdivide when zooming out", &divOut);
|
||||
checkbox_boolean_field(t.gui, "Subdivide outwards", "Subdivide when zooming out", &divOut);
|
||||
g.set_remove_divisions_outwards(divOut);
|
||||
t.gui.left_to_right_line_layout([&]() {
|
||||
if(t.gui.color_button_big("Grid Color", &g.color, &g.color == t.colorRight))
|
||||
t.color_selector_right(&g.color == t.colorRight ? nullptr : &g.color);
|
||||
t.gui.text_label("Grid Color");
|
||||
left_to_right_line_layout(t.gui, [&]() {
|
||||
//if(t.gui.color_button_big("Grid Color", &g.color, &g.color == t.colorRight))
|
||||
// t.color_selector_right(&g.color == t.colorRight ? nullptr : &g.color);
|
||||
text_label(t.gui, "Grid Color");
|
||||
});
|
||||
bool bounded = g.bounds.has_value();
|
||||
bool prevBoundedValue = bounded;
|
||||
t.gui.checkbox_field("Bounded", "Bounded", &bounded);
|
||||
checkbox_boolean_field(t.gui, "Bounded", "Bounded", &bounded);
|
||||
if(bounded && !prevBoundedValue) {
|
||||
SCollision::AABB<WorldScalar> newBounds;
|
||||
newBounds.min = g.offset - drawP.world.drawData.cam.c.dir_from_space(drawP.world.main.window.size.cast<float>() * 0.3f);
|
||||
|
|
@ -151,15 +160,14 @@ void GridModifyTool::gui_toolbox() {
|
|||
}
|
||||
else if(!bounded && prevBoundedValue)
|
||||
g.bounds = std::nullopt;
|
||||
t.gui.checkbox_field("Show Coordinates", "Show Coordinates (visible\nwhen canvas isn't rotated)", &g.showCoordinates);
|
||||
checkbox_boolean_field(t.gui, "Show Coordinates", "Show Coordinates (visible\nwhen canvas isn't rotated)", &g.showCoordinates);
|
||||
}
|
||||
t.gui.pop_id();
|
||||
}
|
||||
|
||||
bool GridModifyTool::right_click_popup_gui(Vector2f popupPos) {
|
||||
void GridModifyTool::right_click_popup_gui(Vector2f popupPos) {
|
||||
Toolbar& t = drawP.world.main.toolbar;
|
||||
t.paint_popup(popupPos);
|
||||
return true;
|
||||
}
|
||||
|
||||
void GridModifyTool::tool_update() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue