diff options
author | kdx <kikoodx@paranoici.org> | 2023-04-09 17:00:02 +0200 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2023-04-09 21:07:38 +0200 |
commit | e94bc9ed9aa064d8e6a5ba26a5117228441fd482 (patch) | |
tree | 65a57b3ec49a005ba9b47308f3db1449f6dd54dd /headers | |
parent | 64a4b4e2713679bbc44b27bef1b8af828d500272 (diff) | |
download | tzr-e94bc9ed9aa064d8e6a5ba26a5117228441fd482.tar.gz |
backward compatibility with c99
Diffstat (limited to 'headers')
-rw-r--r-- | headers/TZR.h | 2 | ||||
-rw-r--r-- | headers/TZR_light.h | 4 | ||||
-rw-r--r-- | headers/TZR_render.h | 16 | ||||
-rw-r--r-- | headers/TZR_resource.h | 8 | ||||
-rw-r--r-- | headers/TZR_sound.h | 2 |
5 files changed, 32 insertions, 0 deletions
diff --git a/headers/TZR.h b/headers/TZR.h index 0bf0e01..47d81f9 100644 --- a/headers/TZR.h +++ b/headers/TZR.h @@ -25,7 +25,9 @@ /* Should be called only once before usage of any other function unless * otherwise specified. On error this calls TZR_Quit and returns -1. * `config` will be duplicated internally and can be safely discarded. */ +#if __STDC_VERSION__ > 201710L [[nodiscard]] +#endif int _TZR_Init(const TZR_Config *config); /* Destroy and free everything created by TZR. */ diff --git a/headers/TZR_light.h b/headers/TZR_light.h index d4d26de..6d55944 100644 --- a/headers/TZR_light.h +++ b/headers/TZR_light.h @@ -1,7 +1,11 @@ #pragma once +#if __STDC_VERSION__ > 201710L [[nodiscard]] +#endif int TZR_LightBegin(void); +#if __STDC_VERSION__ > 201710L [[nodiscard]] +#endif int TZR_LightEnd(void); diff --git a/headers/TZR_render.h b/headers/TZR_render.h index 48fd40d..ebc6fa8 100644 --- a/headers/TZR_render.h +++ b/headers/TZR_render.h @@ -5,38 +5,50 @@ /* All draw calls should happen between TZR_DrawBegin and TZR_DrawEnd. * Return -1 on error. */ +#if __STDC_VERSION__ > 201710L [[nodiscard]] +#endif int TZR_DrawBegin(void); /* Return -1 on error. */ +#if __STDC_VERSION__ > 201710L [[nodiscard]] +#endif int TZR_DrawEnd(void); /* Return -1 on error. */ #define TZR_DrawSetColor(...) _TZR_DrawSetColor(&(const TZR_Color){ \ .r=-1.0f, .g=-1.0f, .b=-1.0f, .a=-1.0f, ._=0, __VA_ARGS__ }) #ifdef TZR_PARANOID +#if __STDC_VERSION__ > 201710L [[nodiscard]] #endif +#endif int _TZR_DrawSetColor(const TZR_Color *color); /* Return -1 on error. */ #ifdef TZR_PARANOID +#if __STDC_VERSION__ > 201710L [[nodiscard]] #endif +#endif int TZR_DrawClear(void); /* Return -1 on error. Draw point on `x`;`y` in the framebuffer. */ #ifdef TZR_PARANOID +#if __STDC_VERSION__ > 201710L [[nodiscard]] #endif +#endif int TZR_DrawPoint(int x, int y); /* Return -1 on error. Draw line between `x0`;`y0` and `x1`;`y1` in the * framebuffer. */ #ifdef TZR_PARANOID +#if __STDC_VERSION__ > 201710L [[nodiscard]] #endif +#endif int TZR_DrawLine(int x0, int y0, int x1, int y1); /* Return -1 on error. Draw rectangle at `x`;`y` position of size `w`x`h` in the @@ -45,8 +57,10 @@ int TZR_DrawLine(int x0, int y0, int x1, int y1); &(const TZR_DrawRectangleArgs){ \ .x=0, .y=0, .w=0, .h=0, .fill=false, .center=false, ._=0, __VA_ARGS__ }) #ifdef TZR_PARANOID +#if __STDC_VERSION__ > 201710L [[nodiscard]] #endif +#endif int _TZR_DrawRectangle(const TZR_DrawRectangleArgs *args); /* Return -1 on error. Draw texture ressource `id` at `x`;`y` position of @@ -56,8 +70,10 @@ int _TZR_DrawRectangle(const TZR_DrawRectangleArgs *args); .sy=1.0f, .center=false, .flip_x=false, .flip_y=false, ._=0, \ __VA_ARGS__ }) #ifdef TZR_PARANOID +#if __STDC_VERSION__ > 201710L [[nodiscard]] #endif +#endif int _TZR_DrawImage(const TZR_DrawImageArgs *args); void TZR_ScreenTransform(int *x, int *y); diff --git a/headers/TZR_resource.h b/headers/TZR_resource.h index 87373f0..1d2a590 100644 --- a/headers/TZR_resource.h +++ b/headers/TZR_resource.h @@ -4,13 +4,19 @@ #define TZR_RES TZR_LoadResource /* Return 0 on error. */ +#if __STDC_VERSION__ > 201710L [[nodiscard]] +#endif TZR_Uint TZR_LoadResourceFromMemory(TZR_ResourceType type, const void *data, int size); +#if __STDC_VERSION__ > 201710L [[nodiscard]] +#endif TZR_Uint TZR_LoadResourceTyped(TZR_ResourceType type, const char *path); /* Return 0 on error; try to autodetect resource type from file extension. */ +#if __STDC_VERSION__ > 201710L [[nodiscard]] +#endif TZR_Uint TZR_LoadResource(const char *path); /* Doesn't handle invalid ID. Pointer might get invalidated by resource @@ -40,6 +46,8 @@ int TZR_ReloadResource(TZR_Uint id); void TZR_ResourcesWatch(void); /* Used internaly. */ +#if __STDC_VERSION__ > 201710L [[nodiscard]] +#endif int TZR_DirectResourceLoad(TZR_Resource *res, const void *data, int size); void TZR_DestroyResource(TZR_Resource *res, int free_path); diff --git a/headers/TZR_sound.h b/headers/TZR_sound.h index 612dfaa..b24823e 100644 --- a/headers/TZR_sound.h +++ b/headers/TZR_sound.h @@ -4,6 +4,8 @@ #define TZR_PlaySound(...) _TZR_PlaySound(&(const TZR_PlaySoundArgs){ \ .id=0, .loop=0, .volume=1.0f, ._=0, __VA_ARGS__ }) #ifdef TZR_PARANOID +#if __STDC_VERSION__ > 201710L [[nodiscard]] #endif +#endif int _TZR_PlaySound(const TZR_PlaySoundArgs *args); |