diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-10 19:22:14 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-10 19:22:14 +0100 |
commit | 1e5c6c5cf0d1be976e0e59099ddcfc62940ef1be (patch) | |
tree | 8878a7021fcaecdb5244e6940a442199f499347d /src/crepe/system/AudioSystem.h | |
parent | 467ca584b359f6e504800222e16025d345fdff2a (diff) | |
parent | 7cbc577e94ed048f2a8146fab6972ae6ff290be7 (diff) |
merge master
Diffstat (limited to 'src/crepe/system/AudioSystem.h')
-rw-r--r-- | src/crepe/system/AudioSystem.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/crepe/system/AudioSystem.h b/src/crepe/system/AudioSystem.h new file mode 100644 index 0000000..2ddc443 --- /dev/null +++ b/src/crepe/system/AudioSystem.h @@ -0,0 +1,51 @@ +#pragma once + +#include "../api/AudioSource.h" +#include "../facade/Sound.h" +#include "../facade/SoundContext.h" + +#include "System.h" + +namespace crepe { + +class AudioSystem : public System { +public: + using System::System; + void update() override; + +private: + /** + * \brief Update `last_*` members of \c component + * + * Copies all component properties stored for comparison between AudioSystem::update() calls + * + * \param component AudioSource component to update + */ + void update_last(AudioSource & component); + + /** + * \brief Compare update component + * + * Compares properties of \c component and \c data, and calls SoundContext functions where + * applicable. + * + * \param component AudioSource component to update + * \param resource Sound instance for AudioSource's Asset + */ + void diff_update(AudioSource & component, Sound & resource); + +protected: + /** + * \brief Get SoundContext + * + * SoundContext is retrieved through this function instead of being a direct member of + * AudioSystem to aid with testability. + */ + virtual SoundContext & get_context(); + +private: + //! SoundContext + std::unique_ptr<SoundContext> context = nullptr; +}; + +} // namespace crepe |