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://<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ
|
|||
|
|
static int Sout(HSQUIRRELVM v);//<2F><><EFBFBD><EFBFBD>
|
|||
|
|
static int Error(HSQUIRRELVM v);//<2F><><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
public://API<50><49>
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>Nut<75>ű<EFBFBD>
|
|||
|
|
static SQInteger ReloadingScript();
|
|||
|
|
//<2F>˳<EFBFBD><CBB3><EFBFBD>Ϸ
|
|||
|
|
static SQInteger Exit(HSQUIRRELVM v);
|
|||
|
|
//ִ<><D6B4>Cmd
|
|||
|
|
static SQInteger Cmd(HSQUIRRELVM v);
|
|||
|
|
//<2F><><EFBFBD>ýű<C3BD>
|
|||
|
|
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ͼ<68><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Map
|
|||
|
|
static void PushLayerActorPtrToMap(LayerActorPtr Ptr);
|
|||
|
|
//<2F><>ȡList
|
|||
|
|
static void LoadingListScript();
|
|||
|
|
|
|||
|
|
public: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
static TexturePtr GetTexturePtrByImg(const std::string ImgPath , const int Frame);
|
|||
|
|
static void ReleaseTextureByImg(const std::string ImgPath);
|
|||
|
|
|
|||
|
|
public://<2F><><EFBFBD><EFBFBD>չ
|
|||
|
|
//<2F>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
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);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//<2F>ļ<EFBFBD><C4BC><EFBFBD>
|
|||
|
|
//static int WriteFile(HSQUIRRELVM v);//<2F>ļ<EFBFBD>д<EFBFBD><D0B4>
|
|||
|
|
|
|||
|
|
|
|||
|
|
public://ע<><D7A2><EFBFBD>հ<EFBFBD><D5B0><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>nut<75>ӿ<EFBFBD>funcName<6D><65><EFBFBD><EFBFBD>C<EFBFBD><43><EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD>funcAddr
|
|||
|
|
static void RegisterNutApi(const SQChar* funcName, void* funcAddr, HSQUIRRELVM v);
|
|||
|
|
//ע<><D7A2><EFBFBD>ӿ<EFBFBD>
|
|||
|
|
void R_Register_Nut(HSQUIRRELVM v);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
public:
|
|||
|
|
SquirrelClassEx();
|
|||
|
|
//<2F><>ʼ<EFBFBD><CABC>
|
|||
|
|
void Init();
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
|
void Run();
|
|||
|
|
//<2F>ر<EFBFBD>
|
|||
|
|
void Close();
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
static SquirrelClassEx* Object;
|
|||
|
|
static HSQUIRRELVM v;
|