implementing trace class.
This commit is contained in:
parent
56ccdfb1fd
commit
64428d2068
3 changed files with 53 additions and 23 deletions
|
@ -15,6 +15,8 @@ set(GAME_SRC
|
|||
util.cpp
|
||||
game.cpp
|
||||
state/object.cpp
|
||||
state/explosion.cpp
|
||||
state/trace.cpp
|
||||
state/state.cpp
|
||||
state/player.cpp
|
||||
state/planet.cpp
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <glm/vec2.hpp>
|
||||
|
||||
namespace game {
|
||||
/**
|
||||
* Explosion: just an effect which looks good.
|
||||
*/
|
||||
|
@ -24,5 +27,6 @@ public:
|
|||
// anymore and will disappear afterwards
|
||||
const float maxAge;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
#pragma once
|
||||
|
||||
#include <glm/vec2.hpp>
|
||||
|
||||
namespace game {
|
||||
/*
|
||||
* Trace of a missile through the space.
|
||||
* Useful for rendering sth. like a smoke trail to follow the rocket.
|
||||
*/
|
||||
class Trace {
|
||||
public:
|
||||
Trace(const glm::vec2 &startPoint)
|
||||
{
|
||||
points.push_back(startPoint);
|
||||
}
|
||||
|
||||
void addPoint(const glm::vec2 &p)
|
||||
{
|
||||
points.push_back(p);
|
||||
}
|
||||
|
||||
std::vector<glm::vec2> points;
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue