aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--headers/TZR_resource.h2
-rw-r--r--sources/TZR_DrawImage.c5
-rw-r--r--sources/TZR_LoadResourceTyped.c2
3 files changed, 8 insertions, 1 deletions
diff --git a/headers/TZR_resource.h b/headers/TZR_resource.h
index 06f0763..87373f0 100644
--- a/headers/TZR_resource.h
+++ b/headers/TZR_resource.h
@@ -1,6 +1,8 @@
#pragma once
#include "TZR_types.h"
+#define TZR_RES TZR_LoadResource
+
/* Return 0 on error. */
[[nodiscard]]
TZR_Uint TZR_LoadResourceFromMemory(TZR_ResourceType type, const void *data, int size);
diff --git a/sources/TZR_DrawImage.c b/sources/TZR_DrawImage.c
index 862d94c..b9b4606 100644
--- a/sources/TZR_DrawImage.c
+++ b/sources/TZR_DrawImage.c
@@ -9,6 +9,11 @@
int
_TZR_DrawImage(const TZR_DrawImageArgs *args)
{
+ if (args->id == 0) {
+ fprintf(stderr, "args->id is 0\n");
+ return -1;
+ }
+
if (TZR_GetResourceType(args->id) != TZR_RES_IMAGE) {
fprintf(stderr, "%u isn't an image\n", args->id);
return -1;
diff --git a/sources/TZR_LoadResourceTyped.c b/sources/TZR_LoadResourceTyped.c
index 3c38ee2..126737b 100644
--- a/sources/TZR_LoadResourceTyped.c
+++ b/sources/TZR_LoadResourceTyped.c
@@ -10,7 +10,7 @@ TZR_LoadResourceTyped(TZR_ResourceType type, const char *path)
for (TZR_Uint i = 0; i < ___tzr_resources_size; i++)
if (___tzr_resources[i].type == type &&
strcmp(___tzr_resources[i].path, path) == 0)
- return i;
+ return i + 1;
FILE *const fp = fopen(path, "rb");
if (fp == NULL) {
perror(path);