From 659d372a65ec56f1d66ed1465bb0e62801cf6d8c Mon Sep 17 00:00:00 2001 From: SrGesus <108523575+SrGesus@users.noreply.github.com> Date: Wed, 23 Oct 2024 00:28:36 +0100 Subject: [PATCH 1/3] fix(engine): move ImGui::End call to outside of if body --- engine/src/tools/play_pause/plugin.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engine/src/tools/play_pause/plugin.cpp b/engine/src/tools/play_pause/plugin.cpp index ee2eebfd78..2b1d478a3a 100644 --- a/engine/src/tools/play_pause/plugin.cpp +++ b/engine/src/tools/play_pause/plugin.cpp @@ -54,9 +54,8 @@ void cubos::engine::playPauseToolPlugin(Cubos& cubos) { state.scale = 1.0F; } - - ImGui::End(); } + ImGui::End(); if (!state.paused) { From 244e90d76685afe4a2a655d13ca35b24b6d75cc8 Mon Sep 17 00:00:00 2001 From: SrGesus <108523575+SrGesus@users.noreply.github.com> Date: Wed, 23 Oct 2024 13:36:14 +0100 Subject: [PATCH 2/3] docs: Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c002eef732..71638abcea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Crash in ecs when removing or destroying components with observers (#1348, **@SrGesus**) +- Crash when opening the Play Pause menu (**SrGesus**) ## [v0.4.0] - 2024-10-13 From 69c606df0afaf92423628daecaafd39b4aa90526 Mon Sep 17 00:00:00 2001 From: Diogo Miranda Date: Fri, 8 Nov 2024 14:10:26 +0000 Subject: [PATCH 3/3] feat(audio): Add Audio asset (#230) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: João Miguel Nogueira <101069446+Dageus@users.noreply.github.com> --- CHANGELOG.md | 2 + engine/CMakeLists.txt | 3 ++ engine/include/cubos/engine/audio/audio.hpp | 29 +++++++++++++++ engine/include/cubos/engine/audio/bridge.hpp | 36 ++++++++++++++++++ engine/src/audio/audio.cpp | 39 ++++++++++++++++++++ engine/src/audio/bridge.cpp | 26 +++++++++++++ 6 files changed, 135 insertions(+) create mode 100644 engine/include/cubos/engine/audio/audio.hpp create mode 100644 engine/include/cubos/engine/audio/bridge.hpp create mode 100644 engine/src/audio/audio.cpp create mode 100644 engine/src/audio/bridge.cpp diff --git a/CHANGELOG.md b/CHANGELOG.md index 71638abcea..541535be22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Allow identifying assets in code from their path (#1177. **@GalaxyCrush**). +- Added an Audio asset (#230, **@Dageus**, **@diogomsmiranda**). ### Fixed @@ -46,6 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Replaced OpenAL audio device with Miniaudio backend (#1005, **@Dageus**, **@diogomsmiranda**). ### Fixed + - Spot light angle mismatch between light and shadows (#1310, **@tomas7770**). - Spot shadows cause light range cutoff (#1312, **@tomas7770**). - Precision error in split screen size calculations (**@mkuritsu**). diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index e29913c7ee..13a420688d 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -36,6 +36,9 @@ set(CUBOS_ENGINE_SOURCE "src/utils/free_camera/plugin.cpp" "src/utils/free_camera/controller.cpp" + "src/audio/audio.cpp" + "src/audio/bridge.cpp" + "src/assets/plugin.cpp" "src/assets/assets.cpp" "src/assets/bridge.cpp" diff --git a/engine/include/cubos/engine/audio/audio.hpp b/engine/include/cubos/engine/audio/audio.hpp new file mode 100644 index 0000000000..85d6add166 --- /dev/null +++ b/engine/include/cubos/engine/audio/audio.hpp @@ -0,0 +1,29 @@ +/// @file +/// @brief Class @ref cubos::engine::Audio. +/// @ingroup audio-plugin + +#pragma once + +#include +#include +#include + +#include + +namespace cubos::engine +{ + /// @brief Asset containing raw Audio data. + /// + /// @ingroup audio-plugin + struct CUBOS_ENGINE_API Audio + { + CUBOS_REFLECT; + + /// @brief Audio buffer. + cubos::core::al::Buffer buffer; + + explicit Audio(const std::shared_ptr& context, core::memory::Stream& stream); + Audio(Audio&& other) noexcept; + ~Audio(); + }; +} // namespace cubos::engine diff --git a/engine/include/cubos/engine/audio/bridge.hpp b/engine/include/cubos/engine/audio/bridge.hpp new file mode 100644 index 0000000000..d7d8329106 --- /dev/null +++ b/engine/include/cubos/engine/audio/bridge.hpp @@ -0,0 +1,36 @@ +/// @file +/// @brief Class @ref cubos::engine::AudioBridge. +/// @ingroup audio-plugin + +#pragma once + +#include + +#include +#include + +namespace cubos::engine +{ + /// @brief Bridge which loads and saves @ref Audio assets. + /// + /// Uses the default supported file formats from miniaudio.h, which are WAV, FLAC, and MP3. + /// + /// @ingroup audio-plugin + class AudioBridge : public FileBridge + { + + std::shared_ptr mContext; + + public: + /// @brief Constructs a bridge. + AudioBridge(std::shared_ptr context) + : FileBridge(core::reflection::reflect