prcastro/zeroGL

Single-header design

Closed this issue · 4 comments

The library looks pretty cool but it's lacking in terms of its use of the single-header design.

  1. No _IMPLMENTATION space
    This messes up a lot of use cases. Without this, you cannot compile the library into an object file or a shared object file and then link it.

  2. NO _HEADER space

While you do use ZEROGL_H, the library is not organized using structures first and the function defines last.
Organizing its structures/function declares first and then function designs allow the user to easily understand the library's API and how to use it.

If you prefer to keep it how it is, that's also fine, it depends on how you want the user to be able to use the library. I think the way I described is better for single-header libraries.

For reference, you can check out my single-header library, RGFW or stb_image.

This is done. Just #define ZEROGL_IMPLEMENTATION before importing it. Tks for the tip.

Question: should I have the private functions on the header part?

Question: should I have the private functions on the header part?

My thought process is this: if it's something the user might want to use, it should be in the header part, otherwise, it's fine to hide it in the implementation.

#45 does exactly that. Tks again