Gamedev Framework (gf)  0.10.0
A C++14 framework for 2D games
Static Public Attributes | List of all members
gf::Message Struct Reference

The base class for all messages. More...

#include <gf/Message.h>

Static Public Attributes

static const Id type = InvalidId
 The default (invalid) type. More...
 

Detailed Description

The base class for all messages.

gf::Message is the base class for all the messages that are sent to a message manager. A message must derive from this class and define a static unique type.

Here is an example for defining a new message type:

struct HeroPosition : public gf::Message {
static const Id type = "HeroPosition"_id; // compile-time definition
gf::Vector2f position;
};
See also
gf::MessageManager, gf::MessageHandler

Member Data Documentation

◆ type

const Id gf::Message::type = InvalidId
static

The default (invalid) type.

It must be redefined in child classes.