2026-03-27 09:51:53 +03:00
|
|
|
#pragma once
|
|
|
|
|
#include "../GUIManager.hpp"
|
|
|
|
|
#include "TextBoxHelpers.hpp"
|
|
|
|
|
#include "../Elements/NumberSlider.hpp"
|
|
|
|
|
|
|
|
|
|
namespace GUIStuff { namespace ElementHelpers {
|
2026-03-30 17:05:24 +03:00
|
|
|
template <typename T> void slider_scalar_field(GUIManager& gui, const char* id, std::string_view name, T* val, T min, T max, TextBoxScalarOptions options = {}) {
|
2026-03-30 18:51:14 +03:00
|
|
|
gui.new_id(id, [&] {
|
|
|
|
|
options.onEdit = [&, oE = options.onEdit] {
|
2026-03-31 17:33:09 +03:00
|
|
|
if(oE) oE();
|
2026-03-30 18:51:14 +03:00
|
|
|
gui.set_to_layout();
|
|
|
|
|
};
|
|
|
|
|
left_to_right_line_layout(gui, [&]() {
|
|
|
|
|
text_label(gui, name);
|
|
|
|
|
input_scalar(gui, "textbox", val, min, max, options);
|
|
|
|
|
});
|
|
|
|
|
gui.element<NumberSlider<T>>("slider", val, min, max, options.onEdit);
|
2026-03-27 09:51:53 +03:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}}
|