Gamedev Framework (gf)  0.4.0
A C++11 framework for 2D games
Classes | Typedefs | Enumerations
Game classes

All the classes related to game systems and game entities. More...

Classes

class  gf::AssetManager
 An asset manager. More...
 
struct  gf::Penetration
 Data about the collision between two objects. More...
 
class  gf::Entity
 A game entity. More...
 
class  gf::EntityContainer
 A collection of entities. More...
 
struct  gf::Message
 The base class for all messages. More...
 
class  gf::MessageManager
 A message manager. More...
 
class  gf::Model
 A game object that can be updated. More...
 
class  gf::ModelContainer
 A collection of models. More...
 
class  gf::PhysicsBody
 A physics body. More...
 
class  gf::PhysicsGeometry
 The geometry of a physics body. More...
 
class  gf::PhysicsModel
 A model for physics simulation. More...
 
class  gf::ResourceCache< T >
 A generic cache for resources. More...
 
class  gf::ResourceManager
 A resource manager. More...
 
class  gf::TextureAtlas
 A collection of sub-texture. More...
 

Typedefs

using gf::MessageHandler = std::function< MessageStatus(Id, Message *)>
 A message handler. More...
 
using gf::MessageHandlerId = uint64_t
 An identifier for a message handler. More...
 

Enumerations

enum  gf::MessageStatus {
  gf::MessageStatus::Keep,
  gf::MessageStatus::Die
}
 A message status. More...
 
enum  gf::PhysicsBody::Type {
  gf::PhysicsBody::Static,
  gf::PhysicsBody::Dynamic
}
 Type of body. More...
 
enum  gf::PhysicsGeometry::Type {
  gf::PhysicsGeometry::Type::Circle,
  gf::PhysicsGeometry::Type::Polygon
}
 The type of geometry. More...
 

Detailed Description

All the classes related to game systems and game entities.

Typedef Documentation

using gf::MessageHandler = typedef std::function<MessageStatus(Id, Message *)>

A message handler.

gf::MessageHandler is a function that can be called when a message is sent in a message handler. It can be a free function:

gf::MessageStatus onHeroPosition(gf::Id type, gf::Message *msg) {
assert(type == HeroPosition::type);
auto heroPosition = static_cast<HeroPosition*>(msg);
// do something with heroPosition->position ...
}
// ...
gf::MessageHandler handler = onHeroPosition;

It can also be a member function (which is, in fact, the most probable use case).

struct Foo {
gf::MessageStatus onHeroPosition(gf::Id type, gf::Message *msg) {
assert(type == HeroPosition::type);
auto heroPosition = static_cast<HeroPosition*>(msg);
// do something with heroPosition->position ...
}
};
// ...
Foo foo;
gf::MessageHandler handler = std::bind(&Foo::onHeroPosition, &foo);
See also
gf::MessageManager, gf::Message, gf::Id
using gf::MessageHandlerId = typedef uint64_t

An identifier for a message handler.

See also
gf::MessageHandler

Enumeration Type Documentation

enum gf::MessageStatus
strong

A message status.

gf::MessageStatus indicates if a handler should be kept by the message manager or can be removed so that it will not receive any more messages.

See also
gf::MessageManager, gf::MessageHandler
Enumerator
Keep 

The handler must be kept

Die 

The handler can be removed

Type of body.

Enumerator
Static 

Static body with infinite mass.

Dynamic 

Dynamic bodies with finite mass.

The type of geometry.

Enumerator
Circle 

A circle (see gf::CircleGeometry)

Polygon 

A polygon (see gf::PolygonGeometry)