casse-brick latest
Ce projet est réalisé dans le cadre du cours de Programmation Avancée en M1 Informatique de l'université de Strasbourg.
Loading...
Searching...
No Matches
Ball.h
Go to the documentation of this file.
1//
2// Created by nicolas elfering on 08.05.24.
3//
4
5#ifndef CASSE_BRIQUE_BALL_H
6#define CASSE_BRIQUE_BALL_H
7
8#include <SDL2/SDL.h>
9#include <SDL_image.h>
10#include <SDL2/SDL_timer.h>
11
12#include <memory>
13#include "CollidingObject.h"
14
20class Ball : public MovingObject {
21public:
33 Ball(int x, int y, int radius, const SDL_Color &color, const std::string& id);
34
42 void render(std::shared_ptr<SDL_Renderer> renderer, SDL_Color color1, SDL_Color color2) override;
43
47 void move() override;
48
55 void setVelocity(float dx, float dy);
56
62 void handleCollisions(point collision) override;
63
69 void handleCollision(point vect);
70};
71
72
73
74#endif //CASSE_BRIQUE_BALL_H
The Ball class represents a ball object in the game.
Definition Ball.h:20
int bounce_number
Definition Ball.h:23
void move() override
Moves the ball according to its velocity.
Definition Ball.cpp:17
void render(std::shared_ptr< SDL_Renderer > renderer, SDL_Color color1, SDL_Color color2) override
Renders the ball on the screen.
Definition Ball.cpp:13
point Velocity
Definition Ball.h:22
void handleCollision(point vect)
Handles collision with a single object.
Definition Ball.cpp:46
void setVelocity(float dx, float dy)
Sets the velocity of the ball.
Definition Ball.cpp:21
void handleCollisions(point collision) override
Handles collisions with other objects.
Definition Ball.cpp:25
The MovingObject class represents a moving colliding object.
The point struct represents a point in 2D space.