![]() |
Ultralight C++ API 1.3.0
|
#include <Ultralight/Renderer.h>
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 Renderer::Create.
You should call Renderer::Update() from your main update loop as often as possible to give the library an opportunity to dispatch events and timers:
When your program is ready to display a new frame (usually in synchrony with the monitor refresh rate), you should call Renderer::Render() so the library can render all active Views as needed.
Static Public Member Functions | |
static RefPtr< Renderer > | Create () |
Create the core renderer singleton for the library. | |
Public Member Functions | |
virtual RefPtr< Session > | CreateSession (bool is_persistent, const String &name)=0 |
Create a unique, named Session to store browsing data in (cookies, local storage, application cache, indexed db, etc). | |
virtual RefPtr< Session > | default_session ()=0 |
Get the default Session. | |
virtual RefPtr< View > | CreateView (uint32_t width, uint32_t height, const ViewConfig &config, RefPtr< Session > session)=0 |
Create a new View to load and display web pages in. | |
virtual void | Update ()=0 |
Update timers and dispatch callbacks. | |
virtual void | Render ()=0 |
Render all active views to their respective surfaces and render targets. | |
virtual void | RenderOnly (View **view_array, size_t view_array_len)=0 |
Render a subset of views to their respective surfaces and render targets. | |
virtual void | PurgeMemory ()=0 |
Attempt to release as much memory as possible. | |
virtual void | LogMemoryUsage ()=0 |
Print detailed memory usage statistics to the log. | |
virtual bool | StartRemoteInspectorServer (const char *address, uint16_t port)=0 |
Start the remote inspector server. | |
virtual void | SetGamepadDetails (uint32_t index, const String &id, uint32_t axis_count, uint32_t button_count)=0 |
Describe the details of a gamepad, to be used with FireGamepadEvent and related events below. | |
virtual void | FireGamepadEvent (const GamepadEvent &evt)=0 |
Fire a gamepad event (connection / disconnection). | |
virtual void | FireGamepadAxisEvent (const GamepadAxisEvent &evt)=0 |
Fire a gamepad axis event (to be called when an axis value is changed). | |
virtual void | FireGamepadButtonEvent (const GamepadButtonEvent &evt)=0 |
Fire a gamepad button event (to be called when a button value is changed). | |
![]() | |
virtual void | AddRef () const =0 |
virtual void | Release () const =0 |
virtual int | ref_count () const =0 |
Protected Member Functions | |
virtual | ~Renderer () |
![]() | |
virtual | ~RefCounted () |
|
protectedvirtual |
Create the core renderer singleton for the library.
You should set up the Platform singleton before calling this function.
|
pure virtual |
Create a unique, named Session to store browsing data in (cookies, local storage, application cache, indexed db, etc).
is_persistent | Whether or not to store the session on disk. Persistent sessions will be written to the path set in Config::cache_path |
name | A unique name for this session, this will be used to generate a unique disk path for persistent sessions. |
|
pure virtual |
Create a new View to load and display web pages in.
Views are similar to a tab in a browser. They have certain dimensions but are rendered to an offscreen surface and must be forwarded all input events.
width | The initial width, in pixels. |
height | The initial height, in pixels. |
config | Configuration details for the View. |
session | The session to store local data in. Pass a nullptr to use the default session. |
Get the default Session.
This session is persistent (backed to disk) and has the name "default".
|
pure virtual |
Fire a gamepad axis event (to be called when an axis value is changed).
|
pure virtual |
Fire a gamepad button event (to be called when a button value is changed).
|
pure virtual |
Fire a gamepad event (connection / disconnection).
|
pure virtual |
Print detailed memory usage statistics to the log.
|
pure virtual |
Attempt to release as much memory as possible.
|
pure virtual |
Render all active views to their respective surfaces and render targets.
You should call this once per frame (usually in synchrony with the monitor's refresh rate).
|
pure virtual |
Render a subset of views to their respective surfaces and render targets.
view_array | A C-array containing a list of View pointers. |
view_array_len | The length of the C-array. |
|
pure virtual |
Describe the details of a gamepad, to be used with FireGamepadEvent and related events below.
This can be called multiple times with the same index if the details change.
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. |
|
pure virtual |
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:
|
pure virtual |
Update timers and dispatch callbacks.
You should call this as often as you can from your application's run loop.