Colours, the window and the background
This page changes how the game from Get the starter project looks: the greeting’s colour, its size and where it starts, the size of the window, full screen, what is behind everything and, last, smoother movement on a fast display. Each part is a few lines in one or two files, and each ends with the same build, test and run line. Do them in order or pick the ones you want: each section says what it needs from the ones before. All of them together take about 30 minutes.
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. The window’s title is on that page too, in its step 4.
Every command runs in the x64 Native Tools Command Prompt, in your project’s folder:
cd /d C:\dev\mygameThe greeting’s colour
Section titled “The greeting’s colour”-
Open the greeting’s code.
Terminal window notepad game\states\hello_state.cppSearch with Ctrl+F for
this->greeting_ = this->scene_->add(. These are the lines that make the greeting, and the last of them gives its colour. The second line has your greeting’s own words,Hello from my game.after Make a first change’s step 2, where the lines below show the starter’s:samples/minimal/states/hello_state.cpp L"Hello from the engine.", font_name, this->motion_.centre, resources,samples/minimal/states/hello_state.cpp, lines 86–88 at
f525bc6Change
whitetoorange, so that the last line reads: -
Change it where the greeting comes back. While the quit question is open, the greeting is dimmed to grey, and when the question closes it is set back to white. Search for
void HelloState::on_resume():samples/minimal/states/hello_state.cpp void HelloState::on_resume(){samples/minimal/states/hello_state.cpp, lines 216–218 at
f525bc6Change
whitetoorangehere as well, so that the line reads as below, then save and close Notepad. Without this change the greeting starts orange and turns white the first time you answer the quit question with Escape. -
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.exeOnly
hello_state.cppis compiled again; on a fast desktop the line took 5 seconds before the game opened. It ends like this:Output [3/4] Building CXX object game\CMakeFiles\MyGame.dir\states\hello_state.cpp.obj[4/4] Linking CXX executable game\MyGame.exeTest project C:/dev/mygame/out/build/x64-debugStart 1: MyGameTests1/2 Test #1: MyGameTests ...................... Passed 0.01 secStart 2: MyGameSmokeTests2/2 Test #2: MyGameSmokeTests ................. Passed 0.78 sec100% tests passed, 0 tests failed out of 2The greeting is orange. Press Escape: it turns grey under the yellow quit question. Press Escape again to say no, and it is orange again.
The names you can use
Section titled “The names you can use”orange is one of the 148 named colours the engine has, the colours web pages use, spelt in
lower case with _ between words. Each is written labrador::Colour:: and the name. This is
the whole list, from the engine’s own header:
Show engine/render/colour.h, 148 lines
static const Colour antique_white;static const Colour aqua;static const Colour aquamarine;static const Colour azure;static const Colour beige;static const Colour bisque;static const Colour black;static const Colour blanched_almond;static const Colour blue;static const Colour blue_violet;static const Colour brown;static const Colour burlywood;static const Colour cadet_blue;static const Colour chartreuse;static const Colour chocolate;static const Colour coral;static const Colour cornflower_blue;static const Colour cornsilk;static const Colour crimson;static const Colour cyan;static const Colour dark_blue;static const Colour dark_cyan;static const Colour dark_goldenrod;static const Colour dark_gray;static const Colour dark_green;static const Colour dark_grey;static const Colour dark_khaki;static const Colour dark_magenta;static const Colour dark_olive_green;static const Colour dark_orange;static const Colour dark_orchid;static const Colour dark_red;static const Colour dark_salmon;static const Colour dark_sea_green;static const Colour dark_slate_blue;static const Colour dark_slate_gray;static const Colour dark_slate_grey;static const Colour dark_turquoise;static const Colour dark_violet;static const Colour deep_pink;static const Colour deep_sky_blue;static const Colour dim_gray;static const Colour dim_grey;static const Colour dodger_blue;static const Colour fire_brick;static const Colour floral_white;static const Colour forest_green;static const Colour fuchsia;static const Colour gainsboro;static const Colour ghost_white;static const Colour gold;static const Colour goldenrod;static const Colour gray;static const Colour green;static const Colour green_yellow;static const Colour grey;static const Colour honeydew;static const Colour hot_pink;static const Colour indian_red;static const Colour indigo;static const Colour ivory;static const Colour khaki;static const Colour lavender;static const Colour lavender_blush;static const Colour lawn_green;static const Colour lemon_chiffon;static const Colour light_blue;static const Colour light_coral;static const Colour light_cyan;static const Colour light_goldenrod_yellow;static const Colour light_gray;static const Colour light_green;static const Colour light_grey;static const Colour light_pink;static const Colour light_salmon;static const Colour light_sea_green;static const Colour light_sky_blue;static const Colour light_slate_gray;static const Colour light_slate_grey;static const Colour light_steel_blue;static const Colour light_yellow;static const Colour lime;static const Colour lime_green;static const Colour linen;static const Colour magenta;static const Colour maroon;static const Colour medium_aquamarine;static const Colour medium_blue;static const Colour medium_orchid;static const Colour medium_purple;static const Colour medium_sea_green;static const Colour medium_slate_blue;static const Colour medium_spring_green;static const Colour medium_turquoise;static const Colour medium_violet_red;static const Colour midnight_blue;static const Colour mint_cream;static const Colour misty_rose;static const Colour moccasin;static const Colour navajo_white;static const Colour navy;static const Colour old_lace;static const Colour olive;static const Colour olive_drab;static const Colour orange;static const Colour orange_red;static const Colour orchid;static const Colour pale_goldenrod;static const Colour pale_green;static const Colour pale_turquoise;static const Colour pale_violet_red;static const Colour papaya_whip;static const Colour peach_puff;static const Colour peru;static const Colour pink;static const Colour plum;static const Colour powder_blue;static const Colour purple;static const Colour rebecca_purple;static const Colour red;static const Colour rosy_brown;static const Colour royal_blue;static const Colour saddle_brown;static const Colour salmon;static const Colour sandy_brown;static const Colour sea_green;static const Colour seashell;static const Colour sienna;static const Colour silver;static const Colour sky_blue;static const Colour slate_blue;static const Colour slate_gray;static const Colour slate_grey;static const Colour snow;static const Colour spring_green;static const Colour steel_blue;static const Colour tan;static const Colour teal;static const Colour thistle;static const Colour tomato;static const Colour turquoise;static const Colour violet;static const Colour wheat;static const Colour white;static const Colour white_smoke;static const Colour yellow;static const Colour yellow_green;engine/render/colour.h, lines 72–219 at f525bc6
A few to try: gold, tomato, deep_sky_blue, lime_green, hot_pink, light_gray. Grey is
spelt both ways, dark_gray and dark_grey, and as on the web, dark_gray is lighter than
gray. The starter already uses three: the hint along the bottom is dark_gray, the touch
markers gold, and the quit question goldenrod.
A colour of your own
Section titled “A colour of your own”Any colour can be made from its red, green and blue, each a whole number from 0 to 255, the
numbers a paint program shows. In place of labrador::Colour::orange in both places, write:
All three numbers must be whole numbers, or all three must have a point and an f, from 0.0f
to 1.0f, such as labrador::Colour(1.0f, 0.63f, 0.16f). Mixing the two kinds is the
C2440 error below. A fourth number is how see-through the colour is, but it does not blend the
way a paint program’s does; Sprites and text explains how
colours blend.
If the colour does not build
Section titled “If the colour does not build”Bigger text
Section titled “Bigger text”The greeting is drawn at the size of its font, 16 pixels high. The number after the colour
makes it bigger: 2.0f draws it twice as big. Open the greeting’s code again:
notepad game\states\hello_state.cppSearch for this->greeting_ = this->scene_->add( as in step 1. At the last of its lines, the
one you changed to orange, add , 2.0f after the colour, so that it reads:
Save, close Notepad, and build, test and run with the line from step 3. The greeting is twice as wide and twice as high, and grows to the right and down from where it was, because the position the game gives it is its top-left corner. Drawn bigger than its font, its letters are blocky. Fonts and text in your game makes a 32-point font for text that is meant to be big.
Where things start
Section titled “Where things start”The window is measured in pixels from its top-left corner: across to the right first, then down.
In the starter’s 1280 by 720 window, Vector2F(0.0f, 0.0f) is the top-left corner,
Vector2F(1280.0f, 720.0f) the bottom-right, and Vector2F(640.0f, 360.0f) the middle. Open
the greeting’s code:
notepad game\states\hello_state.cppIn init(), search for this->motion_.centre =. It is the third of these four lines:
this->app_->resolution_manager()->resolution_vec();this->motion_.centre = Vector2F(resolution.x * 0.5f - 120.0f, resolution.y * 0.5f);samples/minimal/states/hello_state.cpp, lines 75–78 at f525bc6
resolution is the window’s size, so resolution.x * 0.5f - 120.0f is 120 pixels left of the
middle, and resolution.y * 0.5f is half-way down. That is the point the greeting circles. To
start it near the top-left corner instead, change the last two lines, the
this->motion_.centre = line and the one after it, to this one line, and leave the first two as
they are:
Save, close Notepad, and build, test and run: the greeting circles near the top-left corner.
Changing the second and third lines instead leaves half of two lines behind, and the build stops
with hello_state.cpp(77): error C2059: syntax error: ')': make the four lines the ones above
again, then change the last two.
The hint along the bottom is placed the same way, at Vector2F(24.0f, resolution.y - 40.0f):
24 pixels from the left and 40 up from the bottom. Positions are written with .0f on each
number, the way the engine’s own code writes them; Vector2F(200, 150) builds too.
The window’s size
Section titled “The window’s size”The window’s size is in game\main.cpp:
notepad game\main.cppSearch for options.resolution:
samples/minimal/main.cpp, line 116 at f525bc6
The size is one of four, the four the engine names:
s_1280_720,s_1920_1080,s_2560_1440,s_3840_2160,Change s_1280_720 to s_1920_1080, save and close Notepad, and build, test and run with the
line from step 3. This time main.cpp is compiled again. The window is 1920 pixels wide and
1080 high inside its frame, and the hint has moved with it to the new bottom, because init()
places it from resolution. So does the greeting, unless you gave it a place of its own in the
section before: Vector2F(200.0f, 150.0f) stays where it is. The text stays the same size in
pixels, so it looks smaller.
With v0.3.0, keep one of the four resolution presets above. Pasting client_size into that
starter instead gives error C2039: 'client_size': is not a member of 'labrador::ApplicationOptions'.
Any other size goes on its own line under that one, as width then height:
The window is then 1600 pixels wide and 900 high inside its frame, and resolution in init()
is that size, so the hint is along its bottom as before. Any shape works, Vector2I(1440, 900)
or Vector2I(1024, 768) too; what is placed from resolution moves with it, and the rest stays
where it is. A size narrower than 320 or shorter than 200, the smallest window the engine allows,
stops the game before its window opens, and the test fails too, with
startup failure: ApplicationOptions::client_size is narrower than min_window_width. or
... is shorter than min_window_height.; on Windows a box titled Sample - startup failure says
the same. Delete the line to go back to the preset.
Choose a size smaller than your screen. The window’s frame and title bar take room too, so a
window as big as the screen does not fit. On a 2560 by 1440 screen, s_2560_1440 gave a window
2576 by 1479 pixels with its frame, starting at the top-left corner, and its bottom 39 pixels
were off the bottom of the screen, under the taskbar. On a 1920 by 1080 laptop screen,
s_1920_1080 does the same. A player can always drag the window’s edge; what the game does then
is under Full screen with F11.
In the browser the page decides the size, not this line: the game draws into the page’s
canvas, and its size is set in game\web\shell.html, where the canvas is as wide as the page,
up to 1280 pixels, and 16 by 9 in shape. game\main_web.cpp has the same options.resolution
line, but the canvas’s size replaces it as soon as the page has laid the canvas out.
Full screen from the start
Section titled “Full screen from the start”Open game\main.cpp again:
notepad game\main.cppAfter the options.resolution line, whatever size it names, add one line, so that the two read,
here with the starter’s size:
options.fullscreen = true;Save, close Notepad, and build, test and run. The test still passes: it runs the game hidden,
which is never full screen. Then the game fills the whole screen, with no frame or title bar.
init() reads the window’s size when the game starts, which is now the size of your screen, so
the greeting circles the screen’s middle and the hint is along its bottom, all at the same size
in pixels as before.
To leave it:
- Escape, then Enter, quits as before.
- Alt+F4 closes the game at once, without the question.
- Alt+Tab, or the Windows key, switches to another window and leaves the game running behind it; click it on the taskbar to go back.
Delete the line again to go back to a window. The line is in main.cpp, so it changes the
Windows game only; main_web.cpp has no such line, and a page can go full screen only after the
player presses a key or clicks.
In browser full screen, the interaction between Escape and the game’s quit question
still needs a real-browser observation. The
17 November 2026 attempt
stopped before any trusted click or Escape, so it established neither full-screen exit
nor whether the game receives that key. Headless key tests and explicit
document.exitFullscreen() calls do not answer that question. The remaining check is a
qualified trusted-key route or informal human browser observation, with its browser and
version recorded; this page does not promise what one Escape press will do there.
Full screen with F11
Section titled “Full screen with F11”This section lets the player switch with F11 while the game runs, and keeps the game the same
shape at any size, with black bars at two sides when the screen is a different shape. It needs
four changes in game\states\hello_state.cpp and one in game\states\confirm_state.cpp, because
until now the game only looked at the window’s size once, when it started. Before you start,
delete the options.fullscreen = true; line from the section above if you added it.
-
Add the layout size and a function that fits it to the window. Open the code:
Terminal window notepad game\states\hello_state.cppSearch for
touch_marker_offset =. It is near the top, insidenamespace {:samples/minimal/states/hello_state.cpp Click at the end of that line, press Enter twice, and paste:
// The size the game is laid out in, whatever size the window is.// Gives the scene one view, the whole window, showing the layout as// large as it fits, in the middle. A window of another shape has black// bars at two of its sides.{scene.clear_views();scene.add_view(window,}A view is a rectangle of the window and a camera that says which part of the game it shows and how big.
Camera::framemakes the camera that shows the 1280 by 720 the game is laid out in as large as the window allows: twice as big on a 2560 by 1440 screen. -
Lay the game out at that size, and fit the view. In
init(), search forconst Vector2F resolution =. Change the two linesthis->app_->resolution_manager()->resolution_vec();to one line:
Everything in
init()is placed fromresolution, so the game is now always laid out at 1280 by 720. Then search forthis->scene_->add_view(, the last line ofinit():samples/minimal/states/hello_state.cpp Replace that line with:
fit_view(*this->scene_, *this->app_->viewport_manager()); -
Switch on F11, and fit the view on every frame. In
update(), search forconst Keyboard& keyboard =, with the=: without it, the search first finds thekeyboard_directionfunction near the top. Click at the end of that line, press Enter twice, and paste:{this->app_->set_fullscreen(!this->app_->fullscreen());}!means “not”: F11 asks for full screen when the game is in a window, and for a window when it is full screen. Then go to the end ofupdate(), the last line beforevoid HelloState::on_suspend():samples/minimal/states/hello_state.cpp this->scene_->update(dt);this->scene_->end_tick();samples/minimal/states/hello_state.cpp, lines 184–185 at
f525bc6Click at the end of
this->scene_->end_tick();, press Enter twice, and paste:fit_view(*this->scene_, *this->app_->viewport_manager());Without this line the window changes size and the view does not: after F11 the game is drawn in the top-left 1280 by 720 of the screen, with black around it.
-
Keep the touch markers under the fingers. Search for
marker->set_position(. The lines are:samples/minimal/states/hello_state.cpp static_cast<float>(points[i].position.x),static_cast<float>(points[i].position.y)) +touch_marker_offset);samples/minimal/states/hello_state.cpp, lines 168–171 at
f525bc6Replace those four lines with:
marker->set_position(view.camera.world_position(points[i].position, view.viewport) +touch_marker_offset);A finger is reported in the window’s pixels;
world_positionturns that into the game’s 1280 by 720 through the view’s camera. Save and close Notepad. -
Lay the quit question out at the same size. The question draws through the same camera, so it must be laid out at 1280 by 720 too, or full screen draws it off the screen:
Terminal window notepad game\states\confirm_state.cppSearch for
const Vector2F resolution =and change its two lines, as in step 2, to:Save and close Notepad.
-
Build, test and run with the line from step 3 of the first section. It compiles
hello_state.cppandconfirm_state.cpp, about 6 seconds in all. In a window the game looks as before. Press F11: the game fills the screen, drawn larger, everything where it was. Escape shows the question, larger too, in the same place. Press Escape to close it and F11 to go back to a window. Drag the window’s bottom edge down: the game stays 16 by 9, with black bars above and below it.
If the game was full screen from the start in the section before, it still works with these changes: it is then laid out at 1280 by 720 and drawn larger, like after F11.
In the browser, the same build makes the game fit the canvas whatever the page’s width. Whether F11 there makes the canvas full screen was not checked: the browser’s own F11 may take the key first.
The line numbers in the messages below are those of a file with every section above done in order; with a section skipped they are a line or two different, and the words are the same.
A colour behind everything
Section titled “A colour behind everything”The engine clears the window to black before each frame, and has no setting for another colour. A background is something drawn first, because whatever is drawn later is drawn over it. This section makes a small class that draws one rectangle of colour, and adds it to the scene before anything else. It works with or without the sections above.
-
Make the class. It is one file, a header:
Terminal window if not exist game\states\backdrop.h type nul > game\states\backdrop.hnotepad game\states\backdrop.hThe first line makes an empty file and prints nothing. Paste all of this into it, then save and close Notepad:
game\states\backdrop.h #pragma once#include "engine/core/game_object.h"#include "engine/math/rectanglef.h"#include "engine/math/rectanglei.h"#include "engine/math/vector2f.h"#include "engine/render/colour.h"#include "engine/render/render_resources.h"#include "engine/render/renderer.h"#include "engine/render/resource_factory.h"// A rectangle of one colour. Added to the scene before everything else, it is// drawn first, so it is the background behind the rest.{public:texture_(resources.resolve_texture(labrador::white_texture_name)),area_(area), colour_(colour){}void set_colour(const labrador::Colour& colour){this->colour_ = colour;}void update(float /*dt*/) override{}{// The engine's white texture is one white pixel; drawn over the// whole area and tinted, it is a rectangle of that colour.draw_list.draw_sprite(this->texture_,}labrador::RectangleF bounds() const override{return this->area_;}private:labrador::TextureHandle texture_;labrador::RectangleF area_;labrador::Colour colour_;};The engine always has a texture one white pixel across, named by
white_texture_name.drawstretches it over the whole rectangle and tints it with the colour, which is how every solid rectangle is drawn on this engine. The whole class is in the header, sogame\CMakeLists.txtdoes not need to list it. -
Add it to the scene first. Open the state’s code:
Terminal window notepad game\states\hello_state.cppSearch for
game/states/confirm_state.hand add a line before it, so the two read:#include "game/states/backdrop.h"#include "game/states/confirm_state.h"Then search for
this->greeting_ = this->scene_->add(. Click at the start of that line and paste these lines above it, with an empty line after them:this->scene_->add(std::make_unique<Backdrop>(*resources));RectangleF(Vector2F::zero, resolution)is the rectangle from the top-left corner the size of the window. Any colour from the list works in place ofmidnight_blue. Save and close Notepad. -
Build, test and run with the line from the first section. It compiles
hello_state.cpp, about 6 seconds. The window is dark blue behind the greeting and the hint, and the quit question draws over it too.
The order is what matters. Things in the scene are drawn in the order they were added, each
over the ones before. Added after the greeting, the rectangle covers it: the window shows dark
blue and the hint, which was added later, and no greeting. If the greeting disappears, move the
three lines above this->greeting_ = this->scene_->add(.
If you did Full screen with F11, the rectangle is 1280 by 720 like the rest of the layout and is drawn larger with it; the bars at the sides of a window of another shape stay black, because they are outside it.
A picture behind everything
Section titled “A picture behind everything”A picture is a background the same way: drawn first. This needs
Put a picture in your game done first, which sets up the textures
folder and the Picture class, and Install the content tools.
-
Make a picture the size of the window. It must be 1280 by 720 pixels. To try it with one drawn for you, this line draws an evening sky with green ground along the bottom, as
sky.pngin your project’s folder:Terminal window powershell -NoProfile -Command "Add-Type -AssemblyName System.Drawing; $b = New-Object Drawing.Bitmap 1280,720; $g = [Drawing.Graphics]::FromImage($b); $r = New-Object Drawing.Rectangle 0,0,1280,720; $s = New-Object Drawing.Drawing2D.LinearGradientBrush $r, ([Drawing.Color]::MidnightBlue), ([Drawing.Color]::DarkOrange), 90; $g.FillRectangle($s, $r); $g.FillRectangle([Drawing.Brushes]::DarkGreen, 0, 600, 1280, 120); $b.Save('sky.png'); $s.Dispose(); $g.Dispose(); $b.Dispose()"It prints nothing. Then convert it as the picture page’s step 2 does:
Terminal window C:\dev\tools\texconv.exe -f R8G8B8A8_UNORM -m 1 -pmalpha --ignore-srgb -y -o game\content\textures sky.pngIt ends
reading sky.png (1280x720 B8G8R8A8_UNORM 2D) as (1280x720 R8G8B8A8_UNORM 2D a:Opaque)andwriting game\content\textures\sky.dds. -
List it. In
game\content\manifest.json, thetexturegroup’s names become:"names": ["hero","sky"]with a comma after
"hero". Ingame\CMakeLists.txt, after the line endingcontent/textures/hero.dds"that the picture page added, add the same line for the sky, so that the browser build packages the page again when it changes:"${CMAKE_CURRENT_SOURCE_DIR}/content/textures/hero.dds""${CMAKE_CURRENT_SOURCE_DIR}/content/textures/sky.dds" -
Draw it first. In
game\states\hello_state.cpp, add these lines abovethis->greeting_ = this->scene_->add(, in place of theBackdroplines if you added them:this->scene_->add(std::make_unique<Picture>("sky"is the name in the manifest, andVector2F::zeroputs its top-left corner in the window’s. The developmentPictureclass from the picture guide reads the texture’s size; itsv0.3.0guide instead supplies1280, 720to that release’s class. -
Build, test and run. The build runs CMake again, as on the picture page, and took 8 seconds. The sky is behind the greeting, and the green ground behind the hint.
A misspelt name in the manifest or the code fails the start-up test with the messages listed on Put a picture in your game.
Smooth movement on a fast display
Section titled “Smooth movement on a fast display”The game steps sixty times a second, and update() puts the greeting in its new place on each
step. A 120 or 144 Hz display draws two or three frames per step, each with the greeting in the
same place, so the circling greeting moves in small jumps.
Drawing between steps explains why. This section
keeps where the greeting was on the step before, and draws it part of the way from there to
where it is now, by how far the frame falls between the two steps. On a 60 Hz display it looks
the same as before.
Do this section last. It takes the greeting out of the scene so that the state can draw it
itself, so a page that later asks you to search for this->greeting_ = this->scene_->add( finds
this->greeting_ = std::make_unique<Label>( instead, and the greeting is drawn over everything
in the scene, the hint and any background included.
-
Keep the greeting, and two things about the last step. Open the state’s header:
Terminal window notepad game\states\hello_state.hSearch for
greeting_ = nullptr:samples/minimal/states/hello_state.h Replace that line with:
// Where the greeting was before the last update moved it, and which// step that update ran, so that draw() can place it between the two.std::uint64_t stepped_at_ = 0;The state now owns the greeting instead of the scene, so the comment above the line, which says the scene owns it, is no longer true of the greeting. Save and close Notepad.
-
Make the greeting outside the scene. Open the state’s code:
Terminal window notepad game\states\hello_state.cppSearch for
this->greeting_ = this->scene_->add(. Change that line to:and delete one
)from the end of the last of its lines, so that it ends);instead of));. With the starter’s colour it reads: -
Remember the last step at the start of each update. Search for
void HelloState::update(float dt). Click at the end of the{line under it, press Enter, and paste:// The step this update runs, and where the greeting is before it moves.this->stepped_at_ = this->app_->step_position().step;this->previous_position_ = greeting_position(this->motion_); -
Draw the greeting between the two. Search for
this->scene_->draw(renderer);, the last line ofdraw():samples/minimal/states/hello_state.cpp this->scene_->draw(renderer);Replace it with:
// Part of the way from last step's place to this step's, by how far// this frame falls between them. Only when this state ran the latest// step: under the quit question it is not updated, and it stays where// it stopped.Vector2F position = now;if (step.step == this->stepped_at_){}this->scene_->draw(renderer,{this->greeting_->draw_with(list, this->greeting_->colour(),position, 1.0f);});The function after
this->scene_->draw(renderer,runs once for each view, after the scene’s own objects, so the greeting is drawn over them.draw_withdraws the greeting with the colour, place and size it is given, and changes none of them, becausedraw()may not change anything.1.0fis the size: if you did Bigger text, write2.0fthere. Save and close Notepad. -
Build, test and run with the line from the first section. The greeting circles as before, and on a display faster than 60 Hz it moves without the small jumps.
The quit question stops the greeting, and the check keeps it still. Only the state on top is
updated. While the question is open the greeting’s state is not, so stepped_at_ stays on the
last step it ran, while step_position() moves on. Without the if, the greeting would be drawn
between its last two places on every frame under the question, flickering back and forth.
draw() works out the greeting’s place from this->motion_ the way update() does. If you
changed the this->greeting_->set_position( line in update(), make the same change to the two
greeting_position(this->motion_) calls above.
Where to go next
Section titled “Where to go next”- Put a picture in your game draws pictures, and Fonts and text in your game makes text in other sizes.
- A camera that follows the player makes the game bigger than the window, with a camera that moves.
- Rename your game changes
MyGameto your game’s name everywhere. - Sprites and text and Drawing explain textures, tints, views and cameras.
- Read a build error has more on compiler messages.
What was checked
Section titled “What was checked”On 31 October 2026, in a starter project made from a starter ZIP of this tree, with Visual
Studio 2026’s compiler 19.51 and Emscripten 6.0.12, every section above was made as worded, in
order, by an agent editing the files with tools rather than Notepad, and the build and tests ran
as shown, with the project’s folder in the quoted output changed to C:\dev\mygame. The game was
started and driven with key presses, and screenshots showed the orange greeting, the grey
greeting under the question and orange again after Escape; the greeting at twice the size;
the window at 1920 by 1080; s_2560_1440 on a 2560 by 1440 screen giving a window 2576 by 1479
whose bottom ran off the screen; the game full screen from the start, laid out across the
screen, and closed by Escape and Enter and, in another run, by Alt+F4; after the F11
section, the game in a window, full screen after F11 at twice the size, the question in its
place full screen, a window again after F11, and a window resized to 1000 by 900 with bars
above and below; without the end-of-update() line, the game in the top-left 1280 by 720 of the
screen after F11; without the change to confirm_state.cpp, no question full screen; the
dark blue background, and with the three lines moved after the greeting, the greeting covered.
The sky was drawn and converted by the lines above after the picture page’s build lines and
manifest, and a screenshot showed it behind the greeting and the hint. Each message under the
sections was made on purpose. The final project built and passed its test under wasm-debug,
and headless Chrome showed the page with the sky and the question; it was not checked in a
browser whether F11 makes the canvas full screen. A colour from three whole numbers and
from three numbers with f, and Vector2F(200, 150), were built, and a screenshot showed the
greeting near the top-left corner after the start-position change.
The Smooth movement on a fast display section was added on 13 November 2026 and has not yet
been followed in a starter, built or run. Its code was checked only by reading it against the
engine’s headers: Application::step_position(), StepPosition, Vector2F::lerp,
Scene::draw with a view overlay, and TextObject::draw_with.
The Any other size lines under The window’s size were added on 4 November 2026 with
client_size and have not yet been followed in a starter. The engine’s hidden-window tests open a
window at a size no preset names, resize it to three more, refuse a size below the minimum and
read back each client size; the startup message is validate()’s, which its own test checks.
A second agent then followed the page as worded in another fresh starter, after
Make a first change’s steps 2 to 4, copying from the page.
Every section built and passed its tests on x64-debug and wasm-debug, its screenshots matched
the page, and each message it made gave the quoted words. It sent no keys to Windows windows
after its first runs, so F11 on Windows and leaving full screen were not tried by it; Escape
and the arrows were pressed in headless Chrome. The page was corrected for what it found: step 1
searched for the starter’s own greeting words, which Make a first change has replaced; Where
things start named the wrong two of its four lines, which gives C2059; Bigger text and Where
things start had no line to open the file; The window’s size said the greeting moves when Where
things start has given it a fixed place; Full screen from the start showed one size without
saying any size does; and the F11 messages gave line numbers from another order. The agent that
made the corrections then did every section in order in a third fresh starter, with the page’s
code pasted as worded. It found that searching for const Keyboard& keyboard without the =
finds the keyboard_direction function first, and step 3 now says so. It made the wrong-lines
C2059 at line 77, the F11 messages at lines 130 and 90, and the Backdrop message at line 98,
built and tested each state, and took screenshots of the game’s own window without sending it
keys: the orange greeting at twice the size near the top-left, and, after the F11 and background
sections, the dark blue background in a 1920 by 1080 window.
Documentation for Labrador v0.4.0. Built from Labrador f525bc6 of 2026-11-17.