Add Embeddable/None platform targets #4298
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds two new platform targets: PLATFORM_EMBEDDABLE, and PLATFORM_NONE. Alongside these, it puts parts of rcore.c into a new "rcore.h" file, which also includes
GetCore
, a function that returns CORE.Both platform targets are blank slates. All of the functions within them have appropriate function pointers which can be left NULL or be overriden at runtime. The difference between the two is that Embeddable links against glfw by default, while also giving certain functions that don't explicitly rely on glfw (such as setting the window state or setting the cursor's state to be hidden) default behaviors. None does not do this.
They both represent two use cases, one important, and the other interesting.
GetCore is a bit of a risky function to both use and implement, as it'll very likely prove to have a more unstable API then others. But I think that even with this fact it'll still be useful, because even if things break, they can still (hopefully) be easily updated, even by somebody who didn't work on the library, all in a fashion that's much easier/nicer then one having to fork the entire Raylib codebase.
It's not the most pretty to use or maintain (just see the new
core/core_override
example that's provided, I think would be the first feature of Raylib that requires a union to be used, for reasons out of my control), but it does solve a legitimate use case. This actually started out as me trying to add aInitOffscreenWindow
function, but what I realized is that this would be trickier to implement, and I like doing this better because:Lastly, there is a downside that I think may affect CI: The macros used to make this cleaner to implement, don't seem to work when using GNU Make. I don't know if this a problem localized to my machine or if it'll affect this, or even why it happens when I'm pretty sure I only did stuff that was standard, but we'll see.