partially done work on total source tree rework, separation of engine context and game context, generalization of renderer for different backends as well as web platform target

This commit is contained in:
2024-09-16 09:07:01 +03:00
parent ca0305feab
commit 551d60ef85
59 changed files with 2892 additions and 890 deletions

38
include/twn_audio.h Normal file
View File

@ -0,0 +1,38 @@
#ifndef TWN_AUDIO_H
#define TWN_AUDIO_H
#include "twn_engine_api.h"
#include <stdbool.h>
typedef struct play_audio_args {
/* default: false */
bool repeat;
/* crossfade between already playing audio on a given channel, if any */
/* default: false */
bool crossfade;
/* range: 0.0f to 1.0f */
/* default: 1.0f */
float volume;
/* range: -1.0 to 1.0f */
/* default: 0.0f */
float panning;
} t_play_audio_args;
/* plays audio file at specified channel or anywhere if NULL is passed */
/* path must contain valid file extension to infer which file format it is */
/* supported formats: .ogg, .xm */
/* preserves args that are already specified on the channel */
TWN_API void play_audio(const char *path, const char *channel);
TWN_API void play_audio_ex(const char *path, const char *channel, t_play_audio_args args);
/* could be used for modifying args */
/* warn: is only valid if no other calls to audio are made */
TWN_API t_play_audio_args *get_audio_args(const char *channel);
TWN_API t_play_audio_args get_default_audio_args(void);
#endif