Gel2D - The free/open source game creation suite

Public Member Functions | Protected Member Functions | Protected Attributes
gel::GelObject Class Reference

Gel2D object base class. More...

#include <gelObject.h>

Inheritance diagram for gel::GelObject:
gel::GelEventReceiver gel::GelArmature gel::GelCamera gel::GelGUIWidget gel::GelLine gel::GelParticleSys gel::GelSprite gel::GelText gel::GelGUIButton gel::GelGUICheckBox gel::GelGUIText gel::GelAnimSprite

List of all members.

Public Member Functions

 GelObject ()
 Default constructor.
 GelObject (Gel2dVec obj_pos, float obj_rot, Gel2dVec obj_scl)
 Convenience constructor.
Gel2dVec getPos () const
 Gets the position (translation) of the object.
void setPos (const Gel2dVec &vecPos)
 Sets the position (translation) of the object.
float getRot () const
 Gets the rotation of the object.
void setRot (float deg)
 Sets the rotation of the object.
Gel2dVec getScale () const
 Gets the scale of the object.
void setScale (const Gel2dVec &vecScale)
 Sets the scale of the object.
Gel2dVec getHotSpot () const
 Gets the coordinates of the object's center for translation, rotation, and scaling.
void setHotSpot (const Gel2dVec &vecHotSpot)
 Sets the coordinates of the object's center for translation, rotation, and scaling.
void move (const Gel2dVec &trans)
 Moves the object by the specified amount.
void rotate (float deg)
 Rotates the object by the specified amount.
void scale (const Gel2dVec &scale)
 Scales the object by the specified amount.
void moveTo (const Gel2dVec &vec, int frames)
 Moves the object using interpolation.
void scaleTo (const Gel2dVec &vec, int frames)
 Scales the object using interpolation.
float getDistanceTo (const GelObject &obj) const
 Gets the distance from this object to another GelObject.
float getDistanceTo (const Gel2dVec &vec) const
 Gets the distance from this object to a Gel2dVec.
void setParent (GelObject *par, int delay)
GelObject getParent () const
void removeParent ()
bool hasParent () const
bool isMouseOver ()
 Tests if the mouse cursor is over this object.
bool isMouseOver (int width, int height, int mousex, int mousey)
 Tests if the mouse cursor is over this object.
Gel2dVec getLocalCoords (int screenx, int screeny) const
Gel2dVec getLocalCoords (int width, int height, int screenx, int screeny) const
CollisionBounds getCollisionBounds () const
void setCollisionBounds (CollisionBounds type)
virtual GelCircle getCircle () const
 Gets the object's bounding circle.
virtual GelAABB getAABB () const
 Gets the object's axis-aligned bounding box.
virtual void render ()

Protected Member Functions

void fix ()
int _testMouseIntersect ()
virtual int _pointIntersect (float locx, float locy)

Protected Attributes

Gel2dVec pos
 Position.
float rot
 Rotation.
Gel2dVec scl
 Scale.
Gel2dVec hotSpot
 Center of translation, rotation, and scaling.
GelObjectparent
 Parent object.
int isCursorOver
int bMouseTest
int view [4]
double model [16]
double proj [16]
int customParam
int wndWidth
int wndHeight
int mouseX
int mouseY
CollisionBounds collisionBounds
float radius
Gel2dVec par_pos
Gel2dVec chd_pos
float par_rot
float chd_rot
Gel2dVec par_scl
int par_delay

Detailed Description

Gel2D object base class.


Constructor & Destructor Documentation

gel::GelObject::GelObject ( )

Default constructor.

gel::GelObject::GelObject ( Gel2dVec  obj_pos,
float  obj_rot,
Gel2dVec  obj_scl 
)

Convenience constructor.

Sets the object's position, rotation, and scale.

Parameters:
obj_pos: The object's x and y coordinates.
obj_rot: The rotation of the object in degrees.
obj_scl: The object's scale.

Member Function Documentation

Gel2dVec gel::GelObject::getPos ( ) const [inline]

Gets the position (translation) of the object.

Returns:
A Gel2dVec containing the x and y coordinates of the object.
void gel::GelObject::setPos ( const Gel2dVec vecPos) [inline]

Sets the position (translation) of the object.

Parameters:
vecPos: A Gel2dVec containing the new x and y coordinates.
float gel::GelObject::getRot ( ) const [inline]

Gets the rotation of the object.

Returns:
The rotation of the object in degrees. It should be in range from 0 to 360.
void gel::GelObject::setRot ( float  deg) [inline]

Sets the rotation of the object.

If deg is set to a number above 360 or below 0, it will automatically be reset to it's equivalent angle within the 0-360 range.

Parameters:
deg: The new rotation of the object in degrees. It should be in range from 0 to 360.
Gel2dVec gel::GelObject::getScale ( ) const [inline]

Gets the scale of the object.

Returns:
A Gel2dVec containing the scale of the x and y axes, respectively.
void gel::GelObject::setScale ( const Gel2dVec vecScale) [inline]

Sets the scale of the object.

Parameters:
vecScale: A Gel2dVec containing the new scale of the x and y axes, respectively.
Gel2dVec gel::GelObject::getHotSpot ( ) const [inline]

Gets the coordinates of the object's center for translation, rotation, and scaling.

Returns:
A Gel2dVec containing the x and y coordinates of the object's center.
void gel::GelObject::setHotSpot ( const Gel2dVec vecHotSpot) [inline]

Sets the coordinates of the object's center for translation, rotation, and scaling.

Parameters:
vecHotSpot: A Gel2dVec containing the new x and y coordinates.
void gel::GelObject::move ( const Gel2dVec trans) [inline]

Moves the object by the specified amount.

Parameters:
trans: The amount to move the object, in pixels.
void gel::GelObject::rotate ( float  deg) [inline]

Rotates the object by the specified amount.

Parameters:
deg: The amount to rotate the object, in degrees.
void gel::GelObject::scale ( const Gel2dVec scale) [inline]

Scales the object by the specified amount.

Parameters:
scale: The amount to scale the object.
void gel::GelObject::moveTo ( const Gel2dVec vec,
int  frames 
)

Moves the object using interpolation.

Moves the object to the location specified in vec, in the duration specified by frames.
This function will probably be removed in a later release.

Parameters:
vec: The position to move to.
frames: The number of frames to interpolate the movement across.
void gel::GelObject::scaleTo ( const Gel2dVec vec,
int  frames 
)

Scales the object using interpolation.

Scales the object to the scale specified in vec, in the duration specified by frames.
This function will probably be removed in a later release.

Parameters:
vec: The scale.
frames: The number of frames to interpolate the scale across.
float gel::GelObject::getDistanceTo ( const GelObject obj) const

Gets the distance from this object to another GelObject.

Parameters:
obj: The GelObject to get the distance to.
float gel::GelObject::getDistanceTo ( const Gel2dVec vec) const

Gets the distance from this object to a Gel2dVec.

Parameters:
vec: The Gel2dVec to get the distance to.
void gel::GelObject::setParent ( GelObject par,
int  delay 
)
GelObject gel::GelObject::getParent ( ) const [inline]
void gel::GelObject::removeParent ( )
bool gel::GelObject::hasParent ( ) const
bool gel::GelObject::isMouseOver ( )

Tests if the mouse cursor is over this object.

Returns:
True if the mouse is over this object, else false.
bool gel::GelObject::isMouseOver ( int  width,
int  height,
int  mousex,
int  mousey 
)

Tests if the mouse cursor is over this object.

This overloaded function allows you to specify alternate window dimensions and mouse coordinates.

Parameters:
width: Window width.
height: Window height.
mousex: Mouse cursor's horizontal position.
mousey: Mouse cursor's vertical position.
Returns:
GEL_TRUE if the mouse is over this object, else GEL_FALSE.
Gel2dVec gel::GelObject::getLocalCoords ( int  screenx,
int  screeny 
) const
Gel2dVec gel::GelObject::getLocalCoords ( int  width,
int  height,
int  screenx,
int  screeny 
) const
CollisionBounds gel::GelObject::getCollisionBounds ( ) const [inline]
void gel::GelObject::setCollisionBounds ( CollisionBounds  type) [inline]
virtual GelCircle gel::GelObject::getCircle ( ) const [virtual]

Gets the object's bounding circle.

virtual GelAABB gel::GelObject::getAABB ( ) const [virtual]

Gets the object's axis-aligned bounding box.

Reimplemented in gel::GelSprite.

virtual void gel::GelObject::render ( ) [virtual]
void gel::GelObject::fix ( ) [protected]
int gel::GelObject::_testMouseIntersect ( ) [protected]
virtual int gel::GelObject::_pointIntersect ( float  locx,
float  locy 
) [protected, virtual]

Reimplemented in gel::GelSprite.


Member Data Documentation

Position.

float gel::GelObject::rot [protected]

Rotation.

Scale.

Center of translation, rotation, and scaling.

Parent object.

int gel::GelObject::bMouseTest [protected]
int gel::GelObject::view[4] [protected]
double gel::GelObject::model[16] [protected]
double gel::GelObject::proj[16] [protected]
int gel::GelObject::customParam [protected]
int gel::GelObject::wndWidth [protected]
int gel::GelObject::wndHeight [protected]
int gel::GelObject::mouseX [protected]
int gel::GelObject::mouseY [protected]
float gel::GelObject::radius [protected]
float gel::GelObject::par_rot [protected]
float gel::GelObject::chd_rot [protected]
int gel::GelObject::par_delay [protected]

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