Yosin_Game/ImguiLayerActorRegister.h

195 lines
4.5 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//#pragma once
////演员对象智能指针Map
//extern std::map<uint64_t, ActorPtr>ActorPtrMapObject;
//
//std::string UTF8toString(const std::string& strSrc)
//{
// int nwLen = MultiByteToWideChar(CP_UTF8, 0, strSrc.c_str(), -1, NULL, 0);
//
// wchar_t* pwBuf = new wchar_t[nwLen + 1];//一定要加1不然会出现尾巴
// memset(pwBuf, 0, nwLen * 2 + 2);
//
// MultiByteToWideChar(CP_UTF8, 0, strSrc.c_str(), strSrc.length(), pwBuf, nwLen);
//
// int nLen = WideCharToMultiByte(CP_ACP, 0, pwBuf, -1, NULL, NULL, NULL, NULL);
//
// char* pBuf = new char[nLen + 1];
// memset(pBuf, 0, nLen + 1);
//
// WideCharToMultiByte(CP_ACP, 0, pwBuf, nwLen, pBuf, nLen, NULL, NULL);
//
// std::string retStr = pBuf;
//
// delete[]pBuf;
// delete[]pwBuf;
//
// pBuf = NULL;
// pwBuf = NULL;
//
// return retStr;
//
//}
//
//std::string string_To_UTF8(const std::string& strSrc)
//{
// int nwLen = ::MultiByteToWideChar(CP_ACP, 0, strSrc.c_str(), -1, NULL, 0);
//
// wchar_t* pwBuf = new wchar_t[nwLen + 1];//一定要加1不然会出现尾巴
// ZeroMemory(pwBuf, nwLen * 2 + 2);
//
// ::MultiByteToWideChar(CP_ACP, 0, strSrc.c_str(), strSrc.length(), pwBuf, nwLen);
//
// int nLen = ::WideCharToMultiByte(CP_UTF8, 0, pwBuf, -1, NULL, NULL, NULL, NULL);
//
// char* pBuf = new char[nLen + 1];
// ZeroMemory(pBuf, nLen + 1);
//
// ::WideCharToMultiByte(CP_UTF8, 0, pwBuf, nwLen, pBuf, nLen, NULL, NULL);
//
// std::string retStr(pBuf);
//
// delete[]pwBuf;
// delete[]pBuf;
//
// pwBuf = NULL;
// pBuf = NULL;
//
// return retStr;
//}
//
//void ControlPanel(const SQChar* Name)
//{
// ImGui::Begin(u8"测试窗口", 0, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove);
//
// sq_pushroottable(v);
// sq_pushstring(v, Name, -1);
// sq_get(v, -2);
// sq_pushroottable(v);
// sq_pushstring(v, _SST("Lenheart"), -1);
// sq_call(v, 2, 0, 1);
// sq_pop(v, 2);
//
//
// ImGui::End();
//}
//
//
//
////创建Imgui图层
//static SQInteger Create_ImguiLayer(HSQUIRRELVM v)
//{
// SQInteger Top = sq_gettop(v);
// if (Top <= 0)
// {
// sq_throwerror(v, _SST("Incorrect function argument"));
// return 0;
// }
//
// const SQChar* ImguiName;
// sq_getstring(v, 2, &ImguiName);
//
//
// auto f1 = std::bind(&ControlPanel, ImguiName);
//
// // 创建 ImGui 图层
// ImGuiLayerPtr layer = new ImGuiLayer((char*)ImguiName, f1);
//
// //获取对象的唯一ID
// uint64_t UUID = layer->GetObjectID();
//
// //将画布对象存入Map管理
// ActorPtrMapObject[UUID] = layer;
//
// sq_pushinteger(v, UUID);
//
// return 1;
//}
//
//
////创建Imgui文字
//static SQInteger Imgui_Text(HSQUIRRELVM v)
//{
// SQInteger Top = sq_gettop(v);
// if (Top <= 0)
// {
// sq_throwerror(v, _SST("Incorrect function argument"));
// return 0;
// }
//
// const SQChar* ImguiName;
// sq_getstring(v, 2, &ImguiName);
//
// ImGui::Text((char*)ImguiName);
//
// return 0;
//}
//
////设置窗口大小
//static SQInteger Imgui_SetWindowSize(HSQUIRRELVM v)
//{
// SQInteger Top = sq_gettop(v);
// if (Top <= 0)
// {
// sq_throwerror(v, _SST("Incorrect function argument"));
// return 0;
// }
//
// SQInteger X;
// SQInteger Y;
// sq_getinteger(v, 2, &X);
// sq_getinteger(v, 3, &Y);
//
// ImGui::SetWindowSize(ImVec2(X, Y));
// return 0;
//}
//
////设置窗口坐标
//static SQInteger Imgui_SetWindowPos(HSQUIRRELVM v)
//{
// SQInteger Top = sq_gettop(v);
// if (Top <= 0)
// {
// sq_throwerror(v, _SST("Incorrect function argument"));
// return 0;
// }
//
// SQInteger X;
// SQInteger Y;
// sq_getinteger(v, 2, &X);
// sq_getinteger(v, 3, &Y);
//
// ImGui::SetWindowPos(ImVec2(X, Y));
// return 0;
//}
//
//
////创建Imgui输入框
//static SQInteger Imgui_InputText(HSQUIRRELVM v)
//{
// SQInteger Top = sq_gettop(v);
// if (Top <= 0)
// {
// sq_throwerror(v, _SST("Incorrect function argument"));
// return 0;
// }
//
// const SQChar* InPutName;
// sq_getstring(v, 2, &InPutName);
//
// ImGui::PushStyleColor(ImGuiCol_FrameBg, IM_COL32(0, 0, 0, 255));
// static char buf[25] = u8"";
// ImGui::InputText("##", buf, IM_ARRAYSIZE(buf));
// ImGui::PopStyleColor();
//
//
//
// sq_pushroottable(v);
// sq_pushstring(v, InPutName, -1);
// sq_get(v, -2);
// sq_pushroottable(v);
// sq_pushstring(v, _SST(buf), -1);
// sq_call(v, 2, 0, 1);
// sq_pop(v, 2);
// return 0;
//}