const float BALL_SPEED
Definition: Ball.h:12
const int BALL_WIDTH
Definition: Ball.h:10
const int BALL_HEIGHT
Definition: Ball.h:11
Represents Ball in the game.
Definition: Ball.h:16
void CollideWithWall(Contact const &contact)
This method wil check for collision with the wall and change the ball's position and velocity accordi...
Definition: Ball.cpp:93
void FlipDirectionX()
This method will change the Ball's x direction direction.
Definition: Ball.cpp:121
void CollideWithPaddle(Contact const &contact)
This method wil check for collision with paddle and change the ball's position and velocity according...
Definition: Ball.cpp:43
Ball(Vec2 position, Vec2 velocity, int WINDOW_HEIGHT, int WINDOW_WIDTH, SDL_Renderer *ren)
The constructor of ball class that will take in the initial ball position, velocity along with window...
Definition: Ball.cpp:4
Contact CheckWallCollision()
This method wil check for collision with the wall and return which wall was hit.
Definition: Ball.cpp:60
Vec2 position
The Vec2 object to hold the position for the ball.
Definition: Ball.h:72
SDL_Texture * texture
The texture of the ball.
Definition: Ball.h:116
int WINDOW_WIDTH
The width of the window.
Definition: Ball.h:104
SDL_Surface * spriteSheet
The spritesheet of the Ball.
Definition: Ball.h:112
void Update(float dt)
This method will update the position of the ball based on the time passed i.e.
Definition: Ball.cpp:38
Vec2 defaultPosition
The Vec2 object to hold the initial position of the ball so we can use it to reset it.
Definition: Ball.h:80
Vec2 defaultVelocity
The Vec2 object to hold the initial velocity of the ball so we can use it to reset it.
Definition: Ball.h:84
void Draw()
This method will draw/ render the ball to the screen.
Definition: Ball.cpp:30
int WINDOW_HEIGHT
The height of the window.
Definition: Ball.h:100
void Reset()
This method will reset the ball to it's original position.
Definition: Ball.cpp:110
SDL_Renderer * renderer
The renderer object to store the pointer to the to actual renderer of the game loop.
Definition: Ball.h:108
Vec2 velocity
The Vec2 object to hold the velocity of the ball.
Definition: Ball.h:76
void FlipDirectionY()
This method will change the Ball's y direction direction.
Definition: Ball.cpp:126
ResourceManager resourceManager
The resource manager instance to load and unload resources.
Definition: Ball.h:68
SDL_Rect rect
The rect object to render the the ball on screnn.
Definition: Ball.h:96
int width
The variable to hold the width of the ball.
Definition: Ball.h:92
int height
Variable to hold the height of the ball.
Definition: Ball.h:88
The resource manager is responsible for handling and managing resources regarding the game.
Definition: ResourceManager.h:12
static ResourceManager & getInstance()
Method used to get instance of ResourceManager class.
Definition: ResourceManager.cpp:10
Vec2 will abstract X&Y position for ball and paddle.
Definition: Vec2.h:6