HeadBall  1.0
A game
Public Member Functions | Private Attributes | List of all members
HeadBall::Ball Class Reference

Class for shape and movement of ball. More...

#include <Ball.hpp>

Collaboration diagram for HeadBall::Ball:
Collaboration graph

Public Member Functions

 Ball (GameDataRef data, WorldRef world)
 Construct a new Ball object. More...
 
void init ()
 Initiate the Ball object. More...
 
sf::CircleShape shape ()
 Return the shape of the Ball object. More...
 
void processPosition ()
 Process the position of the Ball object. More...
 
void rePosition ()
 Place the ball at the starting position. More...
 
b2Body * body ()
 Return the Box2D body of the ball. More...
 

Private Attributes

GameDataRef _data
 The Shared Pointer of the game data. More...
 
WorldRef _world
 The Shared Pointer of Box2D World. More...
 
sf::CircleShape _shape
 The SFML shape of the ball. More...
 
b2BodyDef _bodyDef
 The Definition of Box2D body. More...
 
b2Body * _body
 The Box2D body of ball. More...
 
b2CircleShape _circleShape
 The circle shape for fixture definition. More...
 
b2FixtureDef _fixture
 The fixture of ball for defining its properties. More...
 

Detailed Description

Class for shape and movement of ball.

Constructor & Destructor Documentation

◆ Ball()

HeadBall::Ball::Ball ( GameDataRef  data,
WorldRef  world 
)

Construct a new Ball object.

Parameters
dataThe Shared Pointer for game data
worldThe Shared pointer for Box2D world

Member Function Documentation

◆ body()

b2Body * HeadBall::Ball::body ( )

Return the Box2D body of the ball.

Returns
b2Body* The Box2D body of the ball

◆ init()

void HeadBall::Ball::init ( )

Initiate the Ball object.

◆ processPosition()

void HeadBall::Ball::processPosition ( )

Process the position of the Ball object.

This function processes the position of the CircleShape as per the position of body in Box2D

◆ rePosition()

void HeadBall::Ball::rePosition ( )

Place the ball at the starting position.

◆ shape()

sf::CircleShape HeadBall::Ball::shape ( )

Return the shape of the Ball object.

Returns
sf::CircleShape the shape of Ball object

Member Data Documentation

◆ _body

b2Body* HeadBall::Ball::_body
private

The Box2D body of ball.

◆ _bodyDef

b2BodyDef HeadBall::Ball::_bodyDef
private

The Definition of Box2D body.

◆ _circleShape

b2CircleShape HeadBall::Ball::_circleShape
private

The circle shape for fixture definition.

◆ _data

GameDataRef HeadBall::Ball::_data
private

The Shared Pointer of the game data.

◆ _fixture

b2FixtureDef HeadBall::Ball::_fixture
private

The fixture of ball for defining its properties.

◆ _shape

sf::CircleShape HeadBall::Ball::_shape
private

The SFML shape of the ball.

◆ _world

WorldRef HeadBall::Ball::_world
private

The Shared Pointer of Box2D World.


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