Breakout
Public Member Functions | Public Attributes | List of all members
Paddle Class Reference

Represents Paddle in the game. More...

#include <Paddle.h>

Collaboration diagram for Paddle:
Collaboration graph
[legend]

Public Member Functions

 Paddle (Vec2 position, Vec2 velocity, SDL_Renderer *renderer)
 The constructor of the Paddle class that takes in initial position and velocity along with renderer as arguments. More...
 
void Draw ()
 This Method helps the paddle to be rendered on the screen. More...
 
Contact checkCollision (Ball const &ball)
 This Method checks the collision of Paddle with ball and returns where the ball hit the paddle. More...
 
void Reset ()
 This method will reset the padddle to it's inital position and velocity. More...
 
void Update (float dt, int WINDOW_WIDTH)
 This method will update the position of the paddle. More...
 

Public Attributes

Vec2 velocity
 The velocity of the paddle. More...
 

Detailed Description

Represents Paddle in the game.

Constructor & Destructor Documentation

◆ Paddle()

Paddle::Paddle ( Vec2  position,
Vec2  velocity,
SDL_Renderer *  renderer 
)

The constructor of the Paddle class that takes in initial position and velocity along with renderer as arguments.

Parameters
positionThe Vec2 object that represents paddle's initial position
velocityThe Vec2 object that represents paddle's initial velocity
rendererThe renderer to help render the paddle

Member Function Documentation

◆ checkCollision()

Contact Paddle::checkCollision ( Ball const &  ball)

This Method checks the collision of Paddle with ball and returns where the ball hit the paddle.

Parameters
ballThe object of the ball
Returns
The type of contact

◆ Draw()

void Paddle::Draw ( )

This Method helps the paddle to be rendered on the screen.

◆ Reset()

void Paddle::Reset ( )

This method will reset the padddle to it's inital position and velocity.

◆ Update()

void Paddle::Update ( float  dt,
int  WINDOW_WIDTH 
)

This method will update the position of the paddle.

Parameters
dtThe time passed between each frame
WINDOW_WIDTHThe width of the game window

Member Data Documentation

◆ velocity

Vec2 Paddle::velocity

The velocity of the paddle.


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