The Bench Software Development Kit (The SDK) is a collection of libraries and applications aimed to ease the development of 3D multimedia applications for Windows XP computers.
TODO: The SDK does not yet exist.
The SDK provides a Powerful Userspace Coroutine Scheduling System to enable convenient asynchronous programming. If you want something to happen once per second, fire a coroutine with a loop, and call Sleep in it:
If you want to do something once per frame, fire a coroutine with a loop and Sleep(1).
StartCoroutine([](CoroutineHandle coro, void* userdata) {
for (;;) {
printf("tic\n");
Sleep(coro, 1.0);
printf("tac\n");
Sleep(coro, 1.0);
}
});Coroutines are also leveraged for async I/O:
StartCoroutine([](CoroutineHandle coro, void* userdata) {
File file = FileOpen("file.txt");
char buf[32] = {};
// FileReadAsync will yield, and the coroutine will be resumed
// after the read asynchronously completes.
I32 nread = FileReadAsync(coro, file, 32, buf);
buf[31] = '\0';
printf("%s\n", buf);
}, nullptr);Currently this is the only officially supported setup. On Visual Studio 2022 you can still install a Windows XP-compatible compiler (). This has the following trade-offs:
- ✔️Works out of the box with Visual Studio
- ✔️Reasonably modern compiler
- ❌No C++20 support (basically no named initializers)
- ❌Modern Windows SDK and CRT are quite bloated - an empty statically linked executable with vs141_xp is ~200KB, while with an older Windows Vista SDK it's ~60KB
TODO: In the future we plan to have a template project, but right now you have to go through the Visual Studio Library Linking Ritual, explained below:
- From the Visual Studio Installer, select "C++ Windows XP Support for VS 2017 (v141) tools"
- Create a new solution with either "C++ Console Application" or "Win32 Application"
- Add the Bench SDK as a subdirectory to your project
- File > Add > Existing Project, and select bench/proj/vs2017/bench.vcxproj
- Configure your game's project:
- Switch from x64 to x86 - x64 is not supported at this point in time as it won't run on my 2004 laptop
- Configuration Properties/
- General/
- Windows SDK Version: 10 (or something else, but make sure it matches the bench SDK library's)
- Platform Toolset: Visual Studio 2017 - Windows XP (v141_xp)
- C++/
- General/
- Additional Include Directories - Add $(SolutionDir)bench\
- Preprocessor/
- Add BENCH_WIN32 define
- Code Generation
- Runtime Library - for Debug configuration, "Multi-threaded Debug (/MTd)", and for Release configuration: "Multi-threaded (/MT)"
- General/
- Linker/
- General/
- Additional Library Directories: Add $(OutDir)
- Input/
- Additional Dependencies: Add bench.lib
- General/
- General/
If you're feeling adventurous and want to build with another compiler/build system, it should be fairly simple (unless you're targeting XP, which is not covered here and will involve hair pulling).
- Create a executable in your build system
- Add all the .cpp files into your build - either directly as part of your project, or as a separate library
- Add BENCH_WIN32 define (for forward compatibility)
- Add the Bench SDK's root folder as an include directory (so <bench/*> includes resolve)