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

Public Member Functions

 BoxTerrain (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 ()
 
- Public Member Functions inherited from Terrain
 Terrain (b2World *world, sf::RenderWindow &window, config::sTerrain terrainParam, int WINDOW_X_PX, double bodyLength=1)
 
virtual b2Vec2 getTopLeftCorner ()
 
virtual b2Vec2 getTopRightCorner ()
 
virtual b2Vec2 getBottom ()
 
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 13 of file BoxTerrain.h.

Member Function Documentation

◆ create()

void BoxTerrain::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 BoxTerrain.cpp.

Here is the caller graph for this function:

◆ createBody()

void BoxTerrain::createBody ( b2World *  world)
virtual

Create the Box2D body for the static object of the scene.

Parameters
m_to_pix,window_x_px,window_y_pxconfiguration of the window, they are usually defined in the config file.
wall_w_m,wall_h_mconfiguration of the walls, they are usually defined in the config file.

Reimplemented from Terrain.

Definition at line 35 of file BoxTerrain.cpp.

Here is the caller graph for this function:

◆ drawBody()

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

Draw the shapes corresponding to the Box2D body created previously.

Parameters
m_to_pix,window_x_px,window_y_pxconfiguration of the window, they are usually defined in the config file.
wall_w_m,wall_h_mconfiguration of the walls, they are usually defined in the config file.

Reimplemented from Terrain.

Definition at line 68 of file BoxTerrain.cpp.

Here is the caller graph for this function:

◆ getType()

e_terrain_type BoxTerrain::getType ( )
virtual
Returns
the type of the terrain. Can be DEFAULT, V_TERRAIN, V2BL_TERRAIN, RAMP, BOX or V_STEPPER

Reimplemented from Terrain.

Definition at line 90 of file BoxTerrain.cpp.

Here is the caller graph for this function:

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