枚举类型
比如,做事件触发系统。一般会用枚举类型,定义事件:
enum {
EventRoleLevelUp = 1, // 玩家等级升级事件
EventTaskComplete = 2, // 任务完成事件
};
在看 https://github.com/alecthomas/entityx 代码时,发现一种更为优雅的定义方式
entityx 中的 event 类型例子
/// Used internally by the EventManager.
class BaseEvent {
public:
typedef std::size_t Family;
virtual ~BaseEvent()

最低0.47元/天 解锁文章
81

被折叠的 条评论
为什么被折叠?



