Added tile_sim button to ReWorldEdit

This commit is contained in:
2025-02-11 20:58:22 -05:00
parent 9adc5c9ac7
commit 3bd4716fcd
2 changed files with 19 additions and 3 deletions

View File

@@ -13,6 +13,7 @@
#include <JUI/Widgets/Window.hpp>
#include <JUI/Widgets/Slider.hpp>
#include <JUI/Widgets/Checkbox.hpp>
#include <JUI/Widgets/ListLayout.hpp>
namespace CaveGame::Client
@@ -24,11 +25,11 @@ namespace CaveGame::Client
public:
Event<float> BrushSizeChanged;
Event<float> BrushPercentChanged;
Event<bool> TileSimulationDisabledChanged;
void SetBrushSize(float size);
explicit TileTool(Widget* parent);
void Enable(bool value);
protected:
@@ -38,6 +39,7 @@ namespace CaveGame::Client
Slider* brush_percent_slider;
TextRect* tool_size_label;
bool enabled = false;
bool tile_sim_disabled;
private:
};
}

View File

@@ -8,7 +8,7 @@ CaveGame::Client::TileTool::TileTool(JUI::Widget *parent) : JUI::Window(parent)
auto* column_layout = new HorizontalListLayout(this->GetViewportInstance());
auto* column_layout = new HorizontalListLayout(this->ViewportInstance());
auto* col_left = new Rect(column_layout);
col_left->BGColor({64, 64, 64, 128});
@@ -20,17 +20,22 @@ CaveGame::Client::TileTool::TileTool(JUI::Widget *parent) : JUI::Window(parent)
tool_size_label->Size({0, row_height, 1, 0});
tool_size_label->SetContent("Size: 8");
tool_size_label->BGColor(Colors::Transparent);
//tool_size_label->LayoutOrder(1);
auto* tool_percent_label = new TextRect(left_row_layout);
tool_percent_label->Size({0, row_height, 1, 0});
tool_percent_label->SetContent("Percent: 100%");
tool_percent_label->BGColor(Colors::Transparent);
auto* tile_sim_label = new TextRect(left_row_layout);
tile_sim_label->Size({0, row_height, 1, 0});
tile_sim_label->SetContent("Pause Tile Sim:");
tile_sim_label->BGColor(Colors::Transparent);
auto* col_right = new Rect(column_layout);
col_right->BGColor({128, 128, 128, 128});
col_right->Size({0, 0, 0.65f, 1.f});
auto* right_row_layout = new VerticalListLayout(col_right);
brush_size_slider = new Slider(right_row_layout);
@@ -61,6 +66,15 @@ CaveGame::Client::TileTool::TileTool(JUI::Widget *parent) : JUI::Window(parent)
};
brush_percent_slider->CurrentValue(1.f);
auto* tile_sim_checkbox = new Checkbox(right_row_layout);
tile_sim_checkbox->Size({row_height, row_height, 0, 0});
tile_sim_checkbox->OnReleaseEvent += [this] (Vector2 _, JUI::MouseButton _2, bool _3) {
tile_sim_disabled = !tile_sim_disabled;
TileSimulationDisabledChanged.Invoke(tile_sim_disabled);
};
}
void CaveGame::Client::TileTool::SetBrushSize(float size) {