Hummingbird comes with a set of a samples showcasing various features of the SDK. The samples use a common infrastructure that simulates a game engine (i.e. main loop). This document described some of the classes in our sample framework and our current samples.
Important classes
CohtmlApplication
is responsible for initializing Hummingbird (cohtml::Library, cohtml::System, cohtml::View and their rendering counterparts). It is also responsible to call Advance
and Paint
. To add extra behavior on top of these basic functions, we use the Sample
class.
Sample
is an abstract class that allows to easily extend the default behavior exhibited by CohtmlApplication
to focus on specific features.
Application
is responsible for:
- creating a native OS window
- reading input from the OS and forwarding it to the Hummingbird
IRenderer
and its implementations (RendererDx11
, RendererGL
, etc.) are responsible for initializing the respective graphics API and using it to draw the UI
Existing samples
- MinimalHelloHummingbird is the simplest example by far. It contains only the absolutely necessary steps needed to get Hummingbird up and running.
- HelloHummingbird contains a simple example meant as a introduction to Hummingbird and the sample framework. It does one thing only - loads a hardcoded URL.
- The Localization sample shows how to implement your version of
cohtml::LocalizationManager
and integrate Hummingbird's localization system with your engine's.
- Nameplates is a sample demonstrating how to transfer data between C++ and JavaScript. A simple generator class randomly generates values for 4 nameplates (health, mana and position) and sends that data to JavaScript which in turn updates the UI.
- One interesting feature of Hummingbird is the ability to load cooked files in place of uncooked files (e.g. automatically load .dds textures even if the HTML file is referring to a .png). The ImageFallbackFormats sample demonstrates how to extend your implementation of
cohtml::IAsyncResourceHandler
to achieve that.
- The HTTP sample demonstrates how to load files via HTTP(S) requests.
- The TextureAtlasing sample demonstrates how to use the texture atlases, generated by the Atlas Creator tool, inside Hummingbird.