diff --git a/src/GameWorld.cpp b/src/GameWorld.cpp index 7a5a543..371dd2e 100755 --- a/src/GameWorld.cpp +++ b/src/GameWorld.cpp @@ -98,7 +98,7 @@ void GameWorld::AddSystems() //AddSystem("LevelGenerationSystem"); AddSystem("InputSystem"); //AddSystem("CollisionSystem"); - ////AddSystem("ParticleSystem"); + //AddSystem("ParticleSystem"); //AddSystem("PlayerSystem"); AddSystem("FreeSteeringSystem"); AddSystem("SoundSystem"); diff --git a/src/Systems/ParticleSystem.cpp b/src/Systems/ParticleSystem.cpp new file mode 100644 index 0000000..3df99a0 --- /dev/null +++ b/src/Systems/ParticleSystem.cpp @@ -0,0 +1,47 @@ +#include "ParticleSystem.h" +#include "PrecompiledHeader.h" + +#include "World.h" +void Systems::ParticleSystem::Update(double dt) +{ + +} + +void Systems::ParticleSystem::UpdateEntity(double dt, EntityID entity, EntityID parent) +{ + auto transformComponent = m_World->GetComponent(entity, "Transform"); + if(!transformComponent) + return; + + transformComponent->Position.y --; + + timeLived[entity] += dt; + + auto emitterComponent = m_World->GetComponent(entity, "ParticleEmitter"); + + + +} + +void Systems::ParticleSystem::RegisterComponents(ComponentFactory* cf) +{ + cf->Register("ParticleEmitter", []() { return new Components::ParticleEmitter(); }); +} + +void Systems::ParticleSystem::SpawnParticles() +{ + for(int i = 0; i < 100; i++) + { + auto particle = m_World->CreateEntity(); + auto transform = m_World->AddComponent(particle, "Transform"); + transform->Position = glm::vec3(0); + particles.push_back(particle); + } +} + +void Systems::ParticleSystem::Draw(double dt) +{ + +} + + diff --git a/src/Systems/ParticleSystem.h b/src/Systems/ParticleSystem.h new file mode 100644 index 0000000..4211d89 --- /dev/null +++ b/src/Systems/ParticleSystem.h @@ -0,0 +1,33 @@ +#ifndef ParticleSystem_h__ +#define ParticleSystem_h__ + +#include "System.h" +#include "Components/Transform.h" +#include "Components/ParticleEmitter.h" + + +namespace Systems +{ + + +class ParticleSystem : public System +{ +public: + ParticleSystem(World* world); + void RegisterComponents(ComponentFactory* cf) override; + + void Update(double dt) override; + void UpdateEntity(double dt, EntityID entity, EntityID parent) override; + +private: + void SpawnParticles(); + + + +}; + + +} + + +#endif // ParticleSystem_h__ \ No newline at end of file diff --git a/vs11/Returngeance/Returngeance.vcxproj b/vs11/Returngeance/Returngeance.vcxproj index 4726981..40cd9be 100755 --- a/vs11/Returngeance/Returngeance.vcxproj +++ b/vs11/Returngeance/Returngeance.vcxproj @@ -109,6 +109,7 @@ + @@ -151,6 +152,7 @@ + diff --git a/vs11/Returngeance/Returngeance.vcxproj.filters b/vs11/Returngeance/Returngeance.vcxproj.filters index 26bcf35..185a9c4 100755 --- a/vs11/Returngeance/Returngeance.vcxproj.filters +++ b/vs11/Returngeance/Returngeance.vcxproj.filters @@ -50,6 +50,9 @@ + + Particle System\Systems + @@ -157,36 +160,6 @@ Rendering - - Physics\Components - - - Physics\Components - - - Physics\Components - - - Physics\Components - - - Physics\Components - - - Physics\Components - - - Physics\Components - - - Physics\Components - - - Physics\Components - - - Physics\Components - Physics\Components @@ -242,6 +215,11 @@ Audio + + + + Particle System\Systems +