71 lines
1.7 KiB
C++
71 lines
1.7 KiB
C++
/// CaveGame - A procedural 2D platformer sandbox.
|
|
/// Created by Josh O'Leary @ Redacted Software, 2020-2025
|
|
/// Contact: josh@redacted.cc
|
|
/// Contributors: william@redacted.cc maxi@redacted.cc
|
|
/// This work is dedicated to the public domain.
|
|
|
|
/// @file TileTool.hpp
|
|
/// @desc Re-WorldEdit Terrain Editor Tool.
|
|
/// @edit 1/28/2025
|
|
/// @auth Josh O'Leary
|
|
|
|
#pragma once
|
|
|
|
#include <JUI/Widgets/Window.hpp>
|
|
#include <JUI/Widgets/Slider.hpp>
|
|
#include <JUI/Widgets/Checkbox.hpp>
|
|
#include <JUI/Widgets/ListLayout.hpp>
|
|
|
|
namespace CaveGame::Client {
|
|
|
|
using namespace JUI;
|
|
|
|
enum class BrushShape {
|
|
Circle,
|
|
Square,
|
|
Diamond,
|
|
Cross,
|
|
X
|
|
};
|
|
|
|
|
|
|
|
class TileTool : public JUI::Window
|
|
{
|
|
static const bool WorldEditorEnabledByDefault = false;
|
|
public:
|
|
Event<float> BrushSizeChanged;
|
|
Event<float> BrushPercentChanged;
|
|
Event<bool> TileSimulationDisabledChanged;
|
|
Event<int> TileSimulationStep;
|
|
|
|
float BrushRadius();
|
|
void BrushRadius(float size);
|
|
float BrushDensity() const;
|
|
void BrushDensity(float percent);
|
|
|
|
|
|
|
|
explicit TileTool(Widget* parent);
|
|
void Enable(bool value);
|
|
bool IsEnabled() const { return enabled; }
|
|
|
|
|
|
protected:
|
|
|
|
float brush_radius = 8.f;
|
|
float brush_density = 100.f;
|
|
protected:
|
|
const int row_height = 20;
|
|
const std::string tool_title = "Re-WorldEdit";
|
|
Slider* brush_size_slider;
|
|
Slider* brush_percent_slider;
|
|
TextRect* tool_size_label;
|
|
TextButton* step_btn;
|
|
TextButton* step2_btn;
|
|
TextButton* step3_btn;
|
|
bool enabled = false;
|
|
bool tile_sim_disabled = false;
|
|
private:
|
|
};
|
|
} |