mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-16 07:37:02 +00:00
added AngelScript; work on extractor
This commit is contained in:
21
hecl/lib/Database/ASEngine.cpp
Normal file
21
hecl/lib/Database/ASEngine.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "HECL/Database.hpp"
|
||||
|
||||
namespace HECL
|
||||
{
|
||||
namespace Database
|
||||
{
|
||||
|
||||
/* Centralized AngelScript engine */
|
||||
AngelScript::asIScriptEngine* asENGINE = nullptr;
|
||||
|
||||
static bool InitEntered = false;
|
||||
void InitASEngine()
|
||||
{
|
||||
if (InitEntered)
|
||||
return;
|
||||
InitEntered = true;
|
||||
assert(asENGINE = AngelScript::asCreateScriptEngine(ANGELSCRIPT_VERSION));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
24
hecl/lib/Database/ASInit.cpp
Normal file
24
hecl/lib/Database/ASInit.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "HECL/Database.hpp"
|
||||
|
||||
namespace HECL
|
||||
{
|
||||
namespace Database
|
||||
{
|
||||
|
||||
static std::string StringFactory(unsigned int byteLength, const char *s)
|
||||
{
|
||||
return std::string(s, byteLength);
|
||||
}
|
||||
|
||||
ASStringType asSTRINGTYPE;
|
||||
ASStringType::ASStringType() : ASType<std::string>("", "string")
|
||||
{
|
||||
assert(asENGINE->RegisterStringFactory("string",
|
||||
AngelScript::asFUNCTION(StringFactory),
|
||||
AngelScript::asCALL_CDECL) >= 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
add_library(HECLDatabaseInit
|
||||
Registry.cpp
|
||||
ASInit.cpp)
|
||||
add_library(HECLDatabase
|
||||
Project.cpp
|
||||
Registry.cpp)
|
||||
ASEngine.cpp
|
||||
Project.cpp)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user