diff options
author | talha <sarcxd@gmail.com> | 2025-02-03 11:44:41 +0500 |
---|---|---|
committer | talha <sarcxd@gmail.com> | 2025-02-03 11:44:41 +0500 |
commit | 2cf57a4abcb4bb552cb805c74c19b1ad21fba411 (patch) | |
tree | b02d8d07ff366dd48ea354d1d921e7721013cf9c /source | |
parent | ffda86a00d364187111e227b724fbc7b82628c62 (diff) |
Added miniaudio
Diffstat (limited to 'source')
-rwxr-xr-x | source/main.cpp | 18 | ||||
-rw-r--r-- | source/memory/arena.h | 2 |
2 files changed, 18 insertions, 2 deletions
diff --git a/source/main.cpp b/source/main.cpp index 0fcfab5..ca9e71a 100755 --- a/source/main.cpp +++ b/source/main.cpp @@ -1,8 +1,10 @@ #include <SDL2/SDL.h> #include <glad/glad.h> -#define STB_IMAGE_IMPLEMENTATION -#include "stb_image.h" +#define MINIAUDIO_IMPLEMENTATION +#include "miniaudio.h" + +#include <stdio.h> #include <ft2build.h> #include FT_FREETYPE_H @@ -1122,6 +1124,17 @@ int main(int argc, char* argv[]) FrameTimer timer = frametimer(); + // @section: audio + ma_result result; + ma_engine engine; + + result = ma_engine_init(NULL, &engine); + if (result != MA_SUCCESS) { + return -1; + } + + ma_engine_play_sound(&engine, "assets/audio/winds_of_stories.mp3", NULL); + while (game_running) { controller.jump = 0; @@ -1670,6 +1683,7 @@ int main(int argc, char* argv[]) enforce_frame_rate(&timer, 60); } + ma_engine_uninit(&engine); free(level_mem); free(batch_memory); free(renderer.ui_text.transforms); diff --git a/source/memory/arena.h b/source/memory/arena.h index 83ff277..ce167f9 100644 --- a/source/memory/arena.h +++ b/source/memory/arena.h @@ -1,5 +1,7 @@ #pragma once +#include <assert.h> + #ifndef ALIGNMENT #define ALIGNMENT (2*sizeof(void*)) #endif |