aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kdx.42@42l.fr>2023-04-13 09:00:13 +0200
committerkdx <kdx.42@42l.fr>2023-04-13 09:00:13 +0200
commit0525ff290cc896d2588712db3d787dda477df836 (patch)
tree4ed7467c38385f26ef2b954f7dc6cfc7d0510676
parent75e92881f10ee321231b75fece858635c87e7bd6 (diff)
downloadlzy-0525ff290cc896d2588712db3d787dda477df836.tar.gz
nodiscard and c2x requirements were overkill
-rw-r--r--CMakeLists.txt2
-rw-r--r--Makefile2
-rw-r--r--inc/lzy.h46
3 files changed, 26 insertions, 24 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 21bcd5a..bb439b6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,7 +19,7 @@ set(ASSETS
fxconv_declare_assets(${ASSETS} WITH_METADATA)
add_executable(thyaddin ${SOURCES} ${ASSETS})
-target_compile_options(thyaddin PRIVATE -Wall -Wextra -Os -std=c2x)
+target_compile_options(thyaddin PRIVATE -Wall -Wextra -Os -std=c99)
target_link_libraries(thyaddin Gint::Gint)
generate_g3a(TARGET thyaddin OUTPUT "lzy.g3a"
diff --git a/Makefile b/Makefile
index 50ed610..03a145e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
CC ?= gcc
-CFLAGS = -std=c2x -Wall -Wextra -pedantic -O3 -I./inc -MMD $(shell sdl2-config --cflags)
+CFLAGS = -std=c99 -Wall -Wextra -O3 -I./inc -MMD $(shell sdl2-config --cflags)
LDFLAGS = -lSDL2 -lSDL2_image -lSDL2_mixer $(shell sdl2-config --libs)
OBJ_NAME = lzy
diff --git a/inc/lzy.h b/inc/lzy.h
index ea748d0..1a579fe 100644
--- a/inc/lzy.h
+++ b/inc/lzy.h
@@ -78,31 +78,31 @@ typedef struct LZY_Event {
LZY_EventUnion u;
} LZY_Event;
-[[nodiscard]] int LZY_Init(const char *title, int target_fps,
+int LZY_Init(const char *title, int target_fps,
const char *tset_path, const char *font_path);
void LZY_Quit(void);
-[[nodiscard]] int LZY_DrawBegin(void);
-[[nodiscard]] int LZY_DrawEnd(void);
+int LZY_DrawBegin(void);
+int LZY_DrawEnd(void);
void LZY_DrawSetColor(uint8_t r, uint8_t g, uint8_t b);
void LZY_DrawSetColorNone(void);
-[[nodiscard]] int LZY_DrawClear(void);
-[[nodiscard]] int LZY_DrawPoint(int x, int y);
-[[nodiscard]] int LZY_DrawLine(int x0, int y0, int x1, int y1);
-[[nodiscard]] int LZY_DrawRect(int x, int y, int w, int h);
-[[nodiscard]] int LZY_FillRect(int x, int y, int w, int h);
-[[nodiscard]] int LZY_DrawTile(unsigned int id, int x, int y);
-[[nodiscard]] int LZY_DrawTileEx(unsigned int id, int x, int y, unsigned int w,
- unsigned int h);
-[[nodiscard]] int LZY_DrawChar(unsigned char chr, int x, int y);
-[[nodiscard]] int LZY_DrawText(int x, int y, const char *text);
-[[nodiscard]] int LZY_DrawTextF(int x, int y, const char *fmt, ...);
-[[nodiscard]] LZY_Music *LZY_MusicLoad(const char *path);
-[[nodiscard]] int LZY_MusicDestroy(LZY_Music *music);
-[[nodiscard]] int LZY_MusicPlay(LZY_Music *music, int loops);
-[[nodiscard]] LZY_Sound *LZY_SoundLoad(const char *path);
-[[nodiscard]] int LZY_SoundDestroy(LZY_Sound *sound);
+int LZY_DrawClear(void);
+int LZY_DrawPoint(int x, int y);
+int LZY_DrawLine(int x0, int y0, int x1, int y1);
+int LZY_DrawRect(int x, int y, int w, int h);
+int LZY_FillRect(int x, int y, int w, int h);
+int LZY_DrawTile(unsigned int id, int x, int y);
+int LZY_DrawTileEx(unsigned int id, int x, int y, unsigned int w,
+ unsigned int h);
+int LZY_DrawChar(unsigned char chr, int x, int y);
+int LZY_DrawText(int x, int y, const char *text);
+int LZY_DrawTextF(int x, int y, const char *fmt, ...);
+LZY_Music *LZY_MusicLoad(const char *path);
+int LZY_MusicDestroy(LZY_Music *music);
+int LZY_MusicPlay(LZY_Music *music, int loops);
+LZY_Sound *LZY_SoundLoad(const char *path);
+int LZY_SoundDestroy(LZY_Sound *sound);
void LZY_SoundSetVolume(LZY_Sound *sound, float volume);
-[[nodiscard]] int LZY_SoundPlay(LZY_Sound *sound, int loops);
+int LZY_SoundPlay(LZY_Sound *sound, int loops);
int LZY_PollEvent(LZY_Event *);
void LZY_CycleEvents(void);
int LZY_KeyDown(unsigned int key);
@@ -111,8 +111,10 @@ void LZY_Log(const char *fmt, ...);
int LZY_LogError(int rv);
const char *LZY_GetError(void);
-[[deprecated("renamed to LZY_FillRect")]] [[nodiscard]] int
-LZY_DrawFillRect(int x, int y, int w, int h);
+#ifdef __has_cpp_attribute
+[[deprecated("renamed to LZY_FillRect")]]
+#endif
+int LZY_DrawFillRect(int x, int y, int w, int h);
#ifdef __cplusplus
}