R-Type 0.1
Loading...
Searching...
No Matches
SoundRequest.hpp
1#pragma once
2
3#include <cstddef>
4#include <cstdint>
5#include <nlohmann/json.hpp>
6
7#include <Registry.hpp>
8
9namespace component {
19 size_t soundId;
20};
21
28inline void soundRequestFromJson(rtk::ecs::Registry &reg, std::size_t entity,
29 const nlohmann::json &data) {
30 component::SoundRequest soundRequest{};
31 soundRequest.soundId = data.value("soundId", static_cast<std::size_t>(0));
32
33 reg.get_components<component::SoundRequest>().insert_at(entity, soundRequest);
34}
35
37} // namespace component
void soundRequestFromJson(rtk::ecs::Registry &reg, std::size_t entity, const nlohmann::json &data)
Adds a SoundRequest to an entity from its blueprint data.
Definition SoundRequest.hpp:28
Request to play a sound loaded in the audio manager.
Definition SoundRequest.hpp:18
size_t soundId
Id returned by the audio manager when loading.
Definition SoundRequest.hpp:19