aboutsummaryrefslogtreecommitdiff
path: root/main.c
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 /main.c
parent7e53dff35a5fbc8b7ed5c81f19564d3941816de4 (diff)
downloadtzr-9253907755440731773cc5cf002440998bf2693b.tar.gz
load, destroy and play sound
Diffstat (limited to 'main.c')
-rw-r--r--main.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/main.c b/main.c
index 3ea0ee2..3195c09 100644
--- a/main.c
+++ b/main.c
@@ -21,7 +21,8 @@ main([[maybe_unused]] int argc, [[maybe_unused]] char **argv)
(void)TZR_LoadResourceTyped(TZR_RES_IMAGE, "res.bmp");
(void)TZR_LoadResourceTyped(TZR_RES_RAW, "main.c");
const TZR_Uint id2 = TZR_LoadResource("smile.bmp");
- if (id0 != 1 || id1 != 2 || id2 != 3)
+ const TZR_Uint id3 = TZR_LoadResourceTyped(TZR_RES_SOUND, "clap.wav");
+ if (id0 != 1 || id1 != 2 || id2 != 3 || id3 != 4)
return 1;
/* Asset loading w/ #embed (C23 proposal). */
@@ -43,6 +44,8 @@ main([[maybe_unused]] int argc, [[maybe_unused]] char **argv)
x += TZR_IsKeyDown(SDL_SCANCODE_RIGHT);
y -= TZR_IsKeyDown(SDL_SCANCODE_UP);
y += TZR_IsKeyDown(SDL_SCANCODE_DOWN);
+ if (TZR_IsKeyPressed(SDL_SCANCODE_SPACE))
+ TZR_PlaySound(id3);
if (TZR_DrawBegin()
|| TZR_DrawSetColor(0.0f, 0.0f, 0.0f)
|| TZR_DrawClear()