From ded4d6c35d86d6e9aac8e845c75a751b5b141428 Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 10 Aug 2016 22:52:29 +0200 Subject: [PATCH] SDK/ParticleGroupComponent: Add [Add|Remove]Emitter methods taking an entity The entity must have a ParticleEmitterComponent Former-commit-id: cc5fcde30bf8085b28aba18974854768f3ef5a46 [formerly 94cd3ac4099952d7186a49bf61b9fa1a9051484f] [formerly 8253250c28e3c890893072cf06ac032c55f95381 [formerly a2d435c184491dd50cd3fb2fd0174ee96a50321d]] Former-commit-id: 80dd6d0c2ea2f0229aacbf51cabd0067b5903b1f [formerly 42ca331d5712afca14f444f595fd14c2b3d3e1dd] Former-commit-id: 3c716c6d7ec3fb1e4ec5f4cf435c3fcc8a9dec8e --- .../NDK/Components/ParticleGroupComponent.hpp | 6 +++++ .../NDK/Components/ParticleGroupComponent.inl | 23 ++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/SDK/include/NDK/Components/ParticleGroupComponent.hpp b/SDK/include/NDK/Components/ParticleGroupComponent.hpp index 638f877d3..0dce5dd23 100644 --- a/SDK/include/NDK/Components/ParticleGroupComponent.hpp +++ b/SDK/include/NDK/Components/ParticleGroupComponent.hpp @@ -25,6 +25,12 @@ namespace Ndk ParticleGroupComponent(const ParticleGroupComponent&) = default; ~ParticleGroupComponent() = default; + void AddEmitter(Entity* emitter); + using ParticleGroup::AddEmitter; + + void RemoveEmitter(Entity* emitter); + using ParticleGroup::RemoveEmitter; + static ComponentIndex componentIndex; }; } diff --git a/SDK/include/NDK/Components/ParticleGroupComponent.inl b/SDK/include/NDK/Components/ParticleGroupComponent.inl index 7aefdad56..c6e0cba7b 100644 --- a/SDK/include/NDK/Components/ParticleGroupComponent.inl +++ b/SDK/include/NDK/Components/ParticleGroupComponent.inl @@ -1,8 +1,11 @@ -#include "ParticleGroupComponent.hpp" // Copyright (C) 2015 Jérôme Leclercq // This file is part of the "Nazara Development Kit" // For conditions of distribution and use, see copyright notice in Prerequesites.hpp +#include +#include +#include + namespace Ndk { inline ParticleGroupComponent::ParticleGroupComponent(unsigned int maxParticleCount, Nz::ParticleLayout layout) : @@ -14,4 +17,22 @@ namespace Ndk ParticleGroup(maxParticleCount, std::move(declaration)) { } + + inline void ParticleGroupComponent::AddEmitter(Entity* emitter) + { + NazaraAssert(emitter && emitter->IsValid(), "Invalid entity"); + NazaraAssert(emitter->HasComponent(), "Entity must have a NodeComponent"); + + auto& emitterComponent = emitter->GetComponent(); + ParticleGroup::AddEmitter(&emitterComponent); + } + + inline void ParticleGroupComponent::RemoveEmitter(Entity* emitter) + { + NazaraAssert(emitter && emitter->IsValid(), "Invalid entity"); + NazaraAssert(emitter->HasComponent(), "Entity must have a NodeComponent"); + + auto& emitterComponent = emitter->GetComponent(); + ParticleGroup::RemoveEmitter(&emitterComponent); + } }