adding event stuff to renderer to notify of new explosions
This commit is contained in:
parent
f49d07fdc5
commit
544282dd84
6 changed files with 85 additions and 12 deletions
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
#include "state/events/explosion_event.hpp"
|
||||
|
||||
namespace endofthejedi {
|
||||
void RendererPolygon3d::setup()
|
||||
{
|
||||
|
|
@ -250,6 +252,7 @@ namespace endofthejedi {
|
|||
|
||||
void RendererPolygon3d::advanceGraphicObjects(float dt)
|
||||
{
|
||||
#if 0
|
||||
for (const game::Explosion *expl : m_state->explosions) {
|
||||
bool gotIt = false;
|
||||
for (ParticleBatch *batch : m_particles) {
|
||||
|
|
@ -267,6 +270,24 @@ namespace endofthejedi {
|
|||
1000, 1.0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for (game::StateUpdateEvent *evt : m_state->currentStateUpdateEvents()) {
|
||||
if (evt->eventType() == game::StateUpdateEvent::EventType::Explosion) {
|
||||
auto cycle = evt->lifeCycle();
|
||||
if (cycle == game::StateUpdateEvent::LifeCycle::Create) {
|
||||
game::ExplosionEvent *ee = static_cast<game::ExplosionEvent*>(evt);
|
||||
const game::Explosion *expl = ee->explosion;
|
||||
addExplosionEffect(
|
||||
expl->id, expl->position,
|
||||
expl->missileVelocity,
|
||||
(expl->hit == game::Hit::Planet),
|
||||
1000, 1.0);
|
||||
|
||||
std::cout<<"adding [graphic] explosion for #" << expl->id << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if (m_particles.size() == 0) {
|
||||
// addExplosionEffect(0, glm::vec2(0.0, 0.0), glm::vec2(0.0, 0.0), false, 10000, 2.0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue