#pragma once #define __SliderBar__H__ #ifdef __SliderBar__H__ #include "../Drive/Drive.h" class SlideBar{ struct slider_state{ float speed; float value; }; slider_state state{0.f, 0.f}; float nameanim_mark = 0.f; public: SlideBar() {}; SlideBar(const SlideBar&&) {}; bool Draw(); template bool Mouse_Hovered(Func&& fun, Args&&... args); template bool Click(ImGuiMouseButton Mouse, Func&& fun, Args && ...args); template void ValueChange(Func&& fun, Args && ...args); std::string Text = ""; ImVec2 Pos = { 0,0 }; float BtnSize = 10.f; int Fontsize = 18; float Value = 0.5f; float MiniValue = 0.0f; float MaxValue = 10.0f; float Width = 300.0f; float Height = 8.0f; float FrameHeight = 0.0f; float BtnRound = 9.0f; float Round = 10.0f; ImVec4 Garb = { 0.24f, 0.52f, 0.88f, 2.0f }; ImVec4 GarbActive = { 0, 0.95f, 0, 0.9f }; ImVec4 FrameColor = { 0, 0, 0, 150 }; ImVec4 FrameAColor = FrameColor; ImVec4 FrameHColor = FrameColor; ImVec4 PaddColor = RGBA(64, 158, 255, 255); ImGuiSliderFlags Attribute = 0; bool RenderTextFlag = false; private: bool SliderScalar_1(const char* label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags); ImRect grab_bb; ImRect Padd; float RValue = Value; std::string ID = "ID_" + UI_ID::UIIDSTR(); std::function task_Click_L; std::function task_Click_Mouse; std::function task_Click_R; std::function task_Click_M; std::function task_Click_Value; }; template inline bool SlideBar::Mouse_Hovered(Func&& fun, Args && ...args) { task_Click_Mouse = std::bind(std::forward(fun), std::forward(args)...); return true; } template inline bool SlideBar::Click(ImGuiMouseButton Mouse, Func&& fun, Args && ...args) { if (Mouse == IMBN::ImGuiMouseButton_Left) { task_Click_L = std::bind(std::forward(fun), std::forward(args)...); } else if (Mouse == IMBN::ImGuiMouseButton_Right) { task_Click_R = std::bind(std::forward(fun), std::forward(args)...); } else if (Mouse == IMBN::ImGuiMouseButton_Middle) { task_Click_M = std::bind(std::forward(fun), std::forward(args)...); } return true; } template inline void SlideBar::ValueChange(Func&& fun, Args && ...args) { task_Click_Value = std::bind(std::forward(fun), std::forward(args)...); } #endif // DEBUG