120 lines
3.0 KiB
C++
120 lines
3.0 KiB
C++
#pragma once
|
|
|
|
#include "include/squirrel.h"
|
|
#include "include/sqstdaux.h"
|
|
#include "include/sqstdblob.h"
|
|
#include "include/sqstdio.h"
|
|
#include "include/sqstdmath.h"
|
|
#include "include/sqstdstring.h"
|
|
#include "include/sqstdsystem.h"
|
|
|
|
|
|
#include <kiwano/kiwano.h>
|
|
using namespace kiwano;
|
|
#include <kiwano-audio/kiwano-audio.h>
|
|
using namespace kiwano::audio;
|
|
#include <kiwano-imgui/kiwano-imgui.h>
|
|
using namespace kiwano::imgui;
|
|
#include "WThreadPool.h"
|
|
|
|
|
|
#include "SquirrelStage.h"
|
|
#include "SquirrelTownStage.h"
|
|
#include "Cursor.h"
|
|
#include "SquirrelButton.h"
|
|
#include "SpriteEx.h"
|
|
#include "SquirrelCamera.h"
|
|
#include "Npk.h"
|
|
#include "json.hpp"
|
|
|
|
#include <iostream>
|
|
#include <map>
|
|
#include <unordered_map>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <sstream>
|
|
#include <thread>
|
|
#include <tchar.h>
|
|
#include <fstream>
|
|
#include <sstream>
|
|
|
|
|
|
#ifdef SQUNICODE
|
|
#define scfprintf fwprintf
|
|
#define scfopen _wfopen
|
|
#define scvprintf vwprintf
|
|
#define _SST(a) (SQChar*)##a
|
|
#else
|
|
#define scfprintf fprintf
|
|
#define scfopen fopen
|
|
#define scvprintf vprintf
|
|
#endif
|
|
|
|
|
|
class SquirrelClassEx
|
|
{
|
|
|
|
public://输出拓展
|
|
static int Sout(HSQUIRRELVM v);//输出
|
|
static int Error(HSQUIRRELVM v);//输出
|
|
|
|
public://API类
|
|
//重载Nut脚本
|
|
static SQInteger ReloadingScript();
|
|
//退出游戏
|
|
static SQInteger Exit(HSQUIRRELVM v);
|
|
//执行Cmd
|
|
static SQInteger Cmd(HSQUIRRELVM v);
|
|
//调用脚本
|
|
static void RunSceneScript(std::string FuncName, SquirrelStagePtr scene);
|
|
static void RunSceneScript(std::string FuncName, SquirrelStagePtr scene,SQInteger dt);
|
|
static void RunSceneScript(std::string FuncName, SquirrelStagePtr scene, SQFloat dt);
|
|
static void RunSceneScript(std::string FuncName, SquirrelTownStagePtr scene);
|
|
static void RunUpdateScript(std::string FuncName, SQInteger ObjectIdx);
|
|
static void RunUpdateScript(std::string FuncName, std::string string);
|
|
static void RunUpdateScript(std::string FuncName, SQInteger ObjectIdx, SQInteger Buf);
|
|
static void RunUpdateScript(std::string FuncName, SQInteger ObjectIdx, SQInteger Buf , SQInteger Buf2);
|
|
static void RunUpdateScriptPlayer(std::string FuncName, SQInteger ObjectIdx, SQFloat Buf);
|
|
//Push图层对象至Map
|
|
static void PushLayerActorPtrToMap(LayerActorPtr Ptr);
|
|
//读取List
|
|
static void LoadingListScript();
|
|
|
|
public: //纹理类
|
|
static TexturePtr GetTexturePtrByImg(const std::string ImgPath , const int Frame);
|
|
static void ReleaseTextureByImg(const std::string ImgPath);
|
|
|
|
public://类扩展
|
|
//字符串类
|
|
static void Split(const std::string& src, std::vector<std::string>& dest, const std::string& separator);
|
|
static char* U8ToUnicode(const char* szU8);
|
|
static char* SquirrelU2W(const char* Str);
|
|
|
|
|
|
|
|
|
|
//文件类
|
|
//static int WriteFile(HSQUIRRELVM v);//文件写出
|
|
|
|
|
|
public://注册闭包函数
|
|
//新增nut接口funcName绑定C语言函数funcAddr
|
|
static void RegisterNutApi(const SQChar* funcName, void* funcAddr, HSQUIRRELVM v);
|
|
//注册接口
|
|
void R_Register_Nut(HSQUIRRELVM v);
|
|
|
|
|
|
|
|
|
|
public:
|
|
SquirrelClassEx();
|
|
//初始化
|
|
void Init();
|
|
//运行
|
|
void Run();
|
|
//关闭
|
|
void Close();
|
|
};
|
|
|
|
static SquirrelClassEx* Object;
|
|
static HSQUIRRELVM v; |