| 57 | |
| 58 | template <typename T, typename ...Args> |
| 59 | bool 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 | |
| 76 | bool new_times(auto name, auto labelh, auto labelm, Time &t) { |
| 77 | auto [width, height] = im::GetIO().DisplaySize; |
no test coverage detected