Quad Pang
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions
Quad_impl Class Reference

Common implementation of Quad interface. More...

#include <Quad.h>

Inheritance diagram for Quad_impl:
Quad Quad Arrow Arrow Ball Ball Bongo Bongo Box Box Hitti Hitti

List of all members.

Public Member Functions

 Quad_impl (const Quad_impl &)
 Quad_impl ()
virtual ~Quad_impl ()
 Quad_impl (const Quad_impl &)
 Quad_impl ()
virtual ~Quad_impl ()

Quad interface methods.

See also:
Quad
bool Init (XRes *resource, XCongo *xcongo)
 Read Quad from resource file.
bool Display ()
 Draw itself in global cotext. Since quads are intented to be used with opengl, drawing context is global.
bool Move (const double forse[3])
 Move quad posotion to new_pos.
bool Forse (const double forse[3])
 Chage Quad's direction of moving with forse.
bool SetActive (bool activity)
 Set query Quad activity state.
bool IsActive () const
const double * Direction () const
 Direction of moving.
void RegisterListener (QuadListener *listener)
 Assign listener to this quad.
const char * ClassName () const
 Used for RTTI.
double Mass () const
 Weight of object.
Additinal methods

Not declared in Quad interface

const double * Position () const
 Position of Quad.
virtual void SetDirection (const double dir[3])
 Set direction of moving.
const double * Color () const
 Get Color of Quad.
double Size () const
 Get Size of Quad.
virtual void SetSize (double size)
 Set Size of Quad.
double Power () const
 Power of object (TODO: explain)
const double * Position () const
 Position of Quad.
virtual void SetDirection (const double dir[3])
 Set direction of moving.
const double * Color () const
 Get Color of Quad.
double Size () const
 Get Size of Quad.
virtual void SetSize (double size)
 Set Size of Quad.
double Power () const
 Power of object (TODO: explain)

Quad interface methods.

See also:
Quad
bool Init (XRes *resource, XCongo *xcongo)
 Read Quad from resource file.
bool Display ()
 Draw itself in global cotext. Since quads are intented to be used with opengl, drawing context is global.
bool Move (const double forse[3])
 Move quad posotion to new_pos.
bool Forse (const double forse[3])
 Chage Quad's direction of moving with forse.
bool SetActive (bool activity)
 Set query Quad activity state.
bool IsActive () const
const double * Direction () const
 Direction of moving.
void RegisterListener (QuadListener *listener)
 Assign listener to this quad.
const char * ClassName () const
 Used for RTTI.
double Mass () const
 Weight of object.

Protected Attributes

Quad interface properties
double mDirection [3]
 Direction which will be applied when object move again.
double mPos [3]
 Current position.
double mMass
 Mass of object.
bool mbActive
 Whether object is active.
QuadListenermpListener
 Listener to notofy when property change.
Quad_impl ptoprties
double mSize
 Size of Quad.
double mColor [4]
 RGBA Color of quad.
double mPower
 Power of Quad.

Detailed Description

Common implementation of Quad interface.

Implements all methods declared in Quad interface and adds more functionality.

See also:
Quad.

Definition at line 159 of file Quad.h.


Constructor & Destructor Documentation

Definition at line 24 of file Quad.cpp.

References mbActive, mColor, mDirection, mMass, mpListener, mPos, mPower, and mSize.

{
    memcpy(mColor, nq.mColor, sizeof(mColor) );
    memcpy(mDirection, nq.mDirection, sizeof(mDirection) );
   
    mMass = nq.mMass;
    memcpy(mPos, nq.mPos, sizeof(mPos) );
    mSize = nq.mSize;
    mbActive = nq.mbActive;
    mPower = nq.mPower;
    mpListener = nq.mpListener;
}

Definition at line 16 of file Quad.cpp.

References mbActive, mDirection, mPos, and mPower.

                     : mpListener(0)
{
    memset(mPos, 0, sizeof(mPos) );
    memset(mDirection, 0, 3 * sizeof(double) );
    
    mbActive = true;
    mPower = 0.0;
}
virtual Quad_impl::~Quad_impl ( ) [inline, virtual]

Definition at line 164 of file Quad.h.

{}
virtual Quad_impl::~Quad_impl ( ) [inline, virtual]

Definition at line 164 of file Quad.h.

{}

Member Function Documentation

const char* Quad_impl::ClassName ( ) const [inline, virtual]

Used for RTTI.

Returns:
Name of the actual class.
See also:
Factory

Implements Quad.

Reimplemented in Hitti, Hitti, Arrow, Arrow, Box, Box, Ball, Ball, Bongo, and Bongo.

Definition at line 179 of file Quad.h.

{ return "Quad"; };
const char* Quad_impl::ClassName ( ) const [inline, virtual]

Used for RTTI.

Returns:
Name of the actual class.
See also:
Factory

Implements Quad.

Reimplemented in Hitti, Hitti, Arrow, Arrow, Box, Box, Ball, Ball, Bongo, and Bongo.

Definition at line 179 of file Quad.h.

{ return "Quad"; };
const double * Quad_impl::Color ( ) const [virtual]

Get Color of Quad.

Implements Quad.

Definition at line 78 of file Quad.cpp.

References mColor.

Referenced by CollisionMaster::Collision(), and Arrow::Init().

{ 
    return mColor; 
}
const double* Quad_impl::Color ( ) const [virtual]

Get Color of Quad.

Implements Quad.

const double* Quad_impl::Direction ( ) const [inline, virtual]

Direction of moving.

Implements Quad.

Definition at line 177 of file Quad.h.

References mDirection.

Referenced by CollisionMaster::Collision().

{ return mDirection; }
const double* Quad_impl::Direction ( ) const [inline, virtual]

Direction of moving.

Implements Quad.

Definition at line 177 of file Quad.h.

References mDirection.

{ return mDirection; }
bool Quad_impl::Display ( ) [inline, virtual]

Draw itself in global cotext. Since quads are intented to be used with opengl, drawing context is global.

Returns:
true if ok, false on error.

Implements Quad.

Reimplemented in Hitti, Hitti, Arrow, Arrow, Box, Box, Ball, Ball, Bongo, and Bongo.

Definition at line 172 of file Quad.h.

{ return true; }
bool Quad_impl::Display ( ) [inline, virtual]

Draw itself in global cotext. Since quads are intented to be used with opengl, drawing context is global.

Returns:
true if ok, false on error.

Implements Quad.

Reimplemented in Hitti, Hitti, Arrow, Arrow, Box, Box, Ball, Ball, Bongo, and Bongo.

Definition at line 172 of file Quad.h.

{ return true; }
bool Quad_impl::Forse ( const double  forse[3]) [virtual]

Chage Quad's direction of moving with forse.

If mass is MASS_INFINITE then forse will not move the objet

Returns:
true if object changed it's direction, false if not.

Implements Quad.

Reimplemented in Hitti, and Hitti.

bool Quad_impl::Forse ( const double  forse[3]) [virtual]

Chage Quad's direction of moving with forse.

If mass is MASS_INFINITE then forse will not move the objet

Returns:
true if object changed it's direction, false if not.

Implements Quad.

Reimplemented in Hitti, and Hitti.

bool Quad_impl::Init ( XRes resource,
XCongo xcongo 
) [inline, virtual]

Read Quad from resource file.

Parameters:
resourceResource file contained description of Quad object.
xcongoGlobal settings file contained parameters not specific to this quad.
Returns:
true if ok, false on error.

Implements Quad.

Reimplemented in Arrow, Arrow, Box, Box, Ball, Ball, Bongo, and Bongo.

Definition at line 171 of file Quad.h.

{ return true; }
bool Quad_impl::Init ( XRes resource,
XCongo xcongo 
) [inline, virtual]

Read Quad from resource file.

Parameters:
resourceResource file contained description of Quad object.
xcongoGlobal settings file contained parameters not specific to this quad.
Returns:
true if ok, false on error.

Implements Quad.

Reimplemented in Arrow, Arrow, Box, Box, Ball, Ball, Bongo, and Bongo.

Definition at line 171 of file Quad.h.

{ return true; }
bool Quad_impl::IsActive ( ) const [virtual]

Implements Quad.

bool Quad_impl::IsActive ( ) const [virtual]

Implements Quad.

Definition at line 63 of file Quad.cpp.

References mbActive.

Referenced by BongoOrthoMover::ProcessKey().

{
    return mbActive;
}
double Quad_impl::Mass ( ) const [virtual]

Weight of object.

Implements Quad.

Definition at line 68 of file Quad.cpp.

References mMass.

{ 
    return mMass; 
}
double Quad_impl::Mass ( ) const [virtual]

Weight of object.

Implements Quad.

bool Quad_impl::Move ( const double  new_pos[3]) [virtual]

Move quad posotion to new_pos.

Returns:
true if object is moved, false if not.

Implements Quad.

Reimplemented in Hitti, and Hitti.

bool Quad_impl::Move ( const double  new_pos[3]) [virtual]

Move quad posotion to new_pos.

Returns:
true if object is moved, false if not.

Implements Quad.

Reimplemented in Hitti, and Hitti.

Referenced by CollisionMaster::Collision(), Bongo::Forse(), and Ball::Move().

const double* Quad_impl::Position ( ) const

Position of Quad.

const double * Quad_impl::Position ( ) const

Position of Quad.

Definition at line 41 of file Quad.cpp.

References mPos.

Referenced by CollisionMaster::Collision(), Arrow::Init(), ViewBongoFollower::QuadEvent(), and ViewBongoFollower::ViewBongoFollower().

{ 
    return mPos; 
}    
double Quad_impl::Power ( ) const

Power of object (TODO: explain)

Definition at line 46 of file Quad.cpp.

References mPower.

Referenced by CollisionMaster::Collision().

{ 
    return mPower; 
}
double Quad_impl::Power ( ) const

Power of object (TODO: explain)

void Quad_impl::RegisterListener ( QuadListener listener) [virtual]

Assign listener to this quad.

When something happend to quad (Quad moves). It will notify listening object.

Implements Quad.

void Quad_impl::RegisterListener ( QuadListener listener) [virtual]

Assign listener to this quad.

When something happend to quad (Quad moves). It will notify listening object.

Implements Quad.

Definition at line 83 of file Quad.cpp.

References mpListener.

Referenced by ViewBongoFollower::ViewBongoFollower().

{   
    mpListener = listener; 
}
bool Quad_impl::SetActive ( bool  activity) [virtual]

Set query Quad activity state.

If Quad is not active, then other object should't change it's state.

Returns:
Activity state before this change.

Implements Quad.

bool Quad_impl::SetActive ( bool  activity) [virtual]

Set query Quad activity state.

If Quad is not active, then other object should't change it's state.

Returns:
Activity state before this change.

Implements Quad.

Definition at line 51 of file Quad.cpp.

References mbActive, SetDirection(), and VZERO.

Referenced by CollisionMaster::Collision(), and Bongo::Free().

{
    bool old_activity = mbActive;

    if (!activity) 
        SetDirection(VZERO);

    mbActive = activity;

    return old_activity;
}
void Quad_impl::SetDirection ( const double  dir[3]) [virtual]

Set direction of moving.

Reimplemented in Ball, and Ball.

Definition at line 115 of file Quad.cpp.

References mDirection.

Referenced by CollisionMaster::Collision(), BongoOrthoMover::ProcessKey(), BongoRealMover::ProcessKey(), and SetActive().

{
    memcpy(mDirection, dir, sizeof(mDirection) );
}
virtual void Quad_impl::SetDirection ( const double  dir[3]) [virtual]

Set direction of moving.

Reimplemented in Ball, and Ball.

void Quad_impl::SetSize ( double  size) [virtual]

Set Size of Quad.

Parameters:
sizeNew size

Definition at line 36 of file Quad.cpp.

References mSize.

Referenced by CollisionMaster::Collision(), and Hitti::Hitti().

{
    mSize = size;
}
virtual void Quad_impl::SetSize ( double  size) [virtual]

Set Size of Quad.

Parameters:
sizeNew size
double Quad_impl::Size ( ) const

Get Size of Quad.

Definition at line 73 of file Quad.cpp.

References mSize.

Referenced by Ball::Capture(), CollisionMaster::Collision(), and Arrow::Init().

{ 
    return mSize; 
}
double Quad_impl::Size ( ) const

Get Size of Quad.


Member Data Documentation

bool Quad_impl::mbActive [protected]

Whether object is active.

Definition at line 238 of file Quad.h.

Referenced by IsActive(), Quad_impl(), and SetActive().

double Quad_impl::mColor [protected]
double Quad_impl::mDirection [protected]

Direction which will be applied when object move again.

Definition at line 232 of file Quad.h.

Referenced by Direction(), Ball::Init(), Arrow::Init(), Quad_impl(), and SetDirection().

double Quad_impl::mMass [protected]

Mass of object.

Definition at line 236 of file Quad.h.

Referenced by Ball::Init(), Mass(), and Quad_impl().

Listener to notofy when property change.

Definition at line 240 of file Quad.h.

Referenced by Quad_impl(), and RegisterListener().

double Quad_impl::mPos [protected]
double Quad_impl::mPower [protected]

Power of Quad.

Definition at line 254 of file Quad.h.

Referenced by Ball::Init(), Arrow::Init(), Power(), and Quad_impl().

double Quad_impl::mSize [protected]

The documentation for this class was generated from the following files: