Skip to content

Copy the components into your game

The engine comes with a components sample: small pieces of game code that are not part of the engine, which you copy into your game and then change as you like. This page copies two of them into the game from Get the starter project: an option row, a label with a value picked from a list, and a slider, a label with a bar and a number. It puts both at the top of the starter’s screen, one choosing the greeting’s colour and the other how fast it moves, with keys to work them. It goes through every file that changes: four copied files, the first line of two of them, the build file, and the starter’s HelloState. It takes about 20 minutes. A last, optional step copies the two components’ tests as well, so that ctest checks your copies on every build.

Before you start:

  • Do Make a first change, so that you know the edit, build and run loop and have a copy of your game to go back to. Make a fresh copy now with that page’s step 1 line.
  • Read a build error is worth a look first. This page adds two source files, and a slip in the build file shows up as a linker error.

Every command runs in the x64 Native Tools Command Prompt, in your project’s folder:

Terminal window
cd /d C:\dev\mygame
  1. Copy the four files. The components sample is inside the engine’s folder in your project, at external\labrador\samples\components. The option row is option_row.h and option_row.cpp; the slider is slider.h and slider.cpp. Make a folder for them in your game and copy them into it:

    Terminal window
    mkdir game\components
    copy external\labrador\samples\components\option_row.h game\components\
    copy external\labrador\samples\components\option_row.cpp game\components\
    copy external\labrador\samples\components\slider.h game\components\
    copy external\labrador\samples\components\slider.cpp game\components\

    mkdir prints nothing, and each copy line prints:

    Output
    1 file(s) copied.

    These four are all you need. The two headers include only engine headers, such as engine/ui/widget.h, which your game already reaches, and each .cpp includes only its own header and engine headers. The slider’s bar is a small class called Bar, and it is inside slider.h and slider.cpp, so it comes with them. The rest of the folder is the sample’s own screen, its tests, which step 7 copies if you want them, and other pieces such as the nine-slice, animation preview and desktop text field.

    The \ at the end of each copy line matters. With it, copy stops with an error if game\components is not there. Without it, copy would make a file called components and still print 1 file(s) copied.

    Leave the files in external\labrador as they are. That folder is the engine; the copies in game\components are yours.

  2. Point each copied .cpp at its new header. The first line of each .cpp includes its own header by its path in the engine’s folder. Change it to the path of your copy. Open the first:

    Terminal window
    notepad game\components\option_row.cpp

    The first line is:

    #include "samples/components/option_row.h"

    Change it to this, then save and close Notepad:

    #include "game/components/option_row.h"

    Then the second:

    Terminal window
    notepad game\components\slider.cpp

    Change its first line from:

    #include "samples/components/slider.h"

    to this, then save and close Notepad:

    #include "game/components/slider.h"

    Do not skip this step because the game builds without it. The engine’s folder is on the include path, so the old line still finds a file: the engine’s copy of the header, not yours. Nothing goes wrong until you change your header, and then the error points at the wrong file; If something fails shows it. To check that no line still names the engine’s copy, run:

    Terminal window
    findstr /s /n "samples/components" game\*.cpp game\*.h

    After the two edits it prints nothing. Before them it prints both lines, and if one was missed it prints that one, with its file and line number:

    Output
    game\components\option_row.cpp:1:#include "samples/components/option_row.h"
    game\components\slider.cpp:1:#include "samples/components/slider.h"

    The two headers need no change. Their classes are in a namespace called components, so in your game they are components::OptionRow and components::Slider. You can rename the namespace later if you like; this page keeps it.

  3. List both .cpp files, twice, in the build file. Every source file of your game is listed by name in game\CMakeLists.txt, and the game’s files are listed twice: once for the browser build and once for Windows. A file missing from the Windows list stops the Windows build with LNK2019; one missing from the browser list stops only the browser build, with undefined symbol. Open the build file:

    Terminal window
    notepad game\CMakeLists.txt

    Search with Ctrl+F for states/confirm_state.cpp. The first match is in the browser list, near the top, inside if(EMSCRIPTEN):

    add_executable(MyGame
    main_web.cpp
    states/confirm_state.cpp
    states/hello_state.cpp
    )

    Add two lines after main_web.cpp, so the list reads:

    add_executable(MyGame
    main_web.cpp
    components/option_row.cpp
    components/slider.cpp
    states/confirm_state.cpp
    states/hello_state.cpp
    )

    Then press F3 to find the next states/confirm_state.cpp. This one is in the Windows list, further down:

    add_executable(MyGame WIN32
    main.cpp
    states/confirm_state.cpp
    states/hello_state.cpp
    dpi_aware.manifest
    )

    Add the same two lines after main.cpp, so it reads:

    add_executable(MyGame WIN32
    main.cpp
    components/option_row.cpp
    components/slider.cpp
    states/confirm_state.cpp
    states/hello_state.cpp
    dpi_aware.manifest
    )

    The paths are written from the game folder, with forward slashes. Save and close Notepad.

  4. Give HelloState the two rows. Open the header of the state that runs the starter’s screen:

    Terminal window
    notepad game\states\hello_state.h

    Search for game/rules/motion.h and add three lines above it, so the four read:

    #include "engine/ui/focus.h"
    #include "game/components/option_row.h"
    #include "game/components/slider.h"
    #include "game/rules/motion.h"

    Then search for hint_ = nullptr; and add three lines after it, so the four read:

    labrador::Label* hint_ = nullptr;
    components::OptionRow* colour_row_ = nullptr;
    components::Slider* speed_row_ = nullptr;

    colour_row_ and speed_row_ are where HelloState keeps the two rows, so that it can reach them later. The FocusGroup is the engine’s cursor: it knows which row is chosen and draws that row’s label white and the others grey. Save and close Notepad.

  5. Build the rows, and work them. Open the state’s code:

    Terminal window
    notepad game\states\hello_state.cpp

    There are six changes, in the order they come in the file, from the top.

    First, search for #include "engine/math/vector2f.h" and add a line after it, so the two read:

    #include "engine/math/vector2f.h"
    #include "engine/render/resource_factory.h"

    Then search for #include <string> and add a line after it, so the two read:

    #include <string>
    #include <vector>

    Second, search for constexpr float stick_deadzone = 0.2f;. Click at the end of that line, press Enter, and paste these lines:

    // The greeting's colour for each choice on the colour row, in the same
    // order as the row's list of names.
    Colour greeting_colour(size_t index)
    {
    const std::vector<Colour> colours = {
    labrador::Colour::white, labrador::Colour::gold,
    labrador::Colour::coral, labrador::Colour::light_green };
    return colours[index];
    }

    Third, search for this->hint_ = this->scene_->add(. This is the part of init() that adds the controls hint at the bottom of the window:

    samples/minimal/states/hello_state.cpp
    this->hint_ = this->scene_->add(std::make_unique<Label>(
    L"Left stick, arrows or WASD move it. B or Escape asks to quit. Touch shows a marker.", font_name,
    Vector2F(24.0f, resolution.y - 40.0f), resources,

    Click at the end of its last line, labrador::Colour::dark_gray));, press Enter, and paste these lines:

    // Two rows from game/components, at the top left: the greeting's colour
    // and its speed, in percent. The slider's bar is drawn with the engine's
    // own white texture.
    this->colour_row_ = this->scene_->add(
    std::make_unique<components::OptionRow>("colour", L"Colour",
    std::vector<std::wstring>{ L"White", L"Gold", L"Coral", L"Green" },
    0, Vector2F(24.0f, 24.0f), 160.0f, font_name, resources,
    [this](size_t index)
    {
    this->greeting_->set_colour(greeting_colour(index));
    }));
    this->speed_row_ = this->scene_->add(
    std::make_unique<components::Slider>("speed", L"Speed",
    0, 200, 25, 100, Vector2F(24.0f, 64.0f),
    RectangleF(160.0f, 68.0f, 200.0f, 10.0f), font_name,
    resources->resolve_texture(white_texture_name), resources));
    this->scene_->add(std::make_unique<Label>(
    L"I and K choose a row. J and L change it.", font_name,
    Vector2F(24.0f, 104.0f), resources, labrador::Colour::dark_gray));
    // The cursor starts on the first row added.
    this->focus_.add(this->colour_row_);
    this->focus_.add(this->speed_row_);

    This builds the two rows and adds them to the scene, which draws them with everything else, then a line of help under them, and gives both rows to the cursor. The part in [this](size_t index) { ... } is what the colour row runs each time its value changes: it gives the greeting the colour for the new choice. What the numbers mean below goes through the rest.

    Fourth, search for The stick is in this engine's convention. It is a comment in update(), just after the part that asks whether to quit. Click at the start of that line and paste these lines above it, with an empty line after them:

    // The rows read no keys themselves. I and K move the cursor between them,
    // and J and L go to whichever row the cursor is on.
    if (keyboard.pressed(Key::i))
    {
    this->focus_.move(0, Direction::up);
    }
    if (keyboard.pressed(Key::k))
    {
    this->focus_.move(0, Direction::down);
    }
    Direction change = Direction::none;
    if (keyboard.pressed(Key::j))
    {
    change = Direction::left;
    }
    if (keyboard.pressed(Key::l))
    {
    change = Direction::right;
    }
    if (this->focus_.focused(0) == this->colour_row_)
    {
    this->colour_row_->adjust(change);
    }
    else if (this->focus_.focused(0) == this->speed_row_)
    {
    this->speed_row_->adjust(change);
    }

    A component never reads the keyboard: which keys work it is your game’s choice, so that the same row works with any keys or a gamepad. Here I and K move the cursor up and down, through focus_.move, and J and L are sent to the row the cursor is on, through its adjust. The arrows and WASD still move the greeting, as before.

    Fifth, a few lines further down is the line that moves the greeting on:

    samples/minimal/states/hello_state.cpp
    this->motion_ = step_motion(this->motion_,
    stick_direction,
    keyboard_direction(keyboard), dt);

    Search for keyboard_direction(keyboard), dt); and change that one line to these two:

    keyboard_direction(keyboard),
    dt * static_cast<float>(this->speed_row_->value()) / 100.0f);

    dt is the time since the last step, a sixtieth of a second. Multiplying it by the slider’s value over 100 makes the greeting move and spin at that percentage of its usual speed: half as fast at 50, twice as fast at 200, and not at all at 0.

    Sixth, search for this->greeting_->set_colour(labrador::Colour::white);. It is in on_resume(), which puts the greeting’s colour back after the Really quit? question closes. Change that line to:

    this->greeting_->set_colour(greeting_colour(this->colour_row_->index()));

    so that it puts back the colour the row has chosen rather than white. Save and close Notepad.

  6. Build, test and run. Quit the game if it is open, then run the line from Make a first change’s step 5:

    Terminal window
    cmake --build --preset x64-debug && ctest --preset x64-debug && out\build\x64-debug\game\MyGame.exe

    The build first runs CMake again, because game\CMakeLists.txt changed. That prints [0/1] Re-running CMake... and about 30 lines from vcpkg and CMake, including a list of packages; they are expected, not errors. Then it compiles the two new files and the files that include hello_state.h. On a fast desktop the whole build took 8 seconds. It ends like this:

    Output
    -- Build files have been written to: C:/dev/mygame/out/build/x64-debug
    [1/8] Running utility command for game_content
    [2/8] Checking that no engine file includes a game header
    [3/8] Building CXX object game\CMakeFiles\MyGame.dir\components\option_row.cpp.obj
    [4/8] Building CXX object game\CMakeFiles\MyGame.dir\components\slider.cpp.obj
    [5/8] Building CXX object game\CMakeFiles\MyGame.dir\states\hello_state.cpp.obj
    [6/8] Building CXX object game\CMakeFiles\MyGame.dir\main.cpp.obj
    [7/8] Linking CXX executable game\MyGame.exe
    Test project C:/dev/mygame/out/build/x64-debug
    Start 1: MyGameTests
    1/2 Test #1: MyGameTests ...................... Passed 0.01 sec
    Start 2: MyGameSmokeTests
    2/2 Test #2: MyGameSmokeTests ................. Passed 0.74 sec
    100% tests passed, 0 tests failed out of 2

    Then the game opens. At the top left are two rows and a line of help:

    • Colour, in white because the cursor is on it, with White beside it in amber.
    • Speed, in grey, with a bar half filled and 100 beside it.
    • I and K choose a row. J and L change it.

    Press L and the colour row says Gold and the greeting turns gold. Pressing L again goes on through Coral and Green and back to White; J goes the other way. Press K to move the cursor to the speed row: its label and the filled part of its bar turn white. L adds 25, up to 200, and the greeting circles faster; J takes 25 away, down to 0, where the greeting stops and the arrows no longer move it. Each press moves a row by one step; holding a key down does not repeat. Press Escape: the greeting dims behind the Really quit? question, and when you answer no with Escape again, it comes back in the colour the row chose.

  7. Optional: copy their tests too. Each component has tests beside it in the engine’s folder. They build the rows with no window and no graphics device and check what they do: that a row steps through its choices and goes round at the ends, that a slider stops at its lowest and highest, that a wrong range stops with a message. Copied into your game, they run with your other tests on every build, so a change to your copy that breaks one of those shows up in ctest rather than while you play. The game works without them; skip this step if you do not want them.

    Copy the two test files, test_content.h, which makes the stand-in font they measure text with, and test_main.cpp, which gives the tests their main:

    Terminal window
    copy external\labrador\samples\components\option_row_tests.cpp game\components\
    copy external\labrador\samples\components\slider_tests.cpp game\components\
    copy external\labrador\samples\components\test_content.h game\components\
    copy external\labrador\samples\components\test_main.cpp game\components\

    Each copy line prints 1 file(s) copied., as in step 1. Then run step 2’s check again:

    Terminal window
    findstr /s /n "samples/components" game\*.cpp game\*.h

    Each test file includes its component and test_content.h by their paths in the engine’s folder, so it prints four lines:

    Output
    game\components\option_row_tests.cpp:3:#include "samples/components/option_row.h"
    game\components\option_row_tests.cpp:4:#include "samples/components/test_content.h"
    game\components\slider_tests.cpp:3:#include "samples/components/slider.h"
    game\components\slider_tests.cpp:4:#include "samples/components/test_content.h"

    Open each file with notepad game\components\option_row_tests.cpp and notepad game\components\slider_tests.cpp, change samples/components/ to game/components/ in lines 3 and 4, and save. For the same reason as in step 2, the tests build without this change, but they test the engine’s copy of the header rather than yours. Run the findstr line again; it now prints nothing.

    The tests need a target of their own. The starter’s MyGameTests links only the engine’s maths, so that the rules are tested with nothing else, and the components need the engine’s text and widgets. Open the build file:

    Terminal window
    notepad game\CMakeLists.txt

    Search for add_test(NAME MyGameTests COMMAND MyGameTests). Click at the end of that line, press Enter twice, and paste these lines:

    # The components' tests. They build the rows from the engine's text and
    # widgets, so unlike MyGameTests this links the engine, as MyGame does. It
    # makes no window and no graphics device.
    add_executable(MyGameComponentTests
    components/option_row.cpp
    components/option_row_tests.cpp
    components/slider.cpp
    components/slider_tests.cpp
    components/test_main.cpp
    )
    target_link_libraries(MyGameComponentTests PRIVATE
    MyGameRules
    LabradorEngine
    doctest::doctest
    labrador_settings
    )
    add_test(NAME MyGameComponentTests COMMAND MyGameComponentTests)

    It is above if(EMSCRIPTEN), so the Windows and the browser builds both make it, and it is listed once. option_row.cpp and slider.cpp are in it as well as in the game’s lists, so each is compiled once for the game and once for the tests. MyGameRules is there for the reason MyGame links it: it carries the include root that game/components/... include lines are found from. In the browser build the tests run under Node, like MyGameTests, so search for target_link_options(MyGameTests PRIVATE -sENVIRONMENT=node) and add a line after it, so the two read:

    target_link_options(MyGameTests PRIVATE -sENVIRONMENT=node)
    target_link_options(MyGameComponentTests PRIVATE -sENVIRONMENT=node)

    Save and close Notepad, then build and test:

    Terminal window
    cmake --build --preset x64-debug && ctest --preset x64-debug

    CMake runs again, with the same 30 or so lines as in step 6, and then ctest runs three tests:

    Output
    [1/9] Running utility command for game_content
    [2/9] Checking that no engine file includes a game header
    [3/9] Building CXX object game\CMakeFiles\MyGameComponentTests.dir\components\option_row.cpp.obj
    [4/9] Building CXX object game\CMakeFiles\MyGameComponentTests.dir\components\slider.cpp.obj
    [5/9] Building CXX object game\CMakeFiles\MyGameComponentTests.dir\components\slider_tests.cpp.obj
    [6/9] Building CXX object game\CMakeFiles\MyGameComponentTests.dir\components\option_row_tests.cpp.obj
    [7/9] Building CXX object game\CMakeFiles\MyGameComponentTests.dir\components\test_main.cpp.obj
    [8/9] Linking CXX executable game\MyGameComponentTests.exe
    Test project C:/dev/mygame/out/build/x64-debug
    Start 1: MyGameTests
    1/3 Test #1: MyGameTests ...................... Passed 0.02 sec
    Start 2: MyGameComponentTests
    2/3 Test #2: MyGameComponentTests ............. Passed 0.05 sec
    Start 3: MyGameSmokeTests
    3/3 Test #3: MyGameSmokeTests ................. Passed 0.84 sec
    100% tests passed, 0 tests failed out of 3

    From now on every ctest in the guides runs three tests where they show two. The tests are yours, like the components: when you change what a component does on purpose, change the test that checks it, as A component test fails below shows.

The option row is built from these, in this order. Its header, your game\components\option_row.h, says the same above each part:

samples/components/option_row.h
OptionRow(const std::string& name,
const std::wstring& label,
std::vector<std::wstring> choices,
size_t index,
const labrador::Vector2F& label_position,
float value_x,
const std::string& font_name,
labrador::RenderResources* render_resources,
Changed on_change = nullptr,
bool wrap = true);

In step 5’s call, "colour" is a name for the row, used in error messages, and L"Colour" is the label you see; the L before the quotation mark makes it the kind of text the engine draws. The list is the choices, and 0 is the one it starts on, counted from 0, so White. Vector2F(24.0f, 24.0f) is where the label’s top-left corner goes, 24 pixels from the window’s left edge and 24 down from the top, and 160.0f is how far from the left edge the value is drawn. font_name and resources are the starter’s own font and the engine’s table of loaded pictures and fonts. Then comes the code run on a change. wrap is left out, so it is true: L on the last choice goes back to the first. Pass false after the change code, as in }, false));, and the row stops at either end, which suits a list such as Easy, Normal, Hard.

The slider is built from these:

samples/components/slider.h
Slider(const std::string& name,
const std::wstring& label,
int minimum,
int maximum,
int step,
int value,
const labrador::Vector2F& label_position,
const labrador::RectangleF& track,
const std::string& font_name,
labrador::TextureHandle block,
labrador::RenderResources* render_resources,
Changed on_change = nullptr);

In step 5’s call, the four numbers 0, 200, 25, 100 are the lowest value, the highest, how much one press changes it, and the value it starts at. The slider never wraps: at 200 another L does nothing. RectangleF(160.0f, 68.0f, 200.0f, 10.0f) is the bar: its left edge, its top, its width and its height, in pixels. The number is drawn 16 pixels after the bar’s right end. resolve_texture(white_texture_name) is the engine’s one-pixel white picture, which the slider stretches and tints to draw its bar, so the bar needs no picture of your own. The slider has its own code-on-change at the end too; this page leaves it out and reads value() on every step instead.

The repository’s newer TextField is another piece to copy. It is separate from the option-row/slider exercise above and need not be present in an older starter ZIP. Take text_field.h and text_field.cpp from the current components example, rewrite the .cpp’s first include to your copy, and list it in both native and browser game targets. If you want its portable tests, also copy text_field_tests.cpp, rewrite its same include, and add the copied component and test .cpp to your component-test target. Its in-memory font fixture needs no device or asset file.

The gallery constructs the field with its loaded font and resource table:

samples/components/gallery_state.cpp
this->name_ = this->scene_->add(std::make_unique<TextField>("name",
L"Name", "Player", TextFieldLimits{ 12, 180.0f },
Vector2F(900.0f, 500.0f), 960.0f, font_name, resources));

It stores UTF-8, shows an end caret while editing and converts to the existing wide rendering text with widen when an edit changes the display. The page reads Keyboard::typed() and decides when to call begin_edit, append, backspace, confirm and cancel; the component does not poll devices or decide bindings. The gallery’s input wiring gives those keys priority over its normal menu actions, ignores the opening input snapshot, and cancels on state deactivation, observed keyboard-focus loss or an outside press. It also drops pending pointer completion when a keyboard command ends an edit.

A batch is accepted or refused as a whole. Limits count code points rather than bytes, and the width includes the drawn caret so trailing spaces cannot silently overflow it. The gallery allows 12 characters with its actual ASCII font; an unsupported character is refused, even though that font could otherwise draw a stand-in question mark. A font with suitable BMP glyphs can accept precomposed accents and punctuation, as the field’s two/three-byte deletion tests demonstrate. The existing Font language limits still apply: this adds no shaping, combining-mark placement or right-to-left layout.

This is desktop code-point editing. It has no middle caret, selection, clipboard, IME-composition API or phone keyboard support. Backspace removes one point on a new press; it does not repeat while held. The component’s contract states confirm/cancel, same-poll command precedence, refusal and copied-test details.

Another colour. Add a name to the row’s list in init() and a colour to the list in greeting_colour, at the same place in each. The two lists must stay the same length and in the same order: the row passes the number of its choice, and greeting_colour uses it to pick from its own list. A choice with no colour beside it asks for a colour past the end of the list, and the game stops; If something fails shows the message. The engine’s colour names, such as Colour::sky_blue or Colour::orange, are listed in external\labrador\engine\render\colour.h.

Another range. Change the four numbers in the slider’s call. The lowest must be below the highest, the step above 0, and the starting value between the lowest and the highest, or the game stops when it starts; If something fails shows the message.

Other keys. Change Key::i, Key::k, Key::j and Key::l in step 5’s fourth change. The key names are in external\labrador\engine\input\keyboard.h. The arrows and WASD already move the greeting, which is why this page uses I, J, K and L. Avoid Tab and F1 to F12: in the browser build the game sees them, but the browser acts on them too. Tab moves the keyboard off the game, so the keys after it stop arriving, and F5 reloads the page. The components sample’s own screen also repeats a held key and takes the gamepad’s d-pad; its GalleryState::update in samples/components/gallery_state.cpp shows how.

Their look. The colours are at the top of your copies, which is what they are there for. In game\components\option_row.cpp, value_colour(235, 190, 90) is the amber of the value; in game\components\slider.cpp, track_colour(60, 66, 80) is the empty part of the bar and number_colour(235, 190, 90) the number. The three numbers are red, green and blue, from 0 to 255. Change them and build; the engine’s copies are not affected.

A mistake in this page’s files shows in one of four places:

  • The build stops with an error line from the compiler: a slip in the C++ code, or an include line that names the wrong file. Read a build error shows how to find the line that matters.
  • The build stops at Linking, with LNK2019 in a Windows build or undefined symbol in the browser build. Every file compiled, but one of the two new .cpp files is missing from a list in step 3.
  • The start-up test fails. The build worked, but the game stopped while building a row. The ctest output shows ***Failed for MyGameSmokeTests and, under it, a line starting startup failure: that says why. Started on its own, the game shows the same reason in a box titled Sample - startup failure, and closes when you click OK.
  • The game stops while you play, with a Debug Assertion Failed! box. The build and the tests passed, because the start-up test presses no keys; a key press asked a list for something past its end. A test that presses keys, as in Press keys in a test, can catch it.
  • A component test fails, if you did step 7. The game builds and starts, but a change to a component no longer does what its test checks.

Each message is below.

Both new files must be in the browser list in game\CMakeLists.txt as well as the Windows one, as step 3 does; nothing else changes. The rows draw the same in a browser page as in the Windows game. The components use no content files of their own, so there is no copy line or LINK_DEPENDS line to add. Tab and F1 to F12 reach the game but the browser acts on them as well, which is why the keys on this page are letters. With step 7 done, ctest --preset wasm-debug runs MyGameTests and MyGameComponentTests under Node; the start-up test is Windows only.

  • Menus explains the focus group and the engine’s widgets, and how a menu that is a screen of its own is put together.
  • Settings and saves connects a copied slider to the game’s sound volume and an option row to full screen, and An effects volume in the starter project adds a third row to this page’s two that sets the volume of the sounds from Play a sound in your game.
  • The components sample’s README describes its other copied components. Held touch controls gives the independent button/stick copy and test steps, and defines contact ownership, outside movement, camera conversion and cancellation. Try their separate page through Touch controls (F2) in the existing gallery. The page binds these values to its own marker; your game chooses its own regions and actions.

On 2026-10-30, in a starter project made from a starter ZIP of this tree at C:\dev\h5\mygame, with Visual Studio 2026’s compiler 19.51, every step above ran as shown, with C:\dev\h5\mygame in the quoted output changed to C:\dev\mygame, and each edit made exactly as the steps word it, by an agent with an editor rather than Notepad. The tests and --smoke-test passed. The game was then driven with synthetic key presses and its window captured: it drew both rows and the help line at the top left, with the cursor on Colour; K moved the cursor to Speed, three L presses filled the bar to 175, and I then L turned the row to Gold and the greeting gold; two J presses from Gold went to White and then wrapped to Green. Escape dimmed the greeting behind Really quit?, and a second Escape brought it back gold. With the slider at 0, two captures 1.5 seconds apart were the same, pixel for pixel. Each message under If something fails was made on purpose: a copy from the wrong folder and to a missing folder, a misspelt include, a function added to the header with option_row.cpp still including the engine’s copy, the two header includes removed, slider.cpp left out of each list in turn, a starting value of 300 for the slider and 4 for the row. With the include lines not rewritten and nothing else changed, the game built, passed its tests and drew the same. The wasm-debug build compiled both components and HelloState with clang, its tests passed under Node, and the page, served locally and loaded in headless Chrome, drew the two rows and the greeting; keys were not driven in the browser.

A second agent then followed the page as worded, in a fresh starter made from the same ZIP. Its build output, test results, screenshots and failure messages matched the page, including a held J moving the slider only one step and L clamping at 200. It found five things, which were corrected: the warning about a choice with no colour had no message, so it added L"Blue" with no colour, pressed L four times and captured the Debug Assertion Failed! box now shown above; the page said Tab and F1 to F12 never reach the game in the browser, which the engine’s web window does not do (it passes them to the game and lets the browser act on them as well); the findstr check prints two lines before the edits, not one; the step_right error’s line numbers depend on where the function goes; and the value’s colour is amber, not orange. The greeting_colour list was also changed to spell labrador::Colour:: like the rest of the file, and both x64-debug and wasm-debug were built again with it, with no warnings and their tests passing.

Step 7 was added on 2026-11-13 and checked in a starter project made from a starter ZIP of this tree at C:\dev\k137\mygame, with the same compiler, quoted output changed to C:\dev\mygame as above. A script made steps 1 to 5’s copies and edits as worded, and step 6’s build and two tests passed; the script then followed step 7 the same way. The findstr line printed the four lines shown before the include edits and nothing after them. The x64-debug build compiled the five files of MyGameComponentTests with no warnings, and ctest ran the three tests, which passed. bool wrap = false); in the copied option_row.h failed MyGameComponentTests with the message shown, and giving that test’s row nullptr, true passed it again. The wasm-debug preset then configured, built and ran MyGameTests and MyGameComponentTests under Node, both passing. The game was not run again, since step 7 changes no file it builds.

Development documentation (unreleased). Built from Labrador aceb130 of 2026-11-20.

All documentation versions