MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / init

Function init

TheForceEngine/TFE_ForceScript/forceScript.cpp:104–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102 }
103
104 void init()
105 {
106 // Create the script engine.
107 s_engine = asCreateScriptEngine();
108
109 // Set the message callback to receive information on errors in human readable form.
110 s32 res = s_engine->SetMessageCallback(asFUNCTION(messageCallback), 0, asCALL_CDECL);
111 assert(res >= 0);
112
113 // Register std::string as the script string type.
114 RegisterStdString(s_engine);
115 s_typeId[FSTYPE_STRING] = GetStdStringObjectId();
116
117 // Register the default array type.
118 RegisterScriptArray(s_engine, true);
119 s_typeId[FSTYPE_ARRAY] = GetScriptArrayObjectId();
120
121 // Language features.
122 res = s_engine->RegisterGlobalFunction("void yield(float = 0.0)", asFUNCTION(yield), asCALL_CDECL); assert(res >= 0);
123 res = s_engine->RegisterGlobalFunction("void abort(const string &in)", asFUNCTION(abort), asCALL_CDECL); assert(res >= 0);
124
125 registerScriptMath_float2(s_engine);
126 registerScriptMath_float3(s_engine);
127 registerScriptMath_float4(s_engine);
128 registerScriptMath_float2x2(s_engine);
129 registerScriptMath_float3x3(s_engine);
130 registerScriptMath_float4x4(s_engine);
131 s_typeId[FSTYPE_FLOAT2] = getFloat2ObjectId();
132 s_typeId[FSTYPE_FLOAT3] = getFloat3ObjectId();
133 s_typeId[FSTYPE_FLOAT4] = getFloat4ObjectId();
134 s_typeId[FSTYPE_FLOAT2x2] = getFloat2x2ObjectId();
135 s_typeId[FSTYPE_FLOAT3x3] = getFloat3x3ObjectId();
136 s_typeId[FSTYPE_FLOAT4x4] = getFloat4x4ObjectId();
137
138 s_modules.clear();
139 }
140
141 void destroy()
142 {

Callers

nothing calls this directly

Calls 15

RegisterStdStringFunction · 0.85
GetStdStringObjectIdFunction · 0.85
RegisterScriptArrayFunction · 0.85
GetScriptArrayObjectIdFunction · 0.85
getFloat2ObjectIdFunction · 0.85
getFloat3ObjectIdFunction · 0.85

Tested by

no test coverage detected