MCPcopy Create free account
hub / github.com/averne/Fizeau / new_slider

Function new_slider

application/src/gui.cpp:59–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57
58template <typename T, typename ...Args>
59bool new_slider(auto name, auto label, T &val, T min, T max, auto fmt, Args &&...args) {
60 auto [width, height] = im::GetIO().DisplaySize;
61 auto slider_pos = im::GetWindowPos().x + 0.04f * width;
62 bool ret = false;
63 im::PushItemWidth(im::GetWindowWidth() - 0.08f * width);
64 FZ_SCOPEGUARD([] { im::PopItemWidth(); });
65 im::TextUnformatted(name); im::SameLine(); im::SetCursorPosX(slider_pos);
66 if constexpr (std::is_floating_point_v<T>) {
67 ret |= im::SliderFloat(label, reinterpret_cast<float *>(&val), min, max, fmt);
68 ret |= swkbd::handle(label, &val, min, max, fmt, args...);
69 } else {
70 ret |= im::SliderInt(label, reinterpret_cast<int *>(&val), min, max, fmt);
71 ret |= swkbd::handle(label, &val, min, max);
72 }
73 return ret;
74};
75
76bool new_times(auto name, auto labelh, auto labelm, Time &t) {
77 auto [width, height] = im::GetIO().DisplaySize;

Callers 2

draw_color_tabFunction · 0.85
draw_correction_tabFunction · 0.85

Calls 1

handleFunction · 0.85

Tested by

no test coverage detected