A generator to display art in C++ memory layout
Align memory in such a way that it forms a picture when visualized using Microsoft Visual Studio's Memory Layout view.
Note
A friend and I were playing around with memory layout visualization and saw you can create interesting patterns. This is a silly project I made for fun and is not intended to be taken seriously. Most of the website is vibe coded using Claude.
Try the website here: https://sven-vh.github.io/Memory-Layout-Generator/ or clone the repo and open docs/index.html

Whenever you have a member variable with a name in a struct/class, the memory layout view will show a colored box representing that variable. If you don't specify a name, it will show an empty area.
By specifying the bit size of some variables, you can control how big the colored boxes are. This was enough to create some interesting pixel art.
struct Test {
// Row 0
short row_0 : 16; // 16 bits = full row
// Row 1
short row_1_left : 2; // 2 bits = 2 pixels
short : 12; // 12 bits unnamed = empty space
short row_1_right : 2; // 2 bits = 2 pixels
};
There are 2 examples in the Examples
folder. They include the source image, generated output, and the C++ code used to generate the output.
Input:
output:
Input:
Output:
Feel free to share your own creations by creating an issue!
My name is Sven and I'm a C++ programming student at specializing in game engines & tools.
Check out my other projects: https://github.com/Sven-vh
Connect with me on LinkedIn: https://www.linkedin.com/in/sven-van-huessen/
Or check out my portfolio: https://www.svenvh.nl/