diff options
author | Clément Gallet <clement.gallet@ens-lyon.org> | 2024-02-15 13:31:08 +0100 |
---|---|---|
committer | Clément Gallet <clement.gallet@ens-lyon.org> | 2024-02-15 13:31:08 +0100 |
commit | 95a71ae759ac369c866f80c2dfac92b9e28a5ea8 (patch) | |
tree | 857687d72fb1fe971c81745b81fd22e68da3679a | |
parent | bb30a574180fbac02dd426a2e005eaeeeb6cbdaa (diff) |
Handle systems with old SDL2 version
-rw-r--r-- | src/external/imgui/imgui_impl_sdlrenderer2.cpp | 14 | ||||
-rw-r--r-- | src/library/sdl/sdldynapi.cpp | 24 |
2 files changed, 35 insertions, 3 deletions
diff --git a/src/external/imgui/imgui_impl_sdlrenderer2.cpp b/src/external/imgui/imgui_impl_sdlrenderer2.cpp index d34fb66c..cbd06f0c 100644 --- a/src/external/imgui/imgui_impl_sdlrenderer2.cpp +++ b/src/external/imgui/imgui_impl_sdlrenderer2.cpp @@ -40,8 +40,20 @@ // SDL #include <SDL2/SDL.h> +#if !SDL_VERSION_ATLEAST(2,0,12) +typedef enum +{ + SDL_ScaleModeNearest, /**< nearest pixel sampling */ + SDL_ScaleModeLinear, /**< linear filtering */ + SDL_ScaleModeBest /**< anisotropic filtering */ +} SDL_ScaleMode; + +extern int SDL_SetTextureScaleMode(SDL_Texture * texture, SDL_ScaleMode scaleMode); +#endif + #if !SDL_VERSION_ATLEAST(2,0,17) -#error This backend requires SDL 2.0.17+ because of SDL_RenderGeometry() function +struct SDL_Vertex; +extern int SDL_RenderGeometry(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Vertex *vertices, int num_vertices, const int *indices, int num_indices); #endif #include "hook.h" diff --git a/src/library/sdl/sdldynapi.cpp b/src/library/sdl/sdldynapi.cpp index f762c4aa..81715ce8 100644 --- a/src/library/sdl/sdldynapi.cpp +++ b/src/library/sdl/sdldynapi.cpp @@ -19,9 +19,29 @@ #include "sdldynapi.h" -/* Define some SDL functions that appear in version 2.0.6, because still many - * distributions are bundled with version 2.0.5 */ +/* Define some SDL functions that appear in later versions, so that + * distributions that are bundled with old version can still compile this */ #include "inputs/sdljoystick.h" + +#if !SDL_VERSION_ATLEAST(2,0,5) +OVERRIDE int SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect); +#endif + +#if !SDL_VERSION_ATLEAST(2,0,12) +typedef enum +{ + SDL_ScaleModeNearest, /**< nearest pixel sampling */ + SDL_ScaleModeLinear, /**< linear filtering */ + SDL_ScaleModeBest /**< anisotropic filtering */ +} SDL_ScaleMode; +OVERRIDE int SDL_SetTextureScaleMode(SDL_Texture * texture, SDL_ScaleMode scaleMode); +#endif + +#if !SDL_VERSION_ATLEAST(2,0,17) +struct SDL_Vertex; +OVERRIDE int SDL_RenderGeometry(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Vertex *vertices, int num_vertices, const int *indices, int num_indices); +#endif + #include "logging.h" #include "general/dlhook.h" #include "hook.h" |