#include "../WindowOS/CWidget.h" class Image:CWidget { public: Image(); Image(Image&& Other); void Protract(); bool LoadImage(const char* path); bool LoadImage(const unsigned char* Memory, const int size); void BindTexture(unsigned char* Texture,int width,int height); template bool Mouse_Hovered(Func&& fun, Args&&... args); template bool Click(ImGuiMouseButton Mouse, Func&& fun, Args && ...args); template bool LoadImageClick(Func&& fun, Args && ...args); //------------------------------------- ImVec2 Size = { 0,0 }; HSize WH = { 0,0 }; ImVec2 Pos = { 0,0 }; GLuint ImageData = 0; int Channels = 0; private: void POR(); unsigned char* data; 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_img; std::thread A; std::thread AB; std::thread ABC; std::thread ABCD; }; template inline bool Image::Mouse_Hovered(Func&& fun, Args && ...args) { task_Click_Mouse = std::bind(std::forward(fun), std::forward(args)...); return true; } template inline bool Image::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 bool Image::LoadImageClick(Func&& fun, Args && ...args) { task_Click_img = std::bind(std::forward(fun), std::forward(args)...); return true; }