* merged
This commit is contained in:
commit
1bd752e628
4 changed files with 53 additions and 12 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,17 +1,32 @@
|
|||
#pragma once
|
||||
|
||||
#if 0
|
||||
#include <glm/vec2.hpp>
|
||||
|
||||
namespace game {
|
||||
/**
|
||||
* Explosion: just an effect which looks good.
|
||||
*/
|
||||
class Explosion {
|
||||
public:
|
||||
enum class Kind {
|
||||
Normal,
|
||||
MissileWithShip
|
||||
MissileExplodesInSpace, // missile explode in free space
|
||||
MissileAgainstPlanet, // explosion of missile when it hits a planet
|
||||
MissileAgainstShip // bigger explosion: missile hits a ship which explodes with it
|
||||
};
|
||||
|
||||
glm::vec2 position;
|
||||
Explosion(const glm::vec2 &pos, Kind kind, float maxAge=1.0)
|
||||
: position(pos), kind(kind), age(0.0), maxAge(maxAge)
|
||||
{
|
||||
}
|
||||
|
||||
Explosion(Kind kind);
|
||||
const Kind kind; // kind of the explosion
|
||||
const glm::vec2 position; // position where it starts
|
||||
float age; // age (in seconsd) of the explosion
|
||||
|
||||
public:
|
||||
// age (in seconds) when the explosion is not visible
|
||||
// anymore and will disappear afterwards
|
||||
const float maxAge;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
0
game/state/trace.cpp
Normal file
0
game/state/trace.cpp
Normal file
24
game/state/trace.hpp
Normal file
24
game/state/trace.hpp
Normal file
|
@ -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