Run the minimal sample
This page is on the Git route, after Build Labrador. With the starter project, your game is this sample already; read What you are looking at below for what its code does. To run this sample, LineSweeper or the others from a starter project, follow Run the samples.
The build you just ran also built the minimal sample. Start it from the Labrador folder, in the
same x64 Native Tools Command Prompt. If you closed that window, open a new one and run the
cd line first; otherwise the second line is enough:
cd /d C:\dev\Labradorout\build\x64-debug\samples\minimal\MinimalSample.exeThe prompt is ready for the next command as soon as the window opens; the sample keeps running
until you quit it. If the prompt answers The system cannot find the path specified. or says
the program is not recognized as an internal or external command, the build in the previous
step did not finish: run cmake --build --preset x64-debug again and read its last lines.
A 1280×720 window opens with the line Hello from the engine. circling a point, and a hint along the bottom. Move the point with the left stick of a gamepad, the arrow keys or WASD. Press B or Escape and the sample asks whether you really want to quit; A or Enter quits, and B or Escape goes back.
The sample copies its content beside the executable when it builds, so it runs from any folder.
What you are looking at
Section titled “What you are looking at”The sample is about 960 lines of C++, its tests and its browser entry point included, and about a third of them are comments explaining the code below them. Three parts are worth knowing before you copy it in the next step.
main.cpp makes the decisions only a game can make: the window’s title and size, where the
content is, and which state runs first. Everything else is the engine’s.
options.window_class_name = L"MinimalSampleWindowClass"; // ASCII only: this file gets copied into new projects, and a wide // literal's encoding depends on how the compiler was told to read the // source. options.window_title = L"Labrador - minimal sample";
// A smoke test gets the whole shell - window, device, services - with // nothing on screen and no focus taken. options.visible = !smoke_test; // The hidden smoke still presents each frame. Request no display // sync interval so this check can run on software-only CI. options.vsync = !smoke_test;
// One pane, so one view's worth of recording state. The default is four // - four-player split-screen, the widest layout the engine has a client // for - and every view above what a frame draws is a deferred context // and a dynamic vertex buffer created at startup and never used. // A game that fans out says so here; this one does not. options.view_capacity = 1;
#if defined(GAME_HAS_ICON_RESOURCE) // CMake enables this block only when GAME_ICON_FILE selects your icon. options.window_icon_resource = L"GAME_ICON";#endif
#if defined(LABRADOR_SAMPLE_PROCESS_OBSERVATIONS) minimal_observation::ProcessReport process_report(&app, smoke_test, LABRADOR_OBSERVATION_SOURCE_REVISION);#endif app.initialize();
// Everything this sample draws, named in content/manifest.json. A game // with its own kinds of asset - levels, dialogue, whatever it has - // teaches them to app.resource_loader() before this line. // // Beside the executable, wherever the executable was started from: // a relative path here is relative to the game, not to the working // directory (Application::load_manifest), and the build copies the // content there. app.load_manifest("./manifest.json");
if (smoke_test) { first_state = std::make_unique<SmokeTest>(&app, std::move(first_state)); } return app.run(std::move(first_state));samples/minimal/main.cpp, lines 108–157 at aceb130
A state is a screen or mode of the game. The engine calls a state’s init() once, then its
update() every step, sixty times a second, and its draw() every frame. HelloState puts its two lines of text in a scene and
gives the scene one view covering the whole window:
L"Hello from the engine.", font_name, this->motion_.centre, resources,
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, labrador::Colour::dark_gray));
for (Label*& marker : this->touch_markers_){ marker = this->scene_->add(std::make_unique<Label>(L"", font_name,}
// Every add is pending until a tick ends, so that a weapon firing mid-tick// cannot invalidate the loop walking the objects. Nothing has ticked yet// and the first frame is a real frame, so the first tick ends here.this->scene_->end_tick();
// One view, for the whole window, in screen space - the identity camera is// what a list starts with, so this one is never mentioned again. A// split-screen game clears this list and refills it every tick, one entry// per player, and nothing else about the shape changes.samples/minimal/states/hello_state.cpp, lines 84–110 at aceb130
The question is a second state, pushed on top of the first. ConfirmState knows nothing
about the screen below it. It hands back a bool when it closes, and HelloState decides what
the answer means. While the question is up, HelloState stops updating and dims its greeting,
and because the question does not cover the whole screen, the greeting stays visible underneath.
The other sample
Section titled “The other sample”LineSweeper, the falling-block game, was built too. From the same Labrador folder:
out\build\x64-debug\samples\linesweeper\LineSweeperSample.exeEscape pauses it; press Down until QUIT is chosen, then Enter, to quit. Once the board fills and it says TOPPED OUT, Escape does nothing: press R to start a new match first. Examples lists its controls and the order in which to read its code, and Run the samples starts the other four. LineSweeper is there to be read, though. The minimal sample is the one you copy, and the next step does that.
Development documentation (unreleased). Built from Labrador aceb130 of 2026-11-20.