PrevUpHomeNext

Lazy First


I should make my code lazy to use for myself, I make my code lazy first for me.

Lazy is not identical to simple. The complicated things continue complication. Lazy and simple are not the same things.

The method .tuple of dcpp::shared_device is such a method for lazy use.

And the method .swapScenes is for such a purpose too.

See:

class: dcpp::shared_device

method: shared_device.tuple()

video_driver->swapScenes(...)

c++ example

#include <duckcpp/shared.hpp>

int main()
{
	dcpp::shared_device device{2560, 1440};
	auto [video, scene, gui, fs, cursor, timer] = device.tuple();
	while (device.run())
	{
		if (! device.window_active())
		{
			device.yield();
			continue;
		}
		scene->drawAll();
		video->swapScenes(0xff123456);
	}
}

Date

> date
Mon Apr  7 08:09:13 AM UTC 2025

Back

Up: Tips

c++

Duckcpp

cppfx.xyz


PrevUpHomeNext