Common implementation of Quad interface. More...
#include <Quad.h>
Public Member Functions | |
| Quad_impl (const Quad_impl &) | |
| Quad_impl () | |
| virtual | ~Quad_impl () |
| Quad_impl (const Quad_impl &) | |
| Quad_impl () | |
| virtual | ~Quad_impl () |
| 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) | |
| 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. | |
| QuadListener * | mpListener |
| 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. | |
Common implementation of Quad interface.
Implements all methods declared in Quad interface and adds more functionality.
| Quad_impl::Quad_impl | ( | const Quad_impl & | nq | ) |
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] |
| Quad_impl::Quad_impl | ( | const Quad_impl & | ) |
| virtual Quad_impl::~Quad_impl | ( | ) | [inline, virtual] |
| const char* Quad_impl::ClassName | ( | ) | const [inline, virtual] |
| const char* Quad_impl::ClassName | ( | ) | const [inline, virtual] |
| 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] |
| 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] |
| bool Quad_impl::Display | ( | ) | [inline, virtual] |
| bool Quad_impl::Forse | ( | const double | forse[3] | ) | [virtual] |
| bool Quad_impl::Forse | ( | const double | forse[3] | ) | [virtual] |
| bool Quad_impl::Init | ( | XRes * | resource, |
| XCongo * | xcongo | ||
| ) | [inline, virtual] |
Read Quad from resource file.
| resource | Resource file contained description of Quad object. |
| xcongo | Global settings file contained parameters not specific to this quad. |
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.
| resource | Resource file contained description of Quad object. |
| xcongo | Global settings file contained parameters not specific to this quad. |
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] |
| double Quad_impl::Mass | ( | ) | const [virtual] |
| double Quad_impl::Mass | ( | ) | const [virtual] |
Weight of object.
Implements Quad.
| bool Quad_impl::Move | ( | const double | new_pos[3] | ) | [virtual] |
| bool Quad_impl::Move | ( | const double | new_pos[3] | ) | [virtual] |
Move quad posotion to new_pos.
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] |
| 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] |
| 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.
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] |
| void Quad_impl::SetSize | ( | double | size | ) | [virtual] |
Set Size of Quad.
| size | New 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.
| size | New 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.
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] |
RGBA Color of quad.
Definition at line 252 of file Quad.h.
Referenced by Ball::Capture(), Color(), Bongo::Display(), Ball::Display(), Box::Display(), Arrow::Display(), Hitti::Display(), Hitti::Hitti(), Bongo::Init(), Ball::Init(), Box::Init(), Arrow::Init(), and Quad_impl().
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().
QuadListener * Quad_impl::mpListener [protected] |
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] |
Current position.
Definition at line 234 of file Quad.h.
Referenced by Bongo::Display(), Ball::Display(), Arrow::Display(), Hitti::Display(), Bongo::Free(), Hitti::Hitti(), Bongo::Init(), Ball::Init(), Arrow::Init(), Position(), Quad_impl(), and Ball::SetDirection().
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] |
Size of Quad.
Definition at line 250 of file Quad.h.
Referenced by Ball::Capture(), Bongo::Display(), Ball::Display(), Arrow::Display(), Hitti::Display(), Bongo::Init(), Ball::Init(), Arrow::Init(), Quad_impl(), SetSize(), and Size().
1.8.0