1.14.0.5
Hummingbird
A modern user interface library for games
cohtml::System Class Referenceabstract

A System owns multiple Views. These Views share resources among them. It is usually enough to have just one System per application run. More...

Public Member Functions

virtual ViewCreateView (const ViewSettings &settings)=0
 Creates a new View with the spcified options.
 
virtual SystemCacheStatsGetSystemCacheStats () const =0
 Returns an objects that holds the current statistics of the system-wide caches. Remember to Release when done.
 
virtual void ClearCachedUnusedImages ()=0
 Removes all unused images (raster and svg) from internal caches. More...
 
virtual SystemRendererCreateSystemRenderer (const SystemRendererSettings &settings)=0
 Creates a new SystemRenderer. The SystemRenderer will hold rendering resources shared by all view renderers.
 
virtual void AddFontsFromFolder (const char *path)=0
 Loads all fonts from the specified folder. The fonts can later be used in the Views. More...
 
virtual void AddBitmapFont (const char **imagesData, unsigned *imagesDataSize, unsigned imagesCount, const BitmapFontDescription &description)=0
 Load the bitmap font using image files. More...
 
virtual void AddBitmapFont (const IAsyncResourceResponse::UserImageData *preloadedImages, unsigned imagesCount, const BitmapFontDescription &description)=0
 Load the bitmap font using preloaded images. More...
 
virtual void SetDefaultFallbackFontName (const char *name)=0
 Loads font with given name from folders specified by AddFontsFromFolder. This font will be used when the another fond cannot be loaded or found as a default one. This font is a fallback if the font name used in a Style property is not found. If you want to change the default font that will be applied to all elements, you should change the value in LibraryParams::DefaultStyleFontFamily. More...
 
virtual void Destroy ()=0
 Destroys the System.
 
virtual void Advance (TimePoint timeMilliseconds)=0
 Advances the internal timers and inspector when available.
 
virtual void RegisterGamepad (unsigned id, const char *info, unsigned axesCount, unsigned buttonsCount, void *reserved=nullptr)=0
 Registers a new gamepad. All views will receive the gamepadconnected event. You can provide any number of axes and buttons though the standard mapping according to the HTML spec has 4 axes and 17 buttons which can be found here https://w3c.github.io/gamepad/#remapping. More...
 
virtual void UnregisterGamepad (unsigned id)=0
 Unregisters a gamepad. All views will receive the gamepaddisconnected event. More...
 
virtual void UpdateGamepadState (const cohtml::GamepadState &state)=0
 Updates the state of a single gamepad. More...
 
virtual void UpdateGamepadStateExtended (const cohtml::GamepadStateExtended &state)=0
 Updates the state of a single gamepad with motion tracking information. More...
 
virtual void UserImagesChanged (const unsigned *images, unsigned count)=0
 Trigger repaint of a user provided texture. Call this whenever the image is changed by logic external to the library. Make sure to have ImageHandle set for such images. More...
 

Detailed Description

A System owns multiple Views. These Views share resources among them. It is usually enough to have just one System per application run.

Member Function Documentation

◆ AddBitmapFont() [1/2]

virtual void cohtml::System::AddBitmapFont ( const char **  imagesData,
unsigned *  imagesDataSize,
unsigned  imagesCount,
const BitmapFontDescription description 
)
pure virtual

Load the bitmap font using image files.

Note
Images must be 1 channel alpha texture.
The memory can be freed immediately after the call
Parameters
imagesDatapointer to image files data.
imagesDataSizepointer to size of the image files.
imagesCountnumber of images
descriptionDescription of the bitmap font.

◆ AddBitmapFont() [2/2]

virtual void cohtml::System::AddBitmapFont ( const IAsyncResourceResponse::UserImageData preloadedImages,
unsigned  imagesCount,
const BitmapFontDescription description 
)
pure virtual

Load the bitmap font using preloaded images.

Note
Images must be 1 channel alpha texture.
The memory can be freed immediately after the call
Parameters
preloadedImagespointer to UserImageData structs describing the images.
imagesCountnumber of images
descriptionDescription of the bitmap font.

◆ AddFontsFromFolder()

virtual void cohtml::System::AddFontsFromFolder ( const char *  path)
pure virtual

Loads all fonts from the specified folder. The fonts can later be used in the Views.

Parameters
paththe name of the folder
Note
Requires a valid IFileSystemReader for enumerating the folder.

◆ ClearCachedUnusedImages()

virtual void cohtml::System::ClearCachedUnusedImages ( )
pure virtual

Removes all unused images (raster and svg) from internal caches.

Note
Images must be unused (orphaned) for them to be cleared. If you want to force ALL images to be unloaded you need for first call View::UnloadDocument to remove any references the DOM might still hold to the images.

◆ RegisterGamepad()

virtual void cohtml::System::RegisterGamepad ( unsigned  id,
const char *  info,
unsigned  axesCount,
unsigned  buttonsCount,
void *  reserved = nullptr 
)
pure virtual

Registers a new gamepad. All views will receive the gamepadconnected event. You can provide any number of axes and buttons though the standard mapping according to the HTML spec has 4 axes and 17 buttons which can be found here https://w3c.github.io/gamepad/#remapping.

Parameters
idthe unique identifier for the gamepad
infogeneral information for the gamepad such as producer and model
axesCountthe number of analog axes the gamepad has
buttonsCountthe number of buttons the gamepad has
reservedreserved parameter. Set to nullptr

◆ SetDefaultFallbackFontName()

virtual void cohtml::System::SetDefaultFallbackFontName ( const char *  name)
pure virtual

Loads font with given name from folders specified by AddFontsFromFolder. This font will be used when the another fond cannot be loaded or found as a default one. This font is a fallback if the font name used in a Style property is not found. If you want to change the default font that will be applied to all elements, you should change the value in LibraryParams::DefaultStyleFontFamily.

Parameters
namename of the font to load as default fallback
Note
This should be called after AddFontsFromFolder

◆ UnregisterGamepad()

virtual void cohtml::System::UnregisterGamepad ( unsigned  id)
pure virtual

Unregisters a gamepad. All views will receive the gamepaddisconnected event.

Parameters
idthe id of the gamepad to unregister

◆ UpdateGamepadState()

virtual void cohtml::System::UpdateGamepadState ( const cohtml::GamepadState state)
pure virtual

Updates the state of a single gamepad.

Parameters
statenew state of the gamepad
Note
All gamepad-related methods are system-wise. All views will get the new state.

◆ UpdateGamepadStateExtended()

virtual void cohtml::System::UpdateGamepadStateExtended ( const cohtml::GamepadStateExtended state)
pure virtual

Updates the state of a single gamepad with motion tracking information.

Parameters
statenew state of the gamepad
Note
All gamepad-related methods are system-wise. All views will get the new state.
If you do not require motion tracking, use System::UpdateGamepadState

◆ UserImagesChanged()

virtual void cohtml::System::UserImagesChanged ( const unsigned *  images,
unsigned  count 
)
pure virtual

Trigger repaint of a user provided texture. Call this whenever the image is changed by logic external to the library. Make sure to have ImageHandle set for such images.

Parameters
imagesarray of image handles - id-s of the user provided images that are changed
countthe number of changed images