diff options
author | kdx <kikoodx@paranoici.org> | 2023-03-31 03:07:24 +0200 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2023-03-31 03:07:24 +0200 |
commit | 9253907755440731773cc5cf002440998bf2693b (patch) | |
tree | b5f8531304454553f7f0f9d65f85924c4c2811e6 /main.c | |
parent | 7e53dff35a5fbc8b7ed5c81f19564d3941816de4 (diff) | |
download | tzr-9253907755440731773cc5cf002440998bf2693b.tar.gz |
load, destroy and play sound
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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() |