Platform picker
Tap a backend to see its define, source file, and notes.
Define: —
File: —
—
Preprocessor dispatch in rcore.c
#if defined(PLATFORM_DESKTOP)
#define PLATFORM_DESKTOP_GLFW
#endif
#if defined(PLATFORM_DESKTOP_GLFW)
#include "platforms/rcore_desktop_glfw.c"
#elif defined(PLATFORM_DESKTOP_SDL)
#include "platforms/rcore_desktop_sdl.c"
#elif defined(PLATFORM_DRM)
#include "platforms/rcore_drm.c"
// ... etc
#endif
Platform .c files are not separate translation units — they share CORE and static platform state with rcore.c (unity-build style).
Platform contract — required functions
int InitPlatform(void)/void ClosePlatform(void)void SwapScreenBuffer(void)void PollInputEvents(void)bool WindowShouldClose(void)- Window/monitor/cursor/clipboard helpers
Template: platforms/rcore_template.c
GLFW InitPlatform (desktop default)
glfwInit()with RL_* alloc wrappers- Window hints from
CORE.Window.flags(MSAA, resizable, HiDPI…) - OpenGL version from
rlGetVersion() glfwCreateWindow,glfwMakeContextCurrentrlLoadExtensions(glfwGetProcAddress)- Register input/window callbacks → update
CORE.Input
rglfw.c — vendored GLFW
When not using system GLFW, rglfw.c compiles all external/glfw/src/*.c into one object. CMake uses GlfwImport.cmake; Makefile links rglfw.o separately.
CMake PLATFORM mapping
| CMake -DPLATFORM | C define |
|---|---|
| Desktop | PLATFORM_DESKTOP → GLFW |
| SDL | PLATFORM_DESKTOP_SDL |
| RGFW | PLATFORM_DESKTOP_RGFW |
| Web | PLATFORM_WEB |
| DRM | PLATFORM_DRM |
| Android | PLATFORM_ANDROID |
| Memory | PLATFORM_MEMORY |