aboutsummaryrefslogtreecommitdiff
path: root/headers
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2023-03-25 04:45:24 +0100
committerkdx <kikoodx@paranoici.org>2023-03-25 04:45:38 +0100
commit9506c24b9303d4a476e31711ad854cee006f3169 (patch)
tree19f2f87bb7444ccfa82535781106b65de5ad2617 /headers
parent7dd6658d452fe8e447205cfc34594a537221b9a1 (diff)
downloadtzr-9506c24b9303d4a476e31711ad854cee006f3169.tar.gz
bump to C23
Diffstat (limited to 'headers')
-rw-r--r--headers/TZR.h1
-rw-r--r--headers/TZR_render.h8
-rw-r--r--headers/TZR_resource.h4
3 files changed, 13 insertions, 0 deletions
diff --git a/headers/TZR.h b/headers/TZR.h
index 262b936..1af2f40 100644
--- a/headers/TZR.h
+++ b/headers/TZR.h
@@ -21,6 +21,7 @@
/* 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. */
+[[nodiscard]]
int _TZR_Init(const TZR_Config *config);
/* Destroy and free everything created by TZR. */
diff --git a/headers/TZR_render.h b/headers/TZR_render.h
index 5732770..b3f2ba3 100644
--- a/headers/TZR_render.h
+++ b/headers/TZR_render.h
@@ -5,28 +5,35 @@
/* All draw calls should happen between TZR_DrawBegin and TZR_DrawEnd.
* Return -1 on error. */
+[[nodiscard]]
int TZR_DrawBegin(void);
/* Return -1 on error. */
+[[nodiscard]]
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__ })
+[[nodiscard]]
int _TZR_DrawSetColor(const TZR_Color *color);
/* Return -1 on error. */
+[[nodiscard]]
int TZR_DrawClear(void);
/* Return -1 on error. Draw point on `x`;`y` in the framebuffer. */
+[[nodiscard]]
int TZR_DrawPoint(int x, int y);
/* Return -1 on error. Draw line between `x0`;`y0` and `x1`;`y1` in the
* framebuffer. */
+[[nodiscard]]
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
* framebuffer. */
+[[nodiscard]]
int TZR_DrawRectangle(bool fill, int x, int y, int w, int h);
/* Return -1 on error. Draw texture ressource `id` at `x`;`y` position of
@@ -34,4 +41,5 @@ int TZR_DrawRectangle(bool fill, int x, int y, int w, int h);
#define TZR_DrawImage(...) _TZR_DrawImage(&(const TZR_DrawImageArgs){ \
.x=0, .y=0, .ix=0, .iy=0, .w=INT_MIN, .h=INT_MIN, .r=0.0f, .sx=1.0f, \
.sy=1.0f, .center=false, ._=0, __VA_ARGS__ })
+[[nodiscard]]
int _TZR_DrawImage(const TZR_DrawImageArgs *args);
diff --git a/headers/TZR_resource.h b/headers/TZR_resource.h
index d9a68c4..06f0763 100644
--- a/headers/TZR_resource.h
+++ b/headers/TZR_resource.h
@@ -2,10 +2,13 @@
#include "TZR_types.h"
/* Return 0 on error. */
+[[nodiscard]]
TZR_Uint TZR_LoadResourceFromMemory(TZR_ResourceType type, const void *data, int size);
+[[nodiscard]]
TZR_Uint TZR_LoadResourceTyped(TZR_ResourceType type, const char *path);
/* Return 0 on error; try to autodetect resource type from file extension. */
+[[nodiscard]]
TZR_Uint TZR_LoadResource(const char *path);
/* Doesn't handle invalid ID. Pointer might get invalidated by resource
@@ -35,5 +38,6 @@ int TZR_ReloadResource(TZR_Uint id);
void TZR_ResourcesWatch(void);
/* Used internaly. */
+[[nodiscard]]
int TZR_DirectResourceLoad(TZR_Resource *res, const void *data, int size);
void TZR_DestroyResource(TZR_Resource *res, int free_path);