Common-task quick reference
For game code after the starter is running: eight common tasks, with declarations read from this checkout’s published headers. This is a lookup page; the linked full contracts own preconditions, errors, lifetimes and platform limits.
Built from aceb130. Match the documentation version to your engine pin; Which Labrador you have explains how.
Browse all modules and headers or follow a guide for a complete example. Member declarations below appear in their named class; they are not a standalone program. All public overloads of each selected name are shown.
Run and quit the game
Section titled “Run and quit the game”Give the application its first state. The application owns the loop and the platform lifecycle.
// Application::run// Application::quitvoid quit() const;Contracts: Application::run (header) · Application::quit (header).
Guide and example: Read your starter’s C++.
Change screens or open a pause screen
Section titled “Change screens or open a pause screen”Replace the current state, push a screen above it, or pop back. Read the contracts for deferral and result delivery.
// StateContext::transition_to// StateContext::pushvoid push(std::unique_ptr<State> state);void push(std::unique_ptr<State> state, std::function<void()> on_closed);template <typename Result>void push(std::unique_ptr<State> state, std::function<void(const Result&)> on_result);// StateContext::popvoid pop();template <typename Result>void pop(const Result& result);Contracts: StateContext::transition_to (header) · StateContext::push (header) · StateContext::pop (header).
Guide and example: Add another screen.
Load and find a picture
Section titled “Load and find a picture”Load named content from a manifest, then resolve the texture handle a drawable keeps.
// ResourceLoader::load_manifest// RenderResources::resolve_textureTextureHandle resolve_texture(const std::string& texture_name) const;Contracts: ResourceLoader::load_manifest (header) · RenderResources::resolve_texture (header).
Guide and example: Assets.
Read a key or typed text
Section titled “Read a key or typed text”Read the fixed update’s input snapshot. Key positions and UTF-8 typed characters are separate channels; bindings belong to the game.
// Keyboard::held// Keyboard::pressedbool pressed(Key key) const;// Keyboard::typedstd::string_view typed() const;Contracts: Keyboard::held (header) · Keyboard::pressed (header) · Keyboard::typed (header).
Guide and example: Input.
Own objects in a scene
Section titled “Own objects in a scene”Transfer ownership to the scene and commit pending changes at the tick boundary. Returned pointers borrow the object’s scene lifetime.
// Scene::addtemplate <typename T>T* add(std::unique_ptr<T> object);// Scene::remove// Scene::end_tickvoid end_tick();Contracts: Scene::add (header) · Scene::remove (header) · Scene::end_tick (header).
Guide and example: The game and its objects.
Draw a sprite through a camera
Section titled “Draw a sprite through a camera”Record into the supplied view’s draw list. Draw stays const; order, coordinates, tint and handle lifetime follow the full contract.
// DrawList::set_camera// DrawList::draw_spritevoid draw_sprite(TextureHandle texture, float rotation, float layer_depth);Contracts: DrawList::set_camera (header) · DrawList::draw_sprite (header).
Guide and example: Sprites and text.
Change displayed words
Section titled “Change displayed words”Text stores wide characters and measures when the words change. Convert UTF-8 at the edit boundary and check the font’s coverage.
// Text::set_textvoid set_text(const std::wstring& text) override;// Text::set_positionContracts: Text::set_text (header) · Text::set_position (header).
Guide and example: Put words on screen.
Play a one-shot sound
Section titled “Play a one-shot sound”Resolve a wave from the loaded bank, then play it. Browser activation, silent banks and suspended playback have explicit contracts.
// SoundBank::resolve_waveWaveHandle resolve_wave(const std::string& wave_name) const;// SoundBank::play_wavevoid play_wave(WaveHandle wave, float volume = 1.0f, float pitch = 0.0f, float pan = 0.0f) const;Contracts: SoundBank::resolve_wave (header) · SoundBank::play_wave (header).
Guide and example: Audio.
Development documentation (unreleased). Built from Labrador aceb130 of 2026-11-20.