Base class of any object contained within the simulation. More...
#include <objects.h>
Public Member Functions | |
| Object (float _x, float _y, ObjectGeometry &_geom, std::string const &_category="objects") | |
| Constructs an Object. | |
| Object (Simulation *simulation, float _x, float _y, Configuration const &config, std::string const &_category="objects") | |
| Constructs an Object from a configuration entry. | |
| virtual | ~Object () |
| Destructor. | |
| virtual void | render (SDL_Renderer *renderer, b2WorldId world_id) const =0 |
| Renders the object on the given SDL renderer. | |
| virtual void | launch_user_step (float f) |
| Launches the user-defined step function. | |
| ObjectGeometry * | get_geometry () |
| Return the object's geometry. | |
| virtual void | move (float x, float y, float theta=NAN) |
| Move the object to a given coordinate. | |
| virtual bool | is_tangible () const |
| Returns whether this object is tangible (e.g. collisions, etc) or not. | |
| virtual arena_polygons_t | generate_contours (std::size_t points_per_contour=0) const |
| Return one or more polygonal contours that represent the geometry of the object. | |
Public Attributes | |
| float | x |
| X position. | |
| float | y |
| Y position. | |
| float | theta |
| Orientation (in rad). | |
| std::string | category |
| Category of the object. | |
Protected Member Functions | |
| virtual void | parse_configuration (Configuration const &config, Simulation *simulation) |
| Parse a provided configuration and set associated members values. | |
Protected Attributes | |
| ObjectGeometry * | geom |
| Geometry of the object. | |
Base class of any object contained within the simulation.
| Object::Object | ( | float | _x, |
| float | _y, | ||
| ObjectGeometry & | _geom, | ||
| std::string const & | _category = "objects" ) |
| Object::Object | ( | Simulation * | simulation, |
| float | _x, | ||
| float | _y, | ||
| Configuration const & | config, | ||
| std::string const & | _category = "objects" ) |
Constructs an Object from a configuration entry.
| simulation | Pointer to the underlying simulation. |
| x | Initial x-coordinate in the simulation. |
| y | Initial y-coordinate in the simulation. |
| config | Configuration entry describing the object properties. |
| category | Name of the category of the object. |
|
virtual |
Destructor.
|
virtual |
Return one or more polygonal contours that represent the geometry of the object.
| points_per_contour | Desired number of vertices for each contour (a rectangle has one contour, a disk has one, an arena may have many – one per wall). |
Reimplemented in MembraneObject, and PhysicalObject.
|
inline |
Return the object's geometry.
|
inlinevirtual |
Returns whether this object is tangible (e.g. collisions, etc) or not.
Reimplemented in MembraneObject, PhysicalObject, and Pogowall.
|
virtual |
Launches the user-defined step function.
| t | current simulation time |
Reimplemented in AlternatingDualRayOfLightObject, PhysicalObject, PogobotObject, RotatingRayOfLightObject, and StaticLightObject.
|
virtual |
Move the object to a given coordinate.
Reimplemented in MembraneObject, PhysicalObject, and Pogowall.
|
protectedvirtual |
Parse a provided configuration and set associated members values.
| config | Configuration entry describing the object properties. |
Reimplemented in ActiveObject, AlternatingDualRayOfLightObject, MembraneObject, PassiveObject, PhysicalObject, PogobotObject, RotatingRayOfLightObject, and StaticLightObject.
|
pure virtual |
Renders the object on the given SDL renderer.
| renderer | Pointer to the SDL_Renderer. |
| world_id | The Box2D world identifier (unused in rendering). |
Implemented in ActiveObject, AlternatingDualRayOfLightObject, MembraneObject, PassiveObject, PhysicalObject, PogobjectObject, PogobotObject, Pogowall, RotatingRayOfLightObject, and StaticLightObject.
| std::string Object::category |
Category of the object.
|
protected |
Geometry of the object.
| float Object::theta |
Orientation (in rad).
| float Object::x |
X position.
| float Object::y |
Y position.