Dragonfly  4.3
A text-based game engine
Public Member Functions | Private Attributes | List of all members
df::ViewObject Class Reference
Inheritance diagram for df::ViewObject:
Inheritance graph
[legend]
Collaboration diagram for df::ViewObject:
Collaboration graph
[legend]

Public Member Functions

 ViewObject ()
 
virtual void draw ()
 
virtual int eventHandler (const Event *p_e)
 
void setLocation (ViewObjectLocation new_location)
 
ViewObjectLocation getLocation () const
 
void setDrawValue (bool new_draw_value=true)
 
bool getDrawValue () const
 
void setValue (int new_value)
 
int getValue () const
 
void setBorder (bool new_border)
 
bool getBorder () const
 
void setColor (Color new_color)
 
Color getColor () const
 
void setViewString (std::string new_view_string)
 
std::string getViewString () const
 
void setPosition (Vector new_pos)
 
virtual std::string serialize (bool all=false)
 
virtual int deserialize (std::string s)
 
virtual bool isModified (enum ViewObjectAttribute attribute) const
 
virtual bool isModified () const
 
- Public Member Functions inherited from df::Object
 Object ()
 
virtual ~Object ()
 
void setId (int new_id)
 
int getId () const
 
void setType (std::string new_type)
 
std::string getType () const
 
Vector getPosition () const
 
bool isSolid () const
 
int setSolidness (Solidness new_solid)
 
Solidness getSolidness () const
 
void setNoSoft (bool new_no_soft=true)
 
bool getNoSoft () const
 
void setAvoidCollisions (bool new_avoid_collisions=true)
 
bool getAvoidCollisions () const
 
int setAltitude (int new_altitude)
 
int getAltitude () const
 
void setSpeed (float speed)
 
float getSpeed () const
 
void setDirection (Vector new_direction)
 
Vector getDirection () const
 
void setVelocity (Vector velocity)
 
Vector getVelocity () const
 
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 position)
 
void doPathFollowing ()
 
int setVisible (bool visible=true)
 
bool isVisible () const
 
int setActive (bool active=true)
 
bool isActive () const
 
void setBox (Box new_box)
 
Box getBox () const
 
int registerInterest (std::string event_type)
 
int unregisterInterest (std::string event_type)
 
void setSpriteName (std::string new_name)
 
std::string getSpriteName () const
 
void setSprite (Sprite *p_new_sprite, bool set_box=true)
 
SpritegetSprite () const
 
void setCentered (bool centered=true)
 
bool isCentered () const
 
void setTransparency (char transparent=' ')
 
char getTransparency () const
 
void setSpriteIndex (int new_sprite_index)
 
int getSpriteIndex () const
 
void setSpriteSlowdown (int new_sprite_slowdown)
 
int getSpriteSlowdown () const
 
void setSpriteSlowdownCount (int new_sprite_slowdown_count)
 
int getSpriteSlowdownCount () const
 
virtual bool isModified (enum ObjectAttribute attribute) const
 
void setShape (Shape new_shape)
 
Shape getShape () const
 
void setFollowPath (bool new_follow_path=true)
 
bool getFollowPath () const
 
void setPath (Path new_path)
 
Path getPath () const
 
PathFindgetPathFind ()
 

Private Attributes

std::string m_view_string
 
int m_value
 
bool m_draw_value
 
bool m_border
 
Color m_color
 
ViewObjectLocation m_location
 
bool m_vmodified [VATTR_COUNT]
 

Constructor & Destructor Documentation

df::ViewObject::ViewObject ( )

Construct ViewObject.

Object settings: SPECTRAL, max altitude. ViewObject defaults: border, top_center, default color, draw_value.

Member Function Documentation

virtual int df::ViewObject::deserialize ( std::string  s)
virtual

Deserialize string to become attributes.

Rerturn 0 if no errors, else -1.

Reimplemented from df::Object.

Reimplemented in df::TextEntry, and df::Button.

virtual void df::ViewObject::draw ( )
virtual

Draw view string (and value).

Reimplemented from df::Object.

Reimplemented in df::TextEntry.

virtual int df::ViewObject::eventHandler ( const Event p_e)
virtual

Handle "view" event if tag matches view_string (others ignored).

Return 0 if ignored, else 1.

Reimplemented from df::Object.

Reimplemented in df::TextEntry, df::Fraps, and df::Button.

bool df::ViewObject::getBorder ( ) const

Get view border (true = display border).

Color df::ViewObject::getColor ( ) const

Get view color.

bool df::ViewObject::getDrawValue ( ) const

Get draw value (true if draw value with display string).

ViewObjectLocation df::ViewObject::getLocation ( ) const

Get general location of ViewObject on screen.

int df::ViewObject::getValue ( ) const

Get view value.

std::string df::ViewObject::getViewString ( ) const

Get view display string.

virtual bool df::ViewObject::isModified ( enum ViewObjectAttribute  attribute) const
virtual

Return true if attribute modified since last serialize.

virtual bool df::ViewObject::isModified ( ) const
virtual

Return true if any attribute modified since last serialize.

Reimplemented from df::Object.

Reimplemented in df::TextEntry, and df::Button.

virtual std::string df::ViewObject::serialize ( bool  all = false)
virtual

Serialize ViewObject attributes to single string.

Only modified attributes (unless all is true).

Reimplemented from df::Object.

Reimplemented in df::TextEntry, and df::Button.

void df::ViewObject::setBorder ( bool  new_border)

Set view border (true = display border).

void df::ViewObject::setColor ( Color  new_color)

Set view color.

void df::ViewObject::setDrawValue ( bool  new_draw_value = true)

Set true to draw value with display string.

void df::ViewObject::setLocation ( ViewObjectLocation  new_location)

Set general location of ViewObject on screen.

void df::ViewObject::setPosition ( Vector  new_pos)
virtual

Set position of ViewObject, with setting "location" to UNDEFINED.

Reimplemented from df::Object.

void df::ViewObject::setValue ( int  new_value)

Set view value.

void df::ViewObject::setViewString ( std::string  new_view_string)

Set view display string.

Member Data Documentation

bool df::ViewObject::m_border
private

True if border around display.

Color df::ViewObject::m_color
private

Color for text (and border).

bool df::ViewObject::m_draw_value
private

True if should draw value.

ViewObjectLocation df::ViewObject::m_location
private

Location of ViewObject.

int df::ViewObject::m_value
private

Value displayed (e.g., points).

std::string df::ViewObject::m_view_string
private

Label for value (e.g., "Points").

bool df::ViewObject::m_vmodified[VATTR_COUNT]
private

Mod. attrib. since serialize().