Aside: I'm late to this series having just started and trying to get caught up. I am sorry if this has been covered since it first appeared.
As I understand this model, the game layer defines a generic interface GameUpdateAndRender that uses a generic type game_offscreen_buffer to get frame data. The game_offscreen_buffer defines a type that the game layer treats as uint32 buf[Height][Width]. So, every platform must deal with a frame buffer using the type and layout. The platform is responsible for any transformation from that type to a platform specific type, win32_offscreen_buffer or equivalent. In this case, the transformation is a direct mapping but that won't always be the case.
Generally, the platform would need to translate a win32_offscreen_buffer object into a game_offscreen_buffer or the equivalent and do the reverse after the call to GameUpdateAndRender. The direct mapping between the two types obscures this.
One way to express this is the C++
| struct win32_offscreen_buffer : public game_offscreen_buffer
{
BITMAPINFO Info;
};
|
n.b. the memory layout for this changes but that should not be vital. If it is then a composition would work.
| struct win32_offscreen_buffer
{
BITMAPINFO Info;
game_offscreen_buffer game_buffer;
};
|
The point is that such a relationship won't always be the case and it is the platform layer that must perform the translation.
- tim