From e081255fddb498ceb45a986dc301b501c3f32ebd Mon Sep 17 00:00:00 2001 From: Lilis Iskandar Date: Tue, 20 Nov 2018 17:30:37 +0800 Subject: [PATCH] sdl: Disable warnings of old SDL2 version by the default All the old SDL2 version warning messages are now disabled by default. To enable it, you can set the CGO_CPPFLAGS environment variable such as the following: CGO_CPPFLAGS=-DWARN_OUTDATED go build or CGO_CPPFLAGS=-DWARN_OUTDATED go get -v github.com/veandco/go-sdl2/sdl Signed-off-by: Lilis Iskandar --- sdl/audio.go | 36 ++++++++++++++++++++ sdl/blendmode.go | 16 +++++++++ sdl/cpuinfo.go | 16 +++++++++ sdl/events.go | 32 ++++++++++++++++++ sdl/filesystem.go | 8 +++++ sdl/gamecontroller.go | 24 ++++++++++++++ sdl/joystick.go | 64 ++++++++++++++++++++++++++++++++++++ sdl/mouse.go | 16 +++++++++ sdl/render.go | 12 +++++++ sdl/rwops.go | 4 +++ sdl/sdl.go | 4 +++ sdl/sensor.go | 56 +++++++++++++++++++++++++++++++ sdl/surface.go | 24 ++++++++++++++ sdl/system_android.go | 4 +++ sdl/syswm.go | 12 +++++++ sdl/video.go | 76 +++++++++++++++++++++++++++++++++++++++++++ sdl/vulkan.go | 24 ++++++++++++++ 17 files changed, 428 insertions(+) diff --git a/sdl/audio.go b/sdl/audio.go index 1dbaace2..8ba73e36 100644 --- a/sdl/audio.go +++ b/sdl/audio.go @@ -4,7 +4,11 @@ package sdl #include "sdl_wrapper.h" #if !(SDL_VERSION_ATLEAST(2,0,4)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_QueueAudio is not supported before SDL 2.0.4") +#endif + static int SDL_QueueAudio(SDL_AudioDeviceID dev, const void *data, Uint32 len) { return -1; @@ -19,7 +23,11 @@ static void SDL_ClearQueuedAudio(SDL_AudioDeviceID dev) #endif #if !(SDL_VERSION_ATLEAST(2,0,5)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_DequeueAudio is not supported before SDL 2.0.5") +#endif + static int SDL_DequeueAudio(SDL_AudioDeviceID dev, const void *data, Uint32 len) { return -1; @@ -31,43 +39,71 @@ static int SDL_DequeueAudio(SDL_AudioDeviceID dev, const void *data, Uint32 len) struct _SDL_AudioStream; typedef struct _SDL_AudioStream SDL_AudioStream; + +#if defined(WARN_OUTDATED) #pragma message("SDL_NewAudioStream is not supported before SDL 2.0.7") +#endif + static SDL_AudioStream * SDL_NewAudioStream(const SDL_AudioFormat src_format, const Uint8 src_channels, const int src_rate, const SDL_AudioFormat dst_format, const Uint8 dst_channels, const int dst_rate) { return 0; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_AudioStreamPut is not supported before SDL 2.0.7") +#endif + static int SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len) { return -1; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_AudioStreamGet is not supported before SDL 2.0.7") +#endif + static int SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len) { return -1; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_AudioStreamAvailable is not supported before SDL 2.0.7") +#endif + static int SDL_AudioStreamAvailable(SDL_AudioStream *stream) { return -1; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_AudioStreamFlush is not supported before SDL 2.0.7") +#endif + static int SDL_AudioStreamFlush(SDL_AudioStream *stream) { return -1; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_AudioStreamClear is not supported before SDL 2.0.7") +#endif + static int SDL_AudioStreamClear(SDL_AudioStream *stream) { return -1; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_FreeAudioStream is not supported before SDL 2.0.7") +#endif + static void SDL_FreeAudioStream(SDL_AudioStream *stream) { } diff --git a/sdl/blendmode.go b/sdl/blendmode.go index 334eb240..2168dd81 100644 --- a/sdl/blendmode.go +++ b/sdl/blendmode.go @@ -5,10 +5,18 @@ package sdl #if !(SDL_VERSION_ATLEAST(2,0,6)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_BLENDMODE_INVALID is not supported before SDL 2.0.6") +#endif + #define SDL_BLENDMODE_INVALID (0x7FFFFFFF) + +#if defined(WARN_OUTDATED) #pragma message("SDL_BlendOperation is not supported before SDL 2.0.6") +#endif + typedef enum { SDL_BLENDOPERATION_ADD = 0x1, @@ -18,7 +26,11 @@ typedef enum SDL_BLENDOPERATION_MAXIMUM = 0x5 } SDL_BlendOperation; + +#if defined(WARN_OUTDATED) #pragma message("SDL_BlendFactor is not supported before SDL 2.0.6") +#endif + typedef enum { SDL_BLENDFACTOR_ZERO = 0x1, @@ -34,7 +46,11 @@ typedef enum } SDL_BlendFactor; + +#if defined(WARN_OUTDATED) #pragma message("SDL_ComposeCustomBlendMode is not supported before SDL 2.0.6") +#endif + SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor, SDL_BlendFactor dstColorFactor, SDL_BlendOperation colorOperation, SDL_BlendFactor srcAlphaFactor, SDL_BlendFactor dstAlphaFactor, SDL_BlendOperation alphaOperation) { return SDL_BLENDMODE_NONE; diff --git a/sdl/cpuinfo.go b/sdl/cpuinfo.go index bbbaa934..29a41a2f 100644 --- a/sdl/cpuinfo.go +++ b/sdl/cpuinfo.go @@ -4,7 +4,11 @@ package sdl #include "sdl_wrapper.h" #if !(SDL_VERSION_ATLEAST(2,0,1)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_GetSystemRAM is not supported before SDL 2.0.1") +#endif + static inline int SDL_GetSystemRAM() { return -1; @@ -12,7 +16,11 @@ static inline int SDL_GetSystemRAM() #endif #if !(SDL_VERSION_ATLEAST(2,0,2)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_HasAVX is not supported before SDL 2.0.2") +#endif + static inline SDL_bool SDL_HasAVX() { return SDL_FALSE; @@ -20,7 +28,11 @@ static inline SDL_bool SDL_HasAVX() #endif #if !(SDL_VERSION_ATLEAST(2,0,4)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_HasAVX2 is not supported before SDL 2.0.4") +#endif + static inline SDL_bool SDL_HasAVX2() { return SDL_FALSE; @@ -28,7 +40,11 @@ static inline SDL_bool SDL_HasAVX2() #endif #if !(SDL_VERSION_ATLEAST(2,0,6)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_HasNEON is not supported before SDL 2.0.4") +#endif + static inline SDL_bool SDL_HasNEON() { return SDL_FALSE; diff --git a/sdl/events.go b/sdl/events.go index 9c8b55ce..f8eb82ff 100644 --- a/sdl/events.go +++ b/sdl/events.go @@ -9,19 +9,39 @@ package sdl #endif #if !SDL_VERSION_ATLEAST(2,0,4) + +#if defined(WARN_OUTDATED) #pragma message("SDL_KEYMAPCHANGED is not supported before SDL 2.0.4") +#endif + #define SDL_KEYMAPCHANGED (0x304) + +#if defined(WARN_OUTDATED) #pragma message("SDL_AUDIODEVICEADDED is not supported before SDL 2.0.4") +#endif + #define SDL_AUDIODEVICEADDED (0x1100) + +#if defined(WARN_OUTDATED) #pragma message("SDL_AUDIODEVICEREMOVED is not supported before SDL 2.0.4") +#endif + #define SDL_AUDIODEVICEREMOVED (0x1101) + +#if defined(WARN_OUTDATED) #pragma message("SDL_RENDER_DEVICE_RESET is not supported before SDL 2.0.4") +#endif + #define SDL_RENDER_DEVICE_RESET (0x2001) + +#if defined(WARN_OUTDATED) #pragma message("SDL_AudioDeviceEvent is not supported before SDL 2.0.4") +#endif + typedef struct SDL_AudioDeviceEvent { Uint32 type; @@ -35,13 +55,25 @@ typedef struct SDL_AudioDeviceEvent #endif #if !SDL_VERSION_ATLEAST(2,0,5) + +#if defined(WARN_OUTDATED) #pragma message("SDL_DROPTEXT is not supported before SDL 2.0.5") +#endif + #define SDL_DROPTEXT (0x1001) + +#if defined(WARN_OUTDATED) #pragma message("SDL_DROPBEGIN is not supported before SDL 2.0.5") +#endif + #define SDL_DROPBEGIN (0x1002) + +#if defined(WARN_OUTDATED) #pragma message("SDL_DROPCOMPLETE is not supported before SDL 2.0.5") +#endif + #define SDL_DROPCOMPLETE (0x1003) #endif diff --git a/sdl/filesystem.go b/sdl/filesystem.go index 79520108..1f724b2e 100644 --- a/sdl/filesystem.go +++ b/sdl/filesystem.go @@ -4,13 +4,21 @@ package sdl #include "sdl_wrapper.h" #if !(SDL_VERSION_ATLEAST(2,0,1)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_GetBasePath is not supported before SDL 2.0.1") +#endif + static inline char* SDL_GetBasePath() { return NULL; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_GetPrefPath is not supported before SDL 2.0.1") +#endif + static inline char* SDL_GetPrefPath(const char *org, const char *app) { return NULL; diff --git a/sdl/gamecontroller.go b/sdl/gamecontroller.go index 3e6d9b45..185df573 100644 --- a/sdl/gamecontroller.go +++ b/sdl/gamecontroller.go @@ -4,7 +4,11 @@ package sdl #include "sdl_wrapper.h" #if !(SDL_VERSION_ATLEAST(2,0,4)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_GameControllerFromInstanceID is not supported before SDL 2.0.4") +#endif + static SDL_GameController* SDL_GameControllerFromInstanceID(SDL_JoystickID joyid) { return NULL; @@ -12,31 +16,51 @@ static SDL_GameController* SDL_GameControllerFromInstanceID(SDL_JoystickID joyid #endif #if !(SDL_VERSION_ATLEAST(2,0,6)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_GameControllerGetVendor is not supported before SDL 2.0.6") +#endif + static Uint16 SDL_GameControllerGetVendor(SDL_GameController* gamecontroller) { return 0; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_GameControllerGetProduct is not supported before SDL 2.0.6") +#endif + static Uint16 SDL_GameControllerGetProduct(SDL_GameController* gamecontroller) { return 0; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_GameControllerGetProductVersion is not supported before SDL 2.0.6") +#endif + static Uint16 SDL_GameControllerGetProductVersion(SDL_GameController* gamecontroller) { return 0; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_GameControllerNumMappings is not supported before SDL 2.0.6") +#endif + static int SDL_GameControllerNumMappings(void) { return 0; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_GameControllerMappingForIndex is not supported before SDL 2.0.6") +#endif + static char* SDL_GameControllerMappingForIndex(int mapping_index) { return NULL; diff --git a/sdl/joystick.go b/sdl/joystick.go index a5f37473..bd4c71cc 100644 --- a/sdl/joystick.go +++ b/sdl/joystick.go @@ -4,7 +4,11 @@ package sdl #include "sdl_wrapper.h" #if !(SDL_VERSION_ATLEAST(2,0,4)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_JoystickPowerLevel is not supported before SDL 2.0.4") +#endif + typedef enum { SDL_JOYSTICK_POWER_UNKNOWN = -1, @@ -16,13 +20,21 @@ typedef enum SDL_JOYSTICK_POWER_MAX } SDL_JoystickPowerLevel; + +#if defined(WARN_OUTDATED) #pragma message("SDL_JoystickCurrentPowerLevel is not supported before SDL 2.0.4") +#endif + static SDL_JoystickPowerLevel SDL_JoystickCurrentPowerLevel(SDL_Joystick* joystick) { return SDL_JOYSTICK_POWER_UNKNOWN; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_JoystickFromInstanceID is not supported before SDL 2.0.4") +#endif + static SDL_Joystick* SDL_JoystickFromInstanceID(SDL_JoystickID joyid) { return NULL; @@ -30,7 +42,11 @@ static SDL_Joystick* SDL_JoystickFromInstanceID(SDL_JoystickID joyid) #endif #if !(SDL_VERSION_ATLEAST(2,0,6)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_JoystickType is not supported before SDL 2.0.6") +#endif + typedef enum { SDL_JOYSTICK_TYPE_UNKNOWN, @@ -45,61 +61,101 @@ typedef enum SDL_JOYSTICK_TYPE_THROTTLE } SDL_JoystickType; + +#if defined(WARN_OUTDATED) #pragma message("SDL_JoystickGetDeviceVendor is not supported before SDL 2.0.6") +#endif + static Uint16 SDL_JoystickGetDeviceVendor(int device_index) { return 0; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_JoystickGetDeviceProduct is not supported before SDL 2.0.6") +#endif + static Uint16 SDL_JoystickGetDeviceProduct(int device_index) { return 0; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_JoystickGetDeviceProductVersion is not supported before SDL 2.0.6") +#endif + static Uint16 SDL_JoystickGetDeviceProductVersion(int device_index) { return 0; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_JoystickGetDeviceType is not supported before SDL 2.0.6") +#endif + static SDL_JoystickType SDL_JoystickGetDeviceType(int device_index) { return SDL_JOYSTICK_TYPE_UNKNOWN; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_JoystickGetDeviceInstanceID is not supported before SDL 2.0.6") +#endif + static SDL_JoystickID SDL_JoystickGetDeviceInstanceID(int device_index) { return 0; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_JoystickGetVendor is not supported before SDL 2.0.6") +#endif + static Uint16 SDL_JoystickGetVendor(SDL_Joystick* joystick) { return 0; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_JoystickGetProduct is not supported before SDL 2.0.6") +#endif + static Uint16 SDL_JoystickGetProduct(SDL_Joystick* joystick) { return 0; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_JoystickGetProductVersion is not supported before SDL 2.0.6") +#endif + static Uint16 SDL_JoystickGetProductVersion(SDL_Joystick* joystick) { return 0; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_JoystickGetType is not supported before SDL 2.0.6") +#endif + static SDL_JoystickType SDL_JoystickGetType(SDL_Joystick* joystick) { return SDL_JOYSTICK_TYPE_UNKNOWN; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_JoystickGetAxisInitialState is not supported before SDL 2.0.6") +#endif + static SDL_bool SDL_JoystickGetAxisInitialState(SDL_Joystick* joystick, int axis, Sint16* state) { return SDL_FALSE; @@ -108,12 +164,20 @@ static SDL_bool SDL_JoystickGetAxisInitialState(SDL_Joystick* joystick, int axis #if !(SDL_VERSION_ATLEAST(2,0,7)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_LockJoysticks is not supported before SDL 2.0.7") +#endif + static void SDL_LockJoysticks() { } + +#if defined(WARN_OUTDATED) #pragma message("SDL_UnlockJoysticks is not supported before SDL 2.0.7") +#endif + static void SDL_UnlockJoysticks() { } diff --git a/sdl/mouse.go b/sdl/mouse.go index 99fddc82..7196732b 100644 --- a/sdl/mouse.go +++ b/sdl/mouse.go @@ -10,19 +10,35 @@ package sdl #endif #if !(SDL_VERSION_ATLEAST(2,0,4)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_CaptureMouse is not supported before SDL 2.0.4") +#endif + static int SDL_CaptureMouse(SDL_bool enabled) { return -1; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_MOUSEWHEEL_NORMAL is not supported before SDL 2.0.4") +#endif + #define SDL_MOUSEWHEEL_NORMAL (0) + +#if defined(WARN_OUTDATED) #pragma message("SDL_MOUSEWHEEL_FLIPPED is not supported before SDL 2.0.4") +#endif + #define SDL_MOUSEWHEEL_FLIPPED (0) + +#if defined(WARN_OUTDATED) #pragma message("SDL_WarpMouseGlobal is not supported before SDL 2.0.4") +#endif + static int SDL_WarpMouseGlobal(int x, int y) { return -1; diff --git a/sdl/render.go b/sdl/render.go index fca0fdd8..d99f7403 100644 --- a/sdl/render.go +++ b/sdl/render.go @@ -4,7 +4,11 @@ package sdl #include "sdl_wrapper.h" #if !(SDL_VERSION_ATLEAST(2,0,1)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_UpdateYUVTexture is not supported before SDL 2.0.1") +#endif + static inline int SDL_UpdateYUVTexture(SDL_Texture* texture, const SDL_Rect* rect, const Uint8* Yplane, int Ypitch, const Uint8* Uplane, int Upitch, const Uint8* Vplane, int Vpitch) { return -1; @@ -13,13 +17,21 @@ static inline int SDL_UpdateYUVTexture(SDL_Texture* texture, const SDL_Rect* rec #if !(SDL_VERSION_ATLEAST(2,0,8)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_RenderGetMetalLayer is not supported before SDL 2.0.8") +#endif + static inline void * SDL_RenderGetMetalLayer(SDL_Renderer *renderer) { return NULL; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_RenderGetMetalCommandEncoder is not supported before SDL 2.0.8") +#endif + static inline void * SDL_RenderGetMetalCommandEncoder(SDL_Renderer *renderer) { return NULL; diff --git a/sdl/rwops.go b/sdl/rwops.go index 6b74394e..2d1b49d5 100644 --- a/sdl/rwops.go +++ b/sdl/rwops.go @@ -28,7 +28,11 @@ static int RWclose(SDL_RWops *ctx) } #if !(SDL_VERSION_ATLEAST(2,0,6)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_LoadFile_RW is not supported before SDL 2.0.6") +#endif + static void * SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize, int freesrc) { return 0; diff --git a/sdl/sdl.go b/sdl/sdl.go index 730e6037..c308df37 100644 --- a/sdl/sdl.go +++ b/sdl/sdl.go @@ -5,7 +5,11 @@ package sdl #include "sdl_wrapper.h" #if !(SDL_VERSION_ATLEAST(2,0,9)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_INIT_SENSOR is not supported before SDL 2.0.9") +#endif + #define SDL_INIT_SENSOR (0x00008000u) #endif */ diff --git a/sdl/sensor.go b/sdl/sensor.go index e07563c8..13f620cc 100644 --- a/sdl/sensor.go +++ b/sdl/sensor.go @@ -17,84 +17,140 @@ typedef enum SDL_SENSOR_GYRO } SDL_SensorType; + +#if defined(WARN_OUTDATED) #pragma message("SDL_NumSensors is not supported before SDL 2.0.9") +#endif + static inline int SDL_NumSensors() { return 0; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_SensorGetDeviceName is not supported before SDL 2.0.9") +#endif + static const char * SDL_SensorGetDeviceName(int device_index) { return NULL; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_SensorGetDeviceType is not supported before SDL 2.0.9") +#endif + static SDL_SensorType SDL_SensorGetDeviceType(int device_index) { return SDL_SENSOR_INVALID; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_SensorGetDeviceNonPortableType is not supported before SDL 2.0.9") +#endif + static int SDL_SensorGetDeviceNonPortableType(int device_index) { return -1; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_SensorGetDeviceInstanceID is not supported before SDL 2.0.9") +#endif + static SDL_SensorID SDL_SensorGetDeviceInstanceID(int device_index) { return -1; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_SensorOpen is not supported before SDL 2.0.9") +#endif + static SDL_Sensor * SDL_SensorOpen(int device_index) { return NULL; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_SensorFromInstanceID is not supported before SDL 2.0.9") +#endif + static SDL_Sensor * SDL_SensorFromInstanceID(SDL_SensorID instance_id) { return NULL; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_SensorGetName is not supported before SDL 2.0.9") +#endif + static const char * SDL_SensorGetName(SDL_Sensor *sensor) { return NULL; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_SensorGetType is not supported before SDL 2.0.9") +#endif + static SDL_SensorType SDL_SensorGetType(SDL_Sensor *sensor) { return SDL_SENSOR_INVALID; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_SensorGetNonPortableType is not supported before SDL 2.0.9") +#endif + static int SDL_SensorGetNonPortableType(SDL_Sensor *sensor) { return -1; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_SensorGetInstanceID is not supported before SDL 2.0.9") +#endif + static SDL_SensorID SDL_SensorGetInstanceID(SDL_Sensor *sensor) { return -1; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_SensorGetData is not supported before SDL 2.0.9") +#endif + static int SDL_SensorGetData(SDL_Sensor *sensor, float *data, int num_values) { return -1; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_SensorClose is not supported before SDL 2.0.9") +#endif + static void SDL_SensorClose(SDL_Sensor *sensor) { } + +#if defined(WARN_OUTDATED) #pragma message("SDL_SensorUpdate is not supported before SDL 2.0.9") +#endif + static void SDL_SensorUpdate() { } diff --git a/sdl/surface.go b/sdl/surface.go index c2d17fd1..088d012a 100644 --- a/sdl/surface.go +++ b/sdl/surface.go @@ -11,18 +11,30 @@ typedef enum { SDL_YUV_CONVERSION_AUTOMATIC } SDL_YUV_CONVERSION_MODE; + +#if defined(WARN_OUTDATED) #pragma message("SDL_SetYUVConversionMode is not supported before SDL 2.0.8") +#endif + void SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode) { } + +#if defined(WARN_OUTDATED) #pragma message("SDL_GetYUVConversionMode is not supported before SDL 2.0.8") +#endif + SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionMode(void) { return -1; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_GetYUVConversionModeForResolution is not supported before SDL 2.0.8") +#endif + SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionModeForResolution(int width, int height) { return -1; @@ -30,7 +42,11 @@ SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionModeForResolution(int width, int hei #endif #if !(SDL_VERSION_ATLEAST(2,0,6)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_DuplicateSurface is not supported before SDL 2.0.6") +#endif + static inline SDL_Surface* SDL_DuplicateSurface(SDL_Surface *surface) { return NULL; @@ -38,13 +54,21 @@ static inline SDL_Surface* SDL_DuplicateSurface(SDL_Surface *surface) #endif #if !(SDL_VERSION_ATLEAST(2,0,5)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_CreateRGBSurfaceWithFormat is not supported before SDL 2.0.5") +#endif + static inline SDL_Surface* SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, Uint32 format) { return NULL; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_CreateRGBSurfaceWithFormatFrom is not supported before SDL 2.0.5") +#endif + static inline SDL_Surface* SDL_CreateRGBSurfaceWithFormatFrom(void* pixels, int width, int height, int depth, int pitch, Uint32 format) { return NULL; diff --git a/sdl/system_android.go b/sdl/system_android.go index c98865b4..42872689 100644 --- a/sdl/system_android.go +++ b/sdl/system_android.go @@ -6,7 +6,11 @@ package sdl #include "sdl_wrapper.h" #if !(SDL_VERSION_ATLEAST(2,0,8)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_IsAndroidTV is not supported before SDL 2.0.8") +#endif + static int SDL_IsAndroidTV(void) { return -1; diff --git a/sdl/syswm.go b/sdl/syswm.go index abd147e6..fb6cdc01 100644 --- a/sdl/syswm.go +++ b/sdl/syswm.go @@ -15,17 +15,29 @@ package sdl #endif #if !(SDL_VERSION_ATLEAST(2,0,3)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_SYSWM_WINRT is not supported before SDL 2.0.3") +#endif + #define SDL_SYSWM_WINRT (0) #endif #if !(SDL_VERSION_ATLEAST(2,0,4)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_SYSWM_ANDROID is not supported before SDL 2.0.4") +#endif + #define SDL_SYSWM_ANDROID (0) #endif #if !(SDL_VERSION_ATLEAST(2,0,5)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_SYSWM_VIVANTE is not supported before SDL 2.0.5") +#endif + #define SDL_SYSWM_VIVANTE (0) #endif */ diff --git a/sdl/video.go b/sdl/video.go index 2d7a02d9..d8dee6fe 100644 --- a/sdl/video.go +++ b/sdl/video.go @@ -16,21 +16,41 @@ static void SDL_GL_GetDrawableSize(SDL_Window *window, int *w, int *h) *h = 0; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_WINDOW_ALLOW_HIGHDPI is not supported before SDL 2.0.1") +#endif + #define SDL_WINDOW_ALLOW_HIGHDPI (0) + +#if defined(WARN_OUTDATED) #pragma message("SDL_GL_FRAMEBUFFER_SRGB_CAPABLE is not supported before SDL 2.0.1") +#endif + #define SDL_GL_FRAMEBUFFER_SRGB_CAPABLE (0) #endif #if !(SDL_VERSION_ATLEAST(2,0,4)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_WINDOW_MOUSE_CAPTURE is not supported before SDL 2.0.4") +#endif + #define SDL_WINDOW_MOUSE_CAPTURE (0) + +#if defined(WARN_OUTDATED) #pragma message("SDL_GL_CONTEXT_RELEASE_BEHAVIOR is not supported before SDL 2.0.4") +#endif + #define SDL_GL_CONTEXT_RELEASE_BEHAVIOR (0) + +#if defined(WARN_OUTDATED) #pragma message("SDL_GetDisplayDPI is not supported before SDL 2.0.4") +#endif + static int SDL_GetDisplayDPI(int displayIndex, float* ddpi, float* hdpi, float* vdpi) { return -1; @@ -39,59 +59,115 @@ static int SDL_GetDisplayDPI(int displayIndex, float* ddpi, float* hdpi, float* #endif #if !(SDL_VERSION_ATLEAST(2,0,5)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_SetWindowResizable is not supported before SDL 2.0.5") +#endif + static void SDL_SetWindowResizable(SDL_Window *window, SDL_bool resizable) { } + +#if defined(WARN_OUTDATED) #pragma message("SDL_SetWindowOpacity is not supported before SDL 2.0.5") +#endif + static int SDL_SetWindowOpacity(SDL_Window *window, float opacity) { return -1; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_GetWindowOpacity is not supported before SDL 2.0.5") +#endif + static int SDL_GetWindowOpacity(SDL_Window *window, float *opacity) { return -1; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_GetDisplayUsableBounds is not supported before SDL 2.0.5") +#endif + static int SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect* rect) { return -1; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_WINDOW_ALWAYS_ON_TOP is not supported before SDL 2.0.5") +#endif + #define SDL_WINDOW_ALWAYS_ON_TOP (0) + +#if defined(WARN_OUTDATED) #pragma message("SDL_WINDOW_SKIP_TASKBAR is not supported before SDL 2.0.5") +#endif + #define SDL_WINDOW_SKIP_TASKBAR (0) + +#if defined(WARN_OUTDATED) #pragma message("SDL_WINDOW_UTILITY is not supported before SDL 2.0.5") +#endif + #define SDL_WINDOW_UTILITY (0) + +#if defined(WARN_OUTDATED) #pragma message("SDL_WINDOW_TOOLTIP is not supported before SDL 2.0.5") +#endif + #define SDL_WINDOW_TOOLTIP (0) + +#if defined(WARN_OUTDATED) #pragma message("SDL_WINDOW_POPUP_MENU is not supported before SDL 2.0.5") +#endif + #define SDL_WINDOW_POPUP_MENU (0) + +#if defined(WARN_OUTDATED) #pragma message("SDL_WINDOWEVENT_TAKE_FOCUS is not supported before SDL 2.0.5") +#endif + #define SDL_WINDOWEVENT_TAKE_FOCUS (0) + +#if defined(WARN_OUTDATED) #pragma message("SDL_WINDOWEVENT_HIT_TEST is not supported before SDL 2.0.5") +#endif + #define SDL_WINDOWEVENT_HIT_TEST (0) #endif #if !(SDL_VERSION_ATLEAST(2,0,6)) + +#if defined(WARN_OUTDATED) #pragma message("SDL_WINDOW_VULKAN is not supported before SDL 2.0.6") +#endif + #define SDL_WINDOW_VULKAN (0) + +#if defined(WARN_OUTDATED) #pragma message("SDL_GL_CONTEXT_RESET_NOTIFICATION is not supported before SDL 2.0.6") +#endif + #define SDL_GL_CONTEXT_RESET_NOTIFICATION (0) + +#if defined(WARN_OUTDATED) #pragma message("SDL_GL_CONTEXT_NO_ERROR is not supported before SDL 2.0.6") +#endif + #define SDL_GL_CONTEXT_NO_ERROR (0) #endif */ diff --git a/sdl/vulkan.go b/sdl/vulkan.go index 3392ba84..c11f6d69 100644 --- a/sdl/vulkan.go +++ b/sdl/vulkan.go @@ -23,34 +23,58 @@ VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR) typedef VkInstance SDL_vulkanInstance; typedef VkSurfaceKHR SDL_vulkanSurface; + +#if defined(WARN_OUTDATED) #pragma message("SDL_Vulkan_LoadLibrary is not supported before SDL 2.0.6") +#endif + static int SDL_Vulkan_LoadLibrary(const char *path) { return 0; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_Vulkan_GetVkGetInstanceProcAddr is not supported before SDL 2.0.6") +#endif + static void* SDL_Vulkan_GetVkGetInstanceProcAddr(void) { return NULL; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_Vulkan_UnloadLibrary is not supported before SDL 2.0.6") +#endif + static void SDL_Vulkan_UnloadLibrary(void) {} + +#if defined(WARN_OUTDATED) #pragma message("SDL_Vulkan_GetInstanceExtensions is not supported before SDL 2.0.6") +#endif + static int SDL_Vulkan_GetInstanceExtensions(SDL_Window *window, unsigned int *pCount, const char **pNames) { return 0; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_Vulkan_CreateSurface is not supported before SDL 2.0.6") +#endif + static int SDL_Vulkan_CreateSurface(SDL_Window *window, VkInstance instance, VkSurfaceKHR *surface) { return 0; } + +#if defined(WARN_OUTDATED) #pragma message("SDL_Vulkan_GetDrawableSize is not supported before SDL 2.0.6") +#endif + static void SDL_Vulkan_GetDrawableSize(SDL_Window *window, int *w, int *h) { *w = 0; *h = 0;