API Reference
This section documents the core APIs provided by the JenovaSDK for integration and development.
Utilities
IsEditor
A function to quickly check if the code is executing in the editor.
bool IsEditor()
Return
Returns true
if running inside the editor, otherwise false
.
IsGame
Checks if the code is running as a game build instead of editor/debug.
bool IsGame()
Return
Returns true
if running in a non-editor, non-debug environment.
GetNodeByPath
Gets a Node
in the scene tree by the given path.
Node* GetNodeByPath(const String& path)
Parameters
const String& path
: Path to the node.
Return
Pointer to the Node
if found, otherwise nullptr
.
FindNodeByName
Finds a Node
recursively by its name.
Node* FindNodeByName(Node* parent, const String& name)
Parameters
Node* parent
: Parent node to search under.const String& name
: Name of the node.
Return
Pointer to the Node
if found, otherwise nullptr
.
GetNodeUniqueID
Generates a unique ID string for a given node.
StringPtr GetNodeUniqueID(Node* node)
Parameters
Node* node
: The target node.
Return
Unique ID string pointer based on the node path MD5.
GetTree
Retrieves the current SceneTree
.
SceneTree* GetTree()
Return
Pointer to the SceneTree
if available, otherwise nullptr
.
GetTime
Gets the current engine time in seconds.
double GetTime()
Return
Current time in seconds as a double
.
Format
Formats text using C-style string formatting.
String Format(StringPtr format, va_list args)
String Format(WideStringPtr format, va_list args)
Parameters
format
: Format string.args
: Variable arguments.
Return
Formatted String
.
Output
Outputs formatted text to the console.
void Output(StringPtr format, va_list args)
void Output(WideStringPtr format, va_list args)
Parameters
format
: Format string.args
: Variable arguments.
DebugOutput
Outputs formatted text to debug console/log.
void DebugOutput(StringPtr format, va_list args)
void DebugOutput(WideStringPtr format, va_list args)
Parameters
format
: Format string.args
: Variable arguments.
GetCStr
Converts a Godot String
to a C-style string.
StringPtr GetCStr(const String& godotStr)
Parameters
const String& godotStr
: Input Godot string.
Return
Pointer to C-style string.
GetWCStr
Converts a Godot String
to a wide C-style string.
WideStringPtr GetWCStr(const String& godotStr)
Parameters
const String& godotStr
: Input Godot string.
Return
Pointer to wide C-style string.
GetObjectPointer
Casts a native pointer to an ObjectPtr
.
ObjectPtr GetObjectPointer(NativePtr obj)
Parameters
NativePtr obj
: Native object pointer.
Return
ObjectPtr
representation.
SetClassIcon
Sets a custom icon for a Godot class in the editor.
bool SetClassIcon(const String& className, const Ref<Texture2D> iconImage)
Parameters
className
: Name of the class.iconImage
: Texture to assign as icon.
Return
Returns true
if icon was set successfully.
MatchScaleFactor
Matches editor UI scaling factor.
double MatchScaleFactor(double inputSize)
Parameters
inputSize
: Input value to scale.
Return
Scaled value in editor, or unchanged in runtime.
CreateSignalCallback
Creates a signal connection with a function pointer callback.
Error CreateSignalCallback(Object* object, const String& signalName, FunctionPtr callbackPtr)
Parameters
object
: Target object.signalName
: Name of the signal.callbackPtr
: Callback function pointer.
Return
Error code.
Runtime Utilities
Alert
Displays a system alert message.
void Alert(StringPtr fmt, va_list args)
Parameters
fmt
: Format string.args
: Variable arguments.
GetEngineMode
Retrieves the current engine mode.
EngineMode GetEngineMode()
Return
Current engine mode.
CreateDirectoryMonitor
Registers a directory for monitoring changes.
bool CreateDirectoryMonitor(const String& directoryPath)
Parameters
directoryPath
: Path of directory to monitor.
Return
True if successfully added.
CreateFileMonitor
Registers a file for monitoring changes.
bool CreateFileMonitor(const String& filePath)
Parameters
filePath
: Path of file to monitor.
Return
True if successfully added.
RegisterFileMonitorCallback
Registers a callback for file system monitoring.
bool RegisterFileMonitorCallback(FileSystemCallback callbackPtr)
Parameters
callbackPtr
: Callback function pointer.
Return
True if callback registered.
UnregisterFileMonitorCallback
Removes a file monitor callback.
bool UnregisterFileMonitorCallback(FileSystemCallback callbackPtr)
Parameters
callbackPtr
: Callback function pointer.
Return
True if callback removed.
ReloadJenovaRuntime
Reloads the runtime.
bool ReloadJenovaRuntime(RuntimeReloadMode reloadMode)
Return
Always false (not implemented).
CreateCheckpoint
Creates a performance checkpoint.
void CreateCheckpoint(const String& checkPointName)
GetCheckpointTime
Retrieves elapsed time since checkpoint.
double GetCheckpointTime(const String& checkPointName)
DeleteCheckpoint
Deletes a checkpoint.
void DeleteCheckpoint(const String& checkPointName)
GetCheckpointTimeAndDispose
Gets elapsed time and removes checkpoint.
double GetCheckpointTimeAndDispose(const String& checkPointName)
RegisterRuntimeCallback
Registers a runtime callback.
bool RegisterRuntimeCallback(RuntimeCallback callbackPtr)
UnregisterRuntimeCallback
Unregisters a runtime callback.
bool UnregisterRuntimeCallback(RuntimeCallback callbackPtr)
Runtime callbacks can be used in tools/addons to get notified on certain events.
// Runtime Events
enum class RuntimeEvent
{
Initialized,
Started,
Stopped,
Ready,
EnterTree,
ExitTree,
FrameBegin,
FrameIdle,
FrameEnd,
FramePresent,
Process,
PhysicsProcess,
ReceivedDebuggerMessage
};
// Runtime Event Callback
typedef void(*RuntimeCallback)(const RuntimeEvent& runtimeEvent, NativePtr dataPtr, size_t dataSize);
Graphics Utilities
GetGameWindowHandle
Gets native handle of game window.
NativePtr GetGameWindowHandle()
GetRenderingDriverName
Gets name of current rendering driver.
StringPtr GetRenderingDriverName()
GetRenderingDriverResource
Gets driver resource pointer by type.
NativePtr GetRenderingDriverResource(DriverResourceID resourceType)
Memory Management Utilities
GetGlobalPointer
Gets a pointer from global memory map.
NativePtr GetGlobalPointer(MemoryID id)
SetGlobalPointer
Sets a pointer in global memory map.
NativePtr SetGlobalPointer(MemoryID id, NativePtr ptr)
DeleteGlobalPointer
Deletes a pointer from global memory map.
void DeleteGlobalPointer(MemoryID id)
AllocateGlobalMemory
Allocates and registers global memory.
NativePtr AllocateGlobalMemory(MemoryID id, size_t size)
FreeGlobalMemory
Frees allocated global memory.
void FreeGlobalMemory(MemoryID id)
Global Variables Utilities
GetGlobalVariable
Retrieves a global variable.
Variant GetGlobalVariable(VariableID id)
SetGlobalVariable
Sets a global variable.
void SetGlobalVariable(VariableID id, Variant var)
ClearGlobalVariables
Clears all global variables.
void ClearGlobalVariables()
📖 Learn about Global Storage (Memory/Variables)
Task System Utilities
InitiateTask
Starts a background task.
TaskID InitiateTask(TaskFunction function)
IsTaskComplete
Checks if a task has completed.
bool IsTaskComplete(TaskID taskID)
ClearTask
Clears a completed task.
void ClearTask(TaskID taskID)
Hot-Reloading Utilities
SupportsReload
Checks if hot-reloading is supported.
bool SupportsReload()
PrepareReload
Prepares nodes for class hot-reload.
void PrepareReload(const String& className)
FinishReload
Restores nodes after hot-reload.
void FinishReload(const String& className)
Dispose
Disposes/unregisters an extension class.
void Dispose(const String& className)
C Scripting Utilities (Clektron)
ExecuteScript
Executes a script string.
bool ExecuteScript(StringPtr ctronScript, bool noEntrypoint)
bool ExecuteScript(const String& ctronScript, bool noEntrypoint)
ExecuteScriptFromFile
Executes a script file.
bool ExecuteScriptFromFile(StringPtr ctronScriptFile, bool noEntrypoint)
bool ExecuteScriptFromFile(const String& ctronScriptFile, bool noEntrypoint)