You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

36 lines
678 B

#ifndef COMMAND_H
#define COMMAND_H
#include <functional>
namespace Category
{
enum Type
{
None = 0,
Scene = 1 << 0,
Player = 1 << 1,
Enemy = 1 << 2
};
}
class SceneNode;
namespace sf { class Time; }
struct Command
{
std::function<void(SceneNode&, sf::Time)> action;
Category::Type category;
};
template<typename GameObject, typename Functon>
std::function<void(SceneNode&, const sf::Time&)> derivedAction(Functon func)
{
return [=] (SceneNode& node, const sf::Time& time)
{
//assert(dynamic_cast<GameObject*>(&node));
func(static_cast<GameObject&>(node), time);
};
}
#endif // COMMAND_H