绘制字符(不太满意)

This commit is contained in:
2022-04-24 02:31:42 +08:00
parent 3bdafc7e35
commit 6583312298
12 changed files with 150 additions and 69 deletions

View File

@@ -1,8 +1,6 @@
#include "pch.h"
#include "squirrel.h"
#include "DNFTOOL.h"
#include "RSAC.h"
#include "STL.h"
int squirrel::SQloadfile(uint32_t v, const wchar_t* filename, BOOL printerror)
{
@@ -71,11 +69,17 @@ int squirrel::SQdofile(uint32_t v, const wchar_t* filename, BOOL retval, BOOL pr
//Test
int squirrel::sq_Test(uint32_t v)
{
int a;
SQGetInt(v, 2, &a);
//GMNotice((char*)u"我的天");
//WindowsNotice((char*)u"我的天");
//SQPopTop(v);
//SQPushInt(v, 1);
//char* str = (char*)"test";
std::cout << a << std::endl;
return 0;
}
//读人物 或 装备属性
@@ -1052,7 +1056,7 @@ int squirrel::Set_DragonModel(uint32_t v)
#endif
//Json STL
#if defined JSON_STL
//构造Json类型容器
static std::map<std::string, std::string>Json_STL;
@@ -1122,7 +1126,6 @@ int squirrel::Jsoner_STL(uint32_t v)
SQGetString(v, 3, &GKey);
char* key = DNFTOOL::wchar_tTochar(GKey);
rapidjson::Document Dom;
std::cout << Json_STL["Lenheart"].c_str() << std::endl;
Dom.Parse(Json_STL[Name].c_str());//加载 字符串
std::vector<std::string> Data;
@@ -1256,6 +1259,64 @@ int squirrel::Jsoner_STL(uint32_t v)
}
#endif
//字符 STL
#if defined CODE_STL
extern std::vector<DrawCodestruct>DrawCodeT1_STL;
extern std::vector<DrawCodestruct>DrawCodeT2_STL;
int squirrel::Coder_STL(uint32_t v)
{
wchar_t* Str;
int XPos;
int YPos;
int Color;
int Type;
int ParameterNum = SQGetTop(v);
if (ParameterNum == 6)
{
//获取字符串内容
SQGetString(v, 2, &Str);
//获取X坐标
SQGetInt(v, 3, &XPos);
//获取X坐标
SQGetInt(v, 4, &YPos);
//获取颜色
SQGetInt(v, 5, &Color);
//获取类型
SQGetInt(v, 6, &Type);
DrawCodestruct Buffer;
char* str = DNFTOOL::wchar_tTochar(Str);
Buffer.str = str;
Buffer.Xpos = XPos;
Buffer.Ypos = YPos;
Buffer.Color = Color;
switch (Type)
{
case 0:
{
DrawCodeT1_STL.push_back(Buffer);
}
break;
case 1:
{
DrawCodeT2_STL.push_back(Buffer);
}
break;
}
SQPushBool(v, true);
}
else
{
SQPushBool(v, false);
}
return 1;
}
#endif
//获取Squirrel v 基址
inline uint32_t GetSqVm()
{
@@ -1334,7 +1395,7 @@ void squirrel::R_Register_Nut()
RegisterNutApi(L"L_Get_STL", squirrel::Get_STL);//获取容器
#endif
//时间 STL
//时间 STL
#if defined TIME_STL
RegisterNutApi(L"L_Timer_STL", squirrel::Timer_STL);//时间容器
#endif
@@ -1344,7 +1405,12 @@ void squirrel::R_Register_Nut()
RegisterNutApi(L"L_Json_STL", squirrel::Jsoner_STL);//时间容器
#endif
//龙盒
//字符 STL
#if defined CODE_STL
RegisterNutApi(L"L_Code_STL", squirrel::Coder_STL);//字符容器
#endif
//龙盒
#if defined DRAGONBOX_SWITCH
RegisterNutApi(L"L_Get_DragonModel", squirrel::Get_DragonModel);//获取龙盒模式
RegisterNutApi(L"L_Set_DragonModel", squirrel::Set_DragonModel);//设置龙盒模式