Skip to content

Commit 26f98df

Browse files
committed
Compatibility with SDL2 2.0.5
1 parent 15c7335 commit 26f98df

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

c_src/sdl_blend_mode.c

+15
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
#include "esdl2.h"
1616

17+
#if !SDL_VERSION_ATLEAST(2, 0, 6)
18+
#define SDL_BLENDMODE_INVALID 0x7FFFFFFF
19+
#endif
20+
1721
#define BLEND_MODE_ENUM(E) \
1822
E(none, SDL_BLENDMODE_NONE) \
1923
E(blend, SDL_BLENDMODE_BLEND) \
@@ -24,6 +28,8 @@
2428
NIF_ATOM_TO_ENUM_FUNCTION(atom_to_blend_mode, SDL_BlendMode, BLEND_MODE_ENUM)
2529
NIF_ENUM_TO_ATOM_FUNCTION(blend_mode_to_atom, SDL_BlendMode, BLEND_MODE_ENUM)
2630

31+
#if SDL_VERSION_ATLEAST(2, 0, 6)
32+
2733
#define BLEND_OPERATION_ENUM(E) \
2834
E(add, SDL_BLENDOPERATION_ADD) \
2935
E(substract, SDL_BLENDOPERATION_SUBTRACT) \
@@ -82,3 +88,12 @@ NIF_FUNCTION(compose_custom_blend_mode)
8288
srcColorFactor, dstColorFactor, colorOp,
8389
srcAlphaFactor, dstAlphaFactor, alphaOp);
8490
}
91+
92+
#else
93+
94+
NIF_FUNCTION(compose_custom_blend_mode)
95+
{
96+
return atom_undefined;
97+
}
98+
99+
#endif /* SDL_VERSION_ATLEAST(2, 0, 6) */

c_src/sdl_cpu_info.c

+4
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,14 @@ NIF_FUNCTION(has_mmx)
8989

9090
NIF_FUNCTION(has_neon)
9191
{
92+
#if SDL_VERSION_ATLEAST(2, 0, 6)
9293
if (SDL_HasNEON())
9394
return atom_true;
9495

9596
return atom_false;
97+
#else
98+
return atom_undefined;
99+
#endif
96100
}
97101

98102
// has_rdtsc

c_src/sdl_window.c

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ void dtor_Window(ErlNifEnv* env, void* obj)
2323
esdl2_windows_remove(window);
2424
}
2525

26+
#if !SDL_VERSION_ATLEAST(2, 0, 6)
27+
#define SDL_WINDOW_VULKAN 0x10000000
28+
#endif
29+
2630
#define WINDOW_FLAGS(F) \
2731
F(fullscreen, SDL_WINDOW_FULLSCREEN) \
2832
F(opengl, SDL_WINDOW_OPENGL) \

0 commit comments

Comments
 (0)