diff --git a/README.md b/README.md index b7d68e7d..9873d3ce 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,10 @@ SDL2 is backwards compatible - so anything written against `v2.0.8` can be compi against newer versions of the SDL2 library. Also note that SDL2 **is not** compatible with SDL `v1.x`. +SDL2 is however compatible with SDL3 through the [`sdl2-compat`](https://github.com/libsdl-org/sdl2-compat) layer. +Which makes it possible to use the SDL2 API through the SDL3 libraries. +You can tell `sdl` to use this compatibility layer on systems that support `pkgconfig` by +passing the compile time flag `-d sdl_compat` when building your `sdl`/SDL2 based V application. ## Notes on garbage collection and memory issues diff --git a/c/sdl.c.v b/c/sdl.c.v index 361915b3..0a1291b8 100644 --- a/c/sdl.c.v +++ b/c/sdl.c.v @@ -13,7 +13,12 @@ $if !windows { // This is especially useful when building/linking against a // custom compiled version of the libs on *nix. $if !sdl_no_compile_flags ? { - #pkgconfig --cflags --libs sdl2 + $if sdl_compat ? { + // Use SDL2 through SDL3 via the compatibility layer + #pkgconfig --cflags --libs sdl2_compat + } $else { + #pkgconfig --cflags --libs sdl2 + } } } } $else {