window

3. your first pixels

hand the window a paint function and fill a box

you never draw whenever you like. you hand the window a function, and it calls that each time it needs drawing, when it first shows, when it resizes, whenever something changed

add this between create and show

	// called whenever the window needs drawing, the renderer is what we draw with
	auto paint = [](gui::renderer_t& _r, gui::sizei_t _size)
	{
		// the background first, a rect the size of the whole window
		_r.fill_rect({ 0, 0, float(_size.w), float(_size.h) }, gui::colour_t::rgb(0x202830));

		// then one orange box, 40 in from the top left, 120 wide and 80 tall
		_r.fill_rect({ 40, 40, 120, 80 }, gui::colour_t::rgb(0xE06040));
	};

	// hand it to the window, we never call it ourselves
	host.set_paint(paint);
a rect{ x, y, w, h }, from the top left, x goes right and y goes down
the unitslogical px, so a 2x screen draws it the same size, just sharper
colour_t::rgba hex colour, same as css, 0xE06040

later calls draw on top, which is why the background goes first. swap the two lines round and the box vanishes under it

you should see a dark blue window with an orange box in the top left