Dragonfly 4.20
A text-based game engine
|
Public Member Functions | |
Object () | |
virtual | ~Object () |
void | setId (int new_id) |
int | getId () const |
virtual void | setType (std::string new_type) |
std::string | getType () const |
virtual int | setPosition (Vector new_position) |
Vector | getPosition () const |
virtual int | eventHandler (const Event *p_event) |
bool | isSolid () const |
virtual int | setSolidness (Solidness new_solid) |
Solidness | getSolidness () const |
void | setNoSoft (bool new_no_soft=true) |
bool | getNoSoft () const |
virtual void | setAvoidCollisions (bool new_avoid_collisions=true) |
bool | getAvoidCollisions () const |
virtual int | setAltitude (int new_altitude) |
int | getAltitude () const |
void | setSpeed (float speed) |
float | getSpeed () const |
virtual void | setDirection (Vector new_direction) |
Vector | getDirection () const |
virtual void | setVelocity (Vector velocity) |
Vector | getVelocity () const |
virtual void | setAcceleration (Vector new_acceleration) |
Vector | getAcceleration () const |
void | accelerate () |
Vector | predictPosition () |
void | pathTo (Vector position) |
void | pathTo (Object *p_o_target) |
void | moveTo (Vector new_position) |
void | doPathFollowing () |
int | setVisible (bool new_visible=true) |
virtual bool | isVisible () const |
virtual int | setActive (bool new_active=true) |
bool | isActive () const |
virtual void | setBox (Box new_box) |
Box | getBox () const |
int | registerInterest (std::string event_type) |
int | unregisterInterest (std::string event_type) |
int | getEventCount () const |
virtual int | setSprite (std::string sprite_label) |
virtual void | setAnimation (Animation new_animation, bool set_box=true) |
Animation | getAnimation () const |
virtual int | draw () |
virtual int | serialize (std::stringstream *p_ss, unsigned int attr=0) |
virtual int | deserialize (std::stringstream *p_ss, unsigned int *p_a=NULL) |
bool | isModified (enum ObjectAttribute attribute) const |
bool | isModified () const |
virtual void | setModified (unsigned int new_modified) |
virtual unsigned int | getModified () const |
virtual void | setShape (Shape new_shape) |
Shape | getShape () const |
virtual void | setFollowPath (bool new_follow_path=true) |
bool | getFollowPath () const |
void | setPath (Path new_path) |
Path | getPath () const |
PathFind * | getPathFind () |
std::string | toString () const |
bool | operator== (const Object &o) |
bool | operator!= (const Object &o) |
Static Public Attributes | |
static int | max_id |
Private Attributes | |
int | m_id |
std::string | m_type |
bool | m_is_active |
bool | m_is_visible |
Box | m_box |
Vector | m_position |
Vector | m_direction |
float | m_speed |
Vector | m_acceleration |
int | m_altitude |
Solidness | m_solidness |
Animation | m_animation |
bool | m_no_soft |
int | m_event_count |
std::string | m_event_name [MAX_OBJ_EVENTS] |
unsigned int | m_modified |
Shape | m_shape |
PathFind * | m_p_path_find |
Path | m_path |
bool | m_follow_path |
bool | m_avoid_collisions |
df::Object::Object | ( | ) |
Construct Object.
Set default parameters and add to game world (WorldManager).
|
virtual |
Destroy Object.
Unregister for any interested events. Remove from game world (WorldManager).
void df::Object::accelerate | ( | ) |
|
virtual |
Deserialize stream to attributes and apply.
p_ss - incoming stream to deserialize. p_a - outgoing bitmask of attributes modified (NULL means no outgoing). Return 0 if ok, else -1.
Reimplemented in df::Particle, df::Button, df::TextBox, df::TextEntry, and df::ViewObject.
void df::Object::doPathFollowing | ( | ) |
If following a path, update path progress.
|
virtual |
Draw Object: Animation and/or Shape.
Return 0 if ok, else -1.
Reimplemented in df::Debris, df::TextBox, df::TextEntry, and df::ViewObject.
|
virtual |
Handle event (default only handles pathfinding).
Return 0 if ignored, else 1.
Reimplemented in df::Fader, df::Button, df::Firework, df::Fraps, df::NetworkNode, df::Particle, df::Pause, df::Precipitation, df::Splash, df::SplashDragonfly, df::TextEntry, and df::ViewObject.
int df::Object::getAltitude | ( | ) | const |
Return altitude of Object.
bool df::Object::getAvoidCollisions | ( | ) | const |
Get "avoid collisions" (true - avoid collisions with HARD when moving).
int df::Object::getEventCount | ( | ) | const |
Get registered interest event count.
bool df::Object::getFollowPath | ( | ) | const |
Returns true if following a path (note: is set in pathTo() method).
int df::Object::getId | ( | ) | const |
Get Object id.
|
virtual |
Return modified attribute mask.
bool df::Object::getNoSoft | ( | ) | const |
Get "no soft" setting of Object (true - cannot move onto SOFT Objects).
PathFind * df::Object::getPathFind | ( | ) |
Get object doing pathfinding.
Shape df::Object::getShape | ( | ) | const |
Get drawing shape.
float df::Object::getSpeed | ( | ) | const |
Get speed of Object.
std::string df::Object::getType | ( | ) | const |
Get type identifier of Object.
bool df::Object::isActive | ( | ) | const |
Return activeness of Object.
Objects not active are not acted upon by engine.
bool df::Object::isModified | ( | ) | const |
Return true if any attribute modified since last serialize.
bool df::Object::isModified | ( | enum ObjectAttribute | attribute | ) | const |
Return true if attribute modified since last serialize.
bool df::Object::isSolid | ( | ) | const |
Return True if Object is HARD or SOFT, else false.
|
virtual |
Return visibility of Object. Objects not visible are not drawn.
void df::Object::moveTo | ( | Vector | new_position | ) |
Set direction of Object towards position.
(Called when pathfinding).
bool df::Object::operator== | ( | const Object & | o | ) |
Compare two Objects.
void df::Object::pathTo | ( | Object * | p_o_target | ) |
void df::Object::pathTo | ( | Vector | position | ) |
Navigate Object from current position to target position using pathfinding.
Turns on avoid collisions.
Vector df::Object::predictPosition | ( | ) |
Predict Object position based on speed and direction.
Return predicted position.
int df::Object::registerInterest | ( | std::string | event_type | ) |
Register for interest in event.
Keeps track of manager and event.
Return 0 if ok, else -1.
|
virtual |
Serialize attributes to stream.
Can specify individual attribute(s) to force (modified or not). Default is only modified attributes. Clears modified bits for attributes serialized. Return 0 if ok, else -1.
Reimplemented in df::Button, df::Particle, df::TextBox, df::TextEntry, and df::ViewObject.
|
virtual |
Set acceleration of Object.
|
virtual |
Set activeness of Object.
Objects not active are not acted upon by engine. Return 0 if ok, else -1.
|
virtual |
Set altitude of Object, with checks for range [0, MAX_ALTITUDE].
Return 0 if ok, else -1.
|
virtual |
|
virtual |
Set "avoid collisions" (true - avoid collisions with HARD when moving).
|
virtual |
Set follow_path (note: is also set in pathTo() method).
If path defined, start moving to first node.
void df::Object::setId | ( | int | new_id | ) |
Set Object id.
|
virtual |
Set modified attribute mask.
void df::Object::setNoSoft | ( | bool | new_no_soft = true | ) |
Set "no soft" setting of Object (true - cannot move onto SOFT Objects).
|
virtual |
|
virtual |
Set drawing shape.
|
virtual |
Set solidness of Object, with checks for consistency.
Return 0 if ok, else -1.
void df::Object::setSpeed | ( | float | speed | ) |
Set speed of Object.
|
virtual |
|
virtual |
Set type identifier of Object.
int df::Object::setVisible | ( | bool | new_visible = true | ) |
Set visibility of Object.
Objects not visible are not drawn. Return 0 if ok, else -1.
std::string df::Object::toString | ( | ) | const |
Return base attributes as string.
int df::Object::unregisterInterest | ( | std::string | event_type | ) |
Unregister for interest in event.
Return 0 if ok, else -1.
|
private |
Acceleration vector.
|
private |
0 to MAX_ALTITUDE (higher drawn on top).
|
private |
True if should avoid collisions with HARD.
|
private |
Direction vector.
|
private |
Number of events of interest.
|
private |
Names of events interested in.
|
private |
True if following path.
|
private |
Unique game engine defined identifier.
|
private |
If false, Object not acted upon.
|
private |
If true, Object gets drawn.
|
private |
Mod. attributes mask since last serialize().
|
private |
True if won't move on SOFT Objects.
|
private |
If following path, holds path information.
|
private |
Position in game world.
|
private |
Basic geometric shape to draw.
|
private |
Object speed in direction.
|
private |
Game programmer defined type.
|
static |
Monotonically increasing identifier.