aboutsummaryrefslogtreecommitdiff
path: root/headers
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2023-03-31 03:07:24 +0200
committerkdx <kikoodx@paranoici.org>2023-03-31 03:07:24 +0200
commit9253907755440731773cc5cf002440998bf2693b (patch)
treeb5f8531304454553f7f0f9d65f85924c4c2811e6 /headers
parent7e53dff35a5fbc8b7ed5c81f19564d3941816de4 (diff)
downloadtzr-9253907755440731773cc5cf002440998bf2693b.tar.gz
load, destroy and play sound
Diffstat (limited to 'headers')
-rw-r--r--headers/TZR_sound.h4
-rw-r--r--headers/TZR_types.h8
2 files changed, 12 insertions, 0 deletions
diff --git a/headers/TZR_sound.h b/headers/TZR_sound.h
new file mode 100644
index 0000000..e9677b2
--- /dev/null
+++ b/headers/TZR_sound.h
@@ -0,0 +1,4 @@
+#pragma once
+#include "TZR_types.h"
+
+int TZR_PlaySound(TZR_Uint id);
diff --git a/headers/TZR_types.h b/headers/TZR_types.h
index c6a529e..f60b889 100644
--- a/headers/TZR_types.h
+++ b/headers/TZR_types.h
@@ -1,10 +1,12 @@
#pragma once
#include <stdbool.h>
#include <SDL2/SDL_render.h>
+#include <SDL2/SDL_mixer.h>
enum TZR_ResourceType {
TZR_RES_RAW,
TZR_RES_IMAGE,
+ TZR_RES_SOUND,
___TZR_RES_COUNT
};
@@ -29,6 +31,7 @@ typedef struct TZR_Rect TZR_Rect;
typedef enum TZR_ResourceType TZR_ResourceType;
typedef struct TZR_Raw TZR_Raw;
typedef struct TZR_Image TZR_Image;
+typedef struct TZR_Sound TZR_Sound;
typedef struct TZR_Resource TZR_Resource;
typedef enum TZR_EventType TZR_EventType;
typedef struct TZR_Event TZR_Event;
@@ -76,6 +79,10 @@ struct TZR_Image {
SDL_Texture *ptr;
};
+struct TZR_Sound {
+ Mix_Chunk *ptr;
+};
+
struct TZR_Resource {
TZR_ResourceType type;
char *path; /* allocated and freed by TZR; can be NULL */
@@ -83,6 +90,7 @@ struct TZR_Resource {
union {
TZR_Raw raw; /* raw file data */
TZR_Image image;
+ TZR_Sound sound;
};
};