Got the suite rebuilding, most tests pass, actor and sprite are failing
This commit is contained in:
13
src/assets.c
13
src/assets.c
@@ -5,8 +5,9 @@
|
||||
#include <sdl3game/game.h>
|
||||
#include <sdl3game/staticstring.h>
|
||||
#include <sdl3game/heap.h>
|
||||
#include <sdl3game/error.h>
|
||||
|
||||
ErrorContext *load_start_bgm(char *fname)
|
||||
akerr_ErrorContext *load_start_bgm(char *fname)
|
||||
{
|
||||
PREPARE_ERROR(errctx);
|
||||
//string *tmpstr = NULL;
|
||||
@@ -14,31 +15,31 @@ ErrorContext *load_start_bgm(char *fname)
|
||||
SDL_PropertiesID bgmprops = 0;
|
||||
|
||||
ATTEMPT {
|
||||
FAIL_ZERO_BREAK(errctx, fname, ERR_NULLPOINTER, "load_start_bgm received NULL filename");
|
||||
FAIL_ZERO_BREAK(errctx, fname, AKERR_NULLPOINTER, "load_start_bgm received NULL filename");
|
||||
//CATCH(errctx, heap_next_string(&tmpstr));
|
||||
//CATCH(errctx, string_initialize(tmpstr, NULL));
|
||||
|
||||
//SDL_snprintf((char *)&tmpstr->data, MAX_STRING_LENGTH, "%s%s", SDL_GetBasePath(), fname);
|
||||
SDL_Log("Loading music asset from %s", fname);
|
||||
bgm = MIX_LoadAudio(game.mixer, fname, true);
|
||||
FAIL_ZERO_BREAK(errctx, bgm, ERR_NULLPOINTER, "Failed to load music asset %s : %s", fname, SDL_GetError());
|
||||
FAIL_ZERO_BREAK(errctx, bgm, AKERR_NULLPOINTER, "Failed to load music asset %s : %s", fname, SDL_GetError());
|
||||
|
||||
bgmtrack = MIX_CreateTrack(game.mixer);
|
||||
FAIL_ZERO_BREAK(errctx, bgmtrack, ERR_NULLPOINTER, "Failed to create audio track for background music: %s", SDL_GetError());
|
||||
FAIL_ZERO_BREAK(errctx, bgmtrack, AKERR_NULLPOINTER, "Failed to create audio track for background music: %s", SDL_GetError());
|
||||
|
||||
game.tracks[GAME_AUDIO_TRACK_BGM] = bgmtrack;
|
||||
|
||||
FAIL_ZERO_BREAK(
|
||||
errctx,
|
||||
MIX_SetTrackAudio(bgmtrack, bgm),
|
||||
ERR_SDL,
|
||||
AKERR_SDL,
|
||||
"%s",
|
||||
SDL_GetError());
|
||||
|
||||
SDL_SetNumberProperty(bgmprops, MIX_PROP_PLAY_LOOPS_NUMBER, -1);
|
||||
|
||||
if (!MIX_PlayTrack(bgmtrack, bgmprops)) {
|
||||
FAIL_BREAK(errctx, ERR_SDL, "Failed to play music asset %s", fname);
|
||||
FAIL_BREAK(errctx, AKERR_SDL, "Failed to play music asset %s", fname);
|
||||
}
|
||||
} CLEANUP {
|
||||
//IGNORE(heap_release_string(tmpstr));
|
||||
|
||||
Reference in New Issue
Block a user