mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-29 02:34:23 +00:00
Removed the SDL_Version structure, moved SDL version to SDL.h
Inspired by https://github.com/libsdl-org/SDL/issues/9788
This commit is contained in:
39
src/SDL.c
39
src/SDL.c
@@ -65,20 +65,16 @@ SDL_COMPILE_TIME_ASSERT(SDL_BUILD_MAJOR_VERSION,
|
||||
SDL_COMPILE_TIME_ASSERT(SDL_BUILD_MINOR_VERSION,
|
||||
SDL_MINOR_VERSION == SDL_BUILD_MINOR_VERSION);
|
||||
SDL_COMPILE_TIME_ASSERT(SDL_BUILD_MICRO_VERSION,
|
||||
SDL_PATCHLEVEL == SDL_BUILD_MICRO_VERSION);
|
||||
SDL_MICRO_VERSION == SDL_BUILD_MICRO_VERSION);
|
||||
#endif
|
||||
|
||||
/* Limited by its encoding in SDL_VERSIONNUM */
|
||||
SDL_COMPILE_TIME_ASSERT(SDL_MAJOR_VERSION_min, SDL_MAJOR_VERSION >= 0);
|
||||
/* Limited only by the need to fit in SDL_Version */
|
||||
SDL_COMPILE_TIME_ASSERT(SDL_MAJOR_VERSION_max, SDL_MAJOR_VERSION <= 255);
|
||||
|
||||
SDL_COMPILE_TIME_ASSERT(SDL_MAJOR_VERSION_max, SDL_MAJOR_VERSION <= 10);
|
||||
SDL_COMPILE_TIME_ASSERT(SDL_MINOR_VERSION_min, SDL_MINOR_VERSION >= 0);
|
||||
/* Limited only by the need to fit in SDL_Version */
|
||||
SDL_COMPILE_TIME_ASSERT(SDL_MINOR_VERSION_max, SDL_MINOR_VERSION <= 255);
|
||||
|
||||
SDL_COMPILE_TIME_ASSERT(SDL_PATCHLEVEL_min, SDL_PATCHLEVEL >= 0);
|
||||
/* Limited by its encoding in SDL_VERSIONNUM and in the ABI versions */
|
||||
SDL_COMPILE_TIME_ASSERT(SDL_PATCHLEVEL_max, SDL_PATCHLEVEL <= 99);
|
||||
SDL_COMPILE_TIME_ASSERT(SDL_MINOR_VERSION_max, SDL_MINOR_VERSION <= 999);
|
||||
SDL_COMPILE_TIME_ASSERT(SDL_MICRO_VERSION_min, SDL_MICRO_VERSION >= 0);
|
||||
SDL_COMPILE_TIME_ASSERT(SDL_MICRO_VERSION_max, SDL_MICRO_VERSION <= 999);
|
||||
|
||||
/* This is not declared in any header, although it is shared between some
|
||||
parts of SDL, because we don't want anything calling it without an
|
||||
@@ -579,28 +575,9 @@ Uint32 SDL_GetNextObjectID(void)
|
||||
}
|
||||
|
||||
/* Get the library version number */
|
||||
int SDL_GetVersion(SDL_Version *ver)
|
||||
int SDL_GetVersion(void)
|
||||
{
|
||||
static SDL_bool check_hint = SDL_TRUE;
|
||||
static SDL_bool legacy_version = SDL_FALSE;
|
||||
|
||||
if (!ver) {
|
||||
return SDL_InvalidParamError("ver");
|
||||
}
|
||||
|
||||
SDL_VERSION(ver);
|
||||
|
||||
if (check_hint) {
|
||||
check_hint = SDL_FALSE;
|
||||
legacy_version = SDL_GetHintBoolean("SDL_LEGACY_VERSION", SDL_FALSE);
|
||||
}
|
||||
|
||||
if (legacy_version) {
|
||||
/* Prior to SDL 2.24.0, the patch version was incremented with every release */
|
||||
ver->patch = ver->minor;
|
||||
ver->minor = 0;
|
||||
}
|
||||
return 0;
|
||||
return SDL_VERSION;
|
||||
}
|
||||
|
||||
/* Get the library source revision */
|
||||
|
||||
@@ -567,7 +567,7 @@ JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetVersion)(JNIEnv *env, jcla
|
||||
{
|
||||
char version[128];
|
||||
|
||||
SDL_snprintf(version, sizeof(version), "%d.%d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
|
||||
SDL_snprintf(version, sizeof(version), "%d.%d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_MICRO_VERSION);
|
||||
|
||||
return (*env)->NewStringUTF(env, version);
|
||||
}
|
||||
|
||||
@@ -511,7 +511,7 @@ SDL_DYNAPI_PROC(SDL_TouchDeviceType,SDL_GetTouchDeviceType,(SDL_TouchID a),(a),r
|
||||
SDL_DYNAPI_PROC(SDL_TouchID*,SDL_GetTouchDevices,(int *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Finger**,SDL_GetTouchFingers,(SDL_TouchID a, int *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(char*,SDL_GetUserFolder,(SDL_Folder a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetVersion,(SDL_Version *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetVersion,(void),(),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetVideoDriver,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetWindowBordersSize,(SDL_Window *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return)
|
||||
SDL_DYNAPI_PROC(float,SDL_GetWindowDisplayScale,(SDL_Window *a),(a),return)
|
||||
|
||||
Reference in New Issue
Block a user