Ultralight C API 1.3.0
|
Go to the source code of this file.
Core renderer singleton for the library, coordinates all library functions.
The Renderer class is responsible for creating and painting Views , managing Sessions , as well as coordinating network requests, events, JavaScript execution, and more.
To initialize the library, you should set up the Platform singleton and call ulCreateRenderer().
Functions | |
ULExport ULRenderer | ulCreateRenderer (ULConfig config) |
Create the core renderer singleton for the library directly. | |
ULExport void | ulDestroyRenderer (ULRenderer renderer) |
Destroy the renderer. | |
ULExport void | ulUpdate (ULRenderer renderer) |
Update timers and dispatch internal callbacks (JavaScript and network). | |
ULExport void | ulRender (ULRenderer renderer) |
Render all active Views. | |
ULExport void | ulPurgeMemory (ULRenderer renderer) |
Attempt to release as much memory as possible. | |
ULExport void | ulLogMemoryUsage (ULRenderer renderer) |
Print detailed memory usage statistics to the log. | |
ULExport bool | ulStartRemoteInspectorServer (ULRenderer renderer, const char *address, unsigned short port) |
Start the remote inspector server. | |
ULExport void | ulSetGamepadDetails (ULRenderer renderer, unsigned int index, ULString id, unsigned int axis_count, unsigned int button_count) |
Describe the details of a gamepad, to be used with ulFireGamepadEvent and related events below. | |
ULExport void | ulFireGamepadEvent (ULRenderer renderer, ULGamepadEvent evt) |
Fire a gamepad event (connection / disconnection). | |
ULExport void | ulFireGamepadAxisEvent (ULRenderer renderer, ULGamepadAxisEvent evt) |
Fire a gamepad axis event (to be called when an axis value is changed). | |
ULExport void | ulFireGamepadButtonEvent (ULRenderer renderer, ULGamepadButtonEvent evt) |
Fire a gamepad button event (to be called when a button value is changed). | |
ULExport ULRenderer ulCreateRenderer | ( | ULConfig | config | ) |
Create the core renderer singleton for the library directly.
Unlike ulCreateApp(), this does not use any native windows for drawing and allows you to manage your own runloop and painting. This method is recommended for those wishing to integrate the library into a game.
This singleton manages the lifetime of all Views and coordinates all painting, rendering, network requests, and event dispatch.
You should only call this once per process lifetime.
You must set up your platform handlers before calling this. At a minimum, you must call ulPlatformSetFileSystem() and ulPlatformSetFontLoader() before calling this.
ULExport void ulDestroyRenderer | ( | ULRenderer | renderer | ) |
Destroy the renderer.
ULExport void ulFireGamepadAxisEvent | ( | ULRenderer | renderer, |
ULGamepadAxisEvent | evt | ||
) |
Fire a gamepad axis event (to be called when an axis value is changed).
ULExport void ulFireGamepadButtonEvent | ( | ULRenderer | renderer, |
ULGamepadButtonEvent | evt | ||
) |
Fire a gamepad button event (to be called when a button value is changed).
ULExport void ulFireGamepadEvent | ( | ULRenderer | renderer, |
ULGamepadEvent | evt | ||
) |
Fire a gamepad event (connection / disconnection).
ULExport void ulLogMemoryUsage | ( | ULRenderer | renderer | ) |
ULExport void ulPurgeMemory | ( | ULRenderer | renderer | ) |
Attempt to release as much memory as possible.
Don't call this from any callbacks or driver code.
ULExport void ulRender | ( | ULRenderer | renderer | ) |
Render all active Views.
ULExport void ulSetGamepadDetails | ( | ULRenderer | renderer, |
unsigned int | index, | ||
ULString | id, | ||
unsigned int | axis_count, | ||
unsigned int | button_count | ||
) |
Describe the details of a gamepad, to be used with ulFireGamepadEvent and related events below.
This can be called multiple times with the same index if the details change.
renderer | The active renderer instance. |
index | The unique index (or "connection slot") of the gamepad. For example, controller #1 would be "1", controller #2 would be "2" and so on. |
id | A string ID representing the device, this will be made available in JavaScript as gamepad.id |
axis_count | The number of axes on the device. |
button_count | The number of buttons on the device. |
ULExport bool ulStartRemoteInspectorServer | ( | ULRenderer | renderer, |
const char * | address, | ||
unsigned short | port | ||
) |
Start the remote inspector server.
While the remote inspector is active, Views that are loaded into this renderer will be able to be remotely inspected from another Ultralight instance either locally (another app on same machine) or remotely (over the network) by navigating a View to:
ULExport void ulUpdate | ( | ULRenderer | renderer | ) |
Update timers and dispatch internal callbacks (JavaScript and network).