tinyFramebuffer
This is something I want to write since a long time. A better clone of tinyPTC. Perhaps I'll start coding it if I add an entry here ?
All I want is a pointer to an array of pixel, and whatever I write in it is displayed on screen. It really needs 3 functions:
open
update
close
Everything else is optional. But I want to write a software renderer of course.
Getting started
I created a "Desktop application" in Visual Studio. It creates some kind of default project with resources, menu, dialog. Meh. Perhaps i should start with an empty project.
Getting started, take 2
Starting Visual Studio 2022, Empty C++ project, tinyFramebuffer.
Add Class, tinyFramebuffer.cpp & .h.
Project, properties (all configurations), linker, system, subsystem, change from console to windows.
WIN32_LEAN_AND_MEAN
i do need windows.h (i think) but the smaller, the better.
WIN32_LEAN_AND_MEAN is a popular #define, but according to Raymond Chen, it doesn't have much use anymore. It doesn't seems to hurt to define it anyway.
From Windows.h:
Ho well, we'll see later if it was a good idea.
A basic "do nothing" winmain
O the joy of WinMain. I don't know why it's so complicated.

Yes, yes, thank you Copilot. So much negativity.
![]()
Right, wishful thinking from Copilot. We'll see how it goes.
Right, it compiles, do nothing, exit, without error. That's a good start. And yes, the elephant in the room : #include <ddraw.h>. I guess i'll have to.
Unless I switch to "modern" Direct2D. (then that would be d2d1.h instead of ddraw.h)
Sorting out the mess
I want all the windows stuff in tinyFramebuffer and the app in some kind of application.cpp. What make it slightly difficult is that the winmain is in tinyFramebuffer, not in application.
- So at tinyFramebuffer startup we need to call our application Startup, - at tinyFramebuffer update we need to call our application Update, - and at tinyFramebuffer shutdown we need to call our application Shutdown.
I code the tinyFramebuffer thing, and the "application" is whatever it wants to be. Or perhaps tinyFramebuffer should be a proper library.
I haven't the faintest idea how to make a windows library. And more importantly, i don't know if can do what i need to do with a library.
I'll have to try later but for now let's make something that i know it can work.