leper/0ad

Style: JSInterface_XYZ.{h,cpp} for exported engine functions

Closed this issue · 0 comments

The idea is that C++ functions which are exported to JS are declared and defined in a file called JSInterface_XYZ.h/cpp (XYZ being a suitable name). They are also wrapped in a namespace called JSI_XYZ (XYZ being the same name used before for the filename). This namespace also contains the function RegisterScriptFunctions which is responsible for registring these functions to the ScriptInterface.
Check JSI_GameView, JSI_Console or JSI_Sound for examples.