Posts with the tag C++:

Bitfield widths in C/C++ structures

Recently, I learned about a feature in C and C++ that I hadn’t run into before: bit widths for fields in structures. The idea is that you can specify how many bits a particular field should have allocated to it. For example, you can have a field that is only 5 bits wide and therefore only takes values in [0, 32). You could then have a field that is 3 bits wide that is placed next to the first field in memory.

Wx 3.1 with embedded SFML 2.5 control

I’ve been working on a project where I wanted to embed an SFML drawing context in a wxWidgets window. I wanted to be able to write a GUI application, but didn’t want to have all of the UI be embedded within the SFML window using something like imgui. I thought it could be useful to others to have a simple example of how to do the same thing. Simple Example version I took the code from the SFML 1.