HeadBall  1.0
A game
Ball.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Game.hpp"
4 
5 namespace HeadBall {
10  class Ball {
11  public:
18  Ball (GameDataRef data, WorldRef world);
19 
24  void init ( );
25 
31  sf::CircleShape shape ( );
32 
39  void processPosition ( );
40 
45  void rePosition ( );
46 
52  b2Body* body( );
53 
54  private:
57 
58  sf::CircleShape _shape;
59 
60  b2BodyDef _bodyDef;
61  b2Body* _body;
62  b2CircleShape _circleShape;
63  b2FixtureDef _fixture;
64  };
65 }
Class for shape and movement of ball.
Definition: Ball.hpp:10
b2BodyDef _bodyDef
The Definition of Box2D body.
Definition: Ball.hpp:60
WorldRef _world
The Shared Pointer of Box2D World.
Definition: Ball.hpp:56
b2Body * _body
The Box2D body of ball.
Definition: Ball.hpp:61
GameDataRef _data
The Shared Pointer of the game data.
Definition: Ball.hpp:55
b2CircleShape _circleShape
The circle shape for fixture definition.
Definition: Ball.hpp:62
b2Body * body()
Return the Box2D body of the ball.
Definition: Ball.cpp:42
void init()
Initiate the Ball object.
Definition: Ball.cpp:8
void rePosition()
Place the ball at the starting position.
Definition: Ball.cpp:37
sf::CircleShape _shape
The SFML shape of the ball.
Definition: Ball.hpp:58
Ball(GameDataRef data, WorldRef world)
Construct a new Ball object.
Definition: Ball.cpp:6
sf::CircleShape shape()
Return the shape of the Ball object.
Definition: Ball.cpp:29
b2FixtureDef _fixture
The fixture of ball for defining its properties.
Definition: Ball.hpp:63
void processPosition()
Process the position of the Ball object.
Definition: Ball.cpp:33
Custom namespace used throughout the project.
Definition: AboutState.cpp:6
std::shared_ptr< b2World > WorldRef
The Shared Pointer that points to the Box2D world.
Definition: Game.hpp:51
std::shared_ptr< GameData > GameDataRef
The Shared Pointer of GameData Struct.
Definition: Game.hpp:39