diff options
author | kdx <kikoodx@paranoici.org> | 2023-04-26 13:06:24 +0200 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2023-04-26 13:06:24 +0200 |
commit | f15b689ebc0b351529428e2ba561220ee9d31487 (patch) | |
tree | ddea003770653e74f671cf9b4450d99e1e4d80ee | |
parent | 6370f11b5a93a00045969fa4637db46d5e792dae (diff) | |
download | tzr-f15b689ebc0b351529428e2ba561220ee9d31487.tar.gz |
optional flac
-rw-r--r-- | headers/TZR.h | 2 | ||||
-rw-r--r-- | headers/TZR_types.h | 8 | ||||
-rw-r--r-- | sources/TZR_Init.c | 6 |
3 files changed, 12 insertions, 4 deletions
diff --git a/headers/TZR.h b/headers/TZR.h index 47d81f9..0c87f7a 100644 --- a/headers/TZR.h +++ b/headers/TZR.h @@ -16,7 +16,7 @@ .target_fps=60, \ .pixel_perfect=true, \ .show_cursor=false, \ - .mixer=true, \ + .mixer=TZR_MIXER_ON, \ .png_loading=true, \ .light_system=false, \ .title="TZR", \ diff --git a/headers/TZR_types.h b/headers/TZR_types.h index 81be046..bcb6ca5 100644 --- a/headers/TZR_types.h +++ b/headers/TZR_types.h @@ -23,6 +23,12 @@ enum TZR_KeyState { TZR_KEYSTATE_PRESS }; +enum TZR_MixerFlags { + TZR_MIXER_OFF, + TZR_MIXER_ON, + TZR_MIXER_FLAC +}; + typedef unsigned int TZR_Uint; typedef struct TZR_Config TZR_Config; typedef struct TZR_Point TZR_Point; @@ -47,7 +53,7 @@ struct TZR_Config { int target_fps; bool pixel_perfect; bool show_cursor; - bool mixer; + unsigned int mixer; bool png_loading; bool light_system; const char *title; diff --git a/sources/TZR_Init.c b/sources/TZR_Init.c index 1f3b5cb..c2cfea7 100644 --- a/sources/TZR_Init.c +++ b/sources/TZR_Init.c @@ -24,9 +24,11 @@ _TZR_Init(const TZR_Config *config) return _sdl_error(); if (IMG_Init(IMG_INIT_PNG * ___tzr_config.png_loading) < 0) return _sdl_error(); - if (___tzr_config.mixer && Mix_Init(MIX_INIT_FLAC) != MIX_INIT_FLAC) { + if (___tzr_config.mixer == TZR_MIXER_FLAC && + Mix_Init(MIX_INIT_FLAC) != MIX_INIT_FLAC) + { SDL_Log("%s", Mix_GetError()); - ___tzr_config.mixer = false; + ___tzr_config.mixer = TZR_MIXER_OFF; } char *const basepath = SDL_GetBasePath(); |