#pragma once #include "../Drive/Drive.h" class Button{ public: Button(); Button(Button&& Other) noexcept; void Draw() const; template bool Mouse_Hovered(Func&& fun, Args&&... args); template bool Click(ImGuiMouseButton Mouse, Func&& fun, Args && ...args); //------------------------------------- ImVec2 Size = { 100,35 }; ImVec2 Pos = { 0,0 }; int Fontsize = 16; int Round = 5; std::string Text = ""; ImGuiButtonFlags Attribute = 0; ImVec4 BtnColor = RGBA(64, 158, 255, 255); ImVec4 BtnAColor = RGBA(64, 158, 255, 245); ImVec4 BtnHColor = RGBA(64, 158, 255, 200); ImVec4 TextColor = RGBA(255, 255, 255, 255); private: void POR() const; 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::thread A; std::thread AB; std::thread ABC; std::thread ABCD; int StyleCount = 4; }; template inline bool Button::Mouse_Hovered(Func&& fun, Args && ...args) { task_Click_Mouse = std::bind(std::forward(fun), std::forward(args)...); return true; } template inline bool Button::Click(const 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; }