Implemented load audio and music files as well the basic audio playback
functionality.
This commit is contained in:
1 parent
dfee36ffe9
commit
e3f4f9c94f
9 files changed
+464
-61
No files matched your search
@@ -27,7 +27,7 @@ void remove_asset_from_manager(AssetManager *am, AssetID *id_ptr);
|
||||
SDL_Texture *get_texture(AssetManager *am, AssetID id);
|
||||
Mix_Chunk *get_audio_chunk(AssetManager *am, AssetID id);
|
||||
Mix_Music *get_music(AssetManager *am, AssetID id);
|
||||
void destroy_asset_manager(AssetManager *am);
|
||||
void destroy_asset_manager(AssetManager **am);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+33
-2
@@ -6,19 +6,50 @@
|
||||
#include "SDL_pixels.h"
|
||||
#include "reusable_ids.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // !__cplusplus
|
||||
|
||||
bool init_game(const char *game_name, int window_width, int window_height,
|
||||
SDL_Color window_background_color, bool full_screen);
|
||||
bool init_game(const char *game_name, uint32_t window_width,
|
||||
uint32_t window_height, SDL_Color window_background_color,
|
||||
bool full_screen, uint8_t audio_tracks);
|
||||
bool game_running();
|
||||
ObjectID add_object(void *object, EventHandlerPtr eh, UpdateFuncPtr uf,
|
||||
RenderFuncPtr rf);
|
||||
void remove_object(ObjectID *id);
|
||||
AssetID load_asset(const char *path, AssetType type);
|
||||
void render_texture_asset(AssetID id, float x, float y, float w, float h);
|
||||
int8_t play_audio_asset(AssetID id, int16_t loops, bool fade_in,
|
||||
uint32_t fade_length_in_ms);
|
||||
void pause_audio_asset_on_track(AssetID id, uint8_t track);
|
||||
void resume_audio_asset_on_track(AssetID id, uint8_t track);
|
||||
void stop_audio_asset_on_track(AssetID id, uint8_t track);
|
||||
void fade_out_audio_asset_on_track(AssetID id, uint8_t track,
|
||||
uint32_t fade_length_in_ms);
|
||||
void pause_all_instances_of_audio_asset(AssetID id);
|
||||
void resume_all_instances_of_audio_asset(AssetID id);
|
||||
void stop_all_instances_of_audio_asset(AssetID id);
|
||||
void fade_out_all_instances_of_audio_asset(AssetID id,
|
||||
uint32_t fade_length_in_ms);
|
||||
int8_t get_audio_asset_volume(AssetID id);
|
||||
void set_audio_asset_volume(AssetID id, int8_t volume);
|
||||
void play_music_asset(AssetID id, int16_t loops, bool fade_in,
|
||||
uint32_t fade_length_in_ms);
|
||||
void pause_music_asset(AssetID id);
|
||||
void resume_music_asset(AssetID id);
|
||||
void stop_music_asset(AssetID id);
|
||||
void fade_out_music_asset(AssetID id, uint32_t fade_length_in_ms);
|
||||
int8_t get_music_asset_volume(AssetID id);
|
||||
void set_music_asset_volume(AssetID id, int8_t volume);
|
||||
bool is_music_asset_playing(AssetID id);
|
||||
void pause_playing_music();
|
||||
void resume_playing_music();
|
||||
void stop_playing_music();
|
||||
void fade_out_playing_music(uint32_t fade_length_in_ms);
|
||||
void set_playing_music_volume(int8_t volume);
|
||||
bool is_music_playing();
|
||||
void close_asset(AssetID *id);
|
||||
void handle_events();
|
||||
void update();
|
||||
|
||||
@@ -23,7 +23,7 @@ void remove_object_from_store(ObjectStore *os, ObjectID *id_ptr);
|
||||
void handle_all_objects_events(ObjectStore *os, const SDL_Event *event);
|
||||
void update_all_objects(ObjectStore *os, float delta);
|
||||
void render_all_objects(ObjectStore *os);
|
||||
void destroy_object_store(ObjectStore *os);
|
||||
void destroy_object_store(ObjectStore **os);
|
||||
|
||||
#ifdef DEBUG_ENGINE
|
||||
void print_objects(ObjectStore *os);
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ void render_clear(const Renderer *renderer, SDL_Color color);
|
||||
void render_texture(const Renderer *renderer, SDL_Texture *texture, float x,
|
||||
float y, float w, float h);
|
||||
void swap_buffers(const Renderer *renderer);
|
||||
void destroy_renderer(Renderer *renderer);
|
||||
void destroy_renderer(Renderer **renderer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user