GameObject

A default implementation of the IGameObject interface.  GameObject provides a default class for handling all of the functionality needed in a game object.  Most objects in the game should derive from it.  It fulfills all of the requirements of the IGameObject interface.

Derived From

IGameObject

Project

ModelCore

Include

GameObject.h

Summary
A default implementation of the IGameObject interface.
The GameObject constructor.
Resets the display flags.
Reports if a specific display flag is set.
Reports if a custom display flag is set.
Turns a specific display flag on.
Turns a custom display flag on.
Provides the ID of the object.
Sets the ID of the object.
Provides the coordinates of the object.
Sets the coordinates of the object.
Provides the rotation of the object.
Sets the rotation of the object.
Provides the color of the object.
Sets the color of the object.
Loads a GameObject from an input stream.
Writes a GameObject to an output stream.
The object display flags.
The object ID.
The coordinates in world space.
The local rotation of the object.

Public

Summary
The GameObject constructor.
Resets the display flags.
Reports if a specific display flag is set.
Reports if a custom display flag is set.
Turns a specific display flag on.
Turns a custom display flag on.
Provides the ID of the object.
Sets the ID of the object.
Provides the coordinates of the object.
Sets the coordinates of the object.
Provides the rotation of the object.
Sets the rotation of the object.
Provides the color of the object.
Sets the color of the object.
Loads a GameObject from an input stream.
Writes a GameObject to an output stream.

Constructor

GameObject

GameObject()

The GameObject constructor.  Initializes all values to 0 or their equivalent.

Virtual Functions

reset

virtual void reset()

Resets the display flags.

isset

virtual bool isset(const ObjectFlag flag) const

Reports if a specific display flag is set.

Parameters

flagThe display flag being checked.

Returns

A boolean value saying whether the flag is set.  The value is true if the flag is set.

isset

virtual bool isset(const wxInt32 flag) const

Reports if a custom display flag is set.

Returns

A boolean value saying whether the flag is set.  The value is true if the flag is set.

set

virtual void set(const ObjectFlag flag)

Turns a specific display flag on.

Parameters

flagThe display flag to turn on.

set

virtual void set(const wxInt32 flag)

Turns a custom display flag on.

Parameters

flagThe display flag to turn on.

id

virtual wxInt32 id() const

Provides the ID of the object.

Returns

The ID of the object.

id

virtual void id(const wxInt32 id)

Sets the ID of the object.

Parameters

idThe new ID.

coords

virtual const Vector &coords() const

Provides the coordinates of the object.

Returns

The coordinates of the object.

coords

virtual void coords(const Vector &val)

Sets the coordinates of the object.

Parameters

coordsThe new coordinates.

rotation

virtual float rotation() const

Provides the rotation of the object.

Returns

The rotation of the object.

rotation

virtual void rotation(const float val)

Sets the rotation of the object.

Parameters

valThe new rotation.

color

virtual ColorType color() const

Provides the color of the object.  Not implemented in this class, but provided with a non-sensical return value so that the requirements of IGameObject are satisfied.  Derived classes can override this function if they require color settings.

Returns

A non-sensical color value.

color

virtual void color(const ColorType color)

Sets the color of the object.  Not implemented in this class, but provided so that the requirements of IGameObject are satisfied.  Derived classes can override this function if they require color settings.

Parameters

colorThe new color.

load

void load(wxDataInputStream &stream)

Loads a GameObject from an input stream.

Parameters

streamThe input stream.

save

void save(wxDataOutputStream &stream) const

Writes a GameObject to an output stream.

Parameters

streamThe output stream.

Protected

Summary
The object display flags.
The object ID.
The coordinates in world space.
The local rotation of the object.

Variables

mDisplayFlags

wxInt32 mDisplayFlags

The object display flags.

mID

wxInt32 mID

The object ID.

mCoords

Vector mCoords

The coordinates in world space.

mRotation

float mRotation

The local rotation of the object.

An interface for all game objects.
GameObject()
The GameObject constructor.
virtual void reset()
Resets the display flags.
virtual bool isset(const ObjectFlag flag) const
Reports if a specific display flag is set.
virtual void set(const ObjectFlag flag)
Turns a specific display flag on.
virtual wxInt32 id() const
Provides the ID of the object.
virtual const Vector &coords() const
Provides the coordinates of the object.
virtual float rotation() const
Provides the rotation of the object.
virtual ColorType color() const
Provides the color of the object.
void load(wxDataInputStream &stream)
Loads a GameObject from an input stream.
void save(wxDataOutputStream &stream) const
Writes a GameObject to an output stream.
wxInt32 mDisplayFlags
The object display flags.
wxInt32 mID
The object ID.
Vector mCoords
The coordinates in world space.
float mRotation
The local rotation of the object.
ModelCore provides all of the data classes and associated helper classes and functions required to represent a complete game.