Army ant simulation
Public Member Functions | List of all members
V2BLTerrain Class Reference
Inheritance diagram for V2BLTerrain:
Inheritance graph
[legend]
Collaboration diagram for V2BLTerrain:
Collaboration graph
[legend]

Public Member Functions

 V2BLTerrain (b2World *world, sf::RenderWindow &window, config::sTerrain terrainParam, int WINDOW_X_PX, double bodyLength=1)
 
void create (b2World *world, sf::RenderWindow &window, config::sTerrain terrainParam, int WINDOW_X_PX, double bodyLength=1)
 
void createBody (b2World *world)
 
void drawBody (sf::RenderWindow &window)
 
e_terrain_type getType ()
 
b2Vec2 getTopLeftCorner ()
 
b2Vec2 getTopRightCorner ()
 
b2Vec2 getBottom ()
 
- Public Member Functions inherited from Terrain
 Terrain (b2World *world, sf::RenderWindow &window, config::sTerrain terrainParam, int WINDOW_X_PX, double bodyLength=1)
 
double getVLength ()
 
b2Body * getBody ()
 
const double getScale ()
 

Additional Inherited Members

- Protected Attributes inherited from Terrain
b2Body * m_groundBody
 
double m_bodyLength
 
double m_M_TO_PX
 
double m_width
 
double m_height
 
double m_runaway
 
double m_angle
 
double m_posY =2.5
 
config::sTerrain m_terrainParam
 

Detailed Description

Definition at line 17 of file V2BLTerrain.h.

Member Function Documentation

◆ create()

void V2BLTerrain::create ( b2World *  world,
sf::RenderWindow &  window,
config::sTerrain  terrainParam,
int  WINDOW_X_PX,
double  bodyLength = 1 
)
virtual

The function create MUST be called if the terrain object has been created via the default constructor (ex when created dynamically with new), otherwise no need to use it

Parameters
worldis a pointer on the Box2D world object
windowis the SFML window
terrainParamare the terrain parameters (cf Config.h)
WINDOW_X_PXis the x-size of the window. it is used to calculate the scale to convert from meters to pixels
bodylengthis the size of a robot. it is used to convert the dimension from body length to m

Reimplemented from Terrain.

Definition at line 26 of file V2BLTerrain.cpp.

◆ createBody()

void V2BLTerrain::createBody ( b2World *  world)
virtual

Create the Box2D static body of the terrain

Parameters
worldis a pointer on the Box2D world

Reimplemented from Terrain.

Definition at line 33 of file V2BLTerrain.cpp.

◆ drawBody()

void V2BLTerrain::drawBody ( sf::RenderWindow &  window)
virtual

Draw the body on the window using the SFML library

Parameters
windowis the SFML window where the terrain will be drawn

Reimplemented from Terrain.

Definition at line 73 of file V2BLTerrain.cpp.

◆ getBottom()

b2Vec2 V2BLTerrain::getBottom ( )
virtual
Returns
the position of the bottom of the V in the box2D world coordinates [m]
the position of bottom of the V in the box2D world coordinates [m]

Reimplemented from Terrain.

Definition at line 101 of file V2BLTerrain.cpp.

◆ getTopLeftCorner()

b2Vec2 V2BLTerrain::getTopLeftCorner ( )
virtual
Returns
the position of the Top left corner of the V in the box2D world coordinates [m]

Reimplemented from Terrain.

Definition at line 93 of file V2BLTerrain.cpp.

◆ getTopRightCorner()

b2Vec2 V2BLTerrain::getTopRightCorner ( )
virtual
Returns
the position of the Top right corner of the V in the box2D world coordinates [m]

Reimplemented from Terrain.

Definition at line 97 of file V2BLTerrain.cpp.

◆ getType()

e_terrain_type V2BLTerrain::getType ( )
virtual

return the terrain type, from this class it returns V2BL_TERRAIN

Reimplemented from Terrain.

Definition at line 105 of file V2BLTerrain.cpp.


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