SDL icon indicating copy to clipboard operation
SDL copied to clipboard

[SDL3] C++ headers & modules

Open CXCubeHD opened this issue 3 months ago • 8 comments

Since SDL3 is in development, I would like to propose that there should be some kind of C++ header generation. This would make using headers way more comfortable as a C++ user. I really like the way VulkanHpp was implemented.

On top of that SDL3 should have optional (by default off) C++ 20 Module support (just like VulkanHpp aswell). Much work has been done on the compiler and CMake side to make this as easy as possible (read this article for more).

I would really love to see this happen

Edit:

For good C++ adaptation I would expect the following:

  1. Namespacing:

Example:

sdl::Delay(2000); // sdl namespace is lowercase, types & functions are PascalCase
sdl::Event e;
  1. Flags as enum class:

(some flags will have to be renamed because of clarity)

Example:

SDL_SOMEFLAG_FLAG1
sdl::SomeFlag::Flag1

SDL_SOMEFLAG_FLAG1 | SDL_SOMEFLAG_FLAG2

sdl::SomeFlag::Flag1 | sdl::SomeFlag::Flag2

CXCubeHD avatar May 11 '24 22:05 CXCubeHD

Please no lower-case sdl, this looks so wrong. :)

Sackzement avatar May 11 '24 22:05 Sackzement

Please no lower-case sdl, this looks so wrong. :)

I guess uppercase SDL would also be okay then. It could even be made configurable through a macro and cmake (just like VulkanHpp)

CXCubeHD avatar May 11 '24 23:05 CXCubeHD

Feel free to submit a PR for this.

slouken avatar May 12 '24 22:05 slouken

Feel free to submit a PR for this.

Yo I feel like I can do this but I need to get more familiar with the code / project structure 👌

CXCubeHD avatar May 12 '24 22:05 CXCubeHD