You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
894 B
C++
48 lines
894 B
C++
#ifndef PADDLE_H
|
|
#define PADDLE_H
|
|
|
|
class Paddle {
|
|
private:
|
|
/* Variables */
|
|
raylib::Rectangle rectangle;
|
|
raylib::Color color;
|
|
int points;
|
|
|
|
public:
|
|
/* Variables */
|
|
raylib::Vector2 velocity; /* This variable is made public to allow easy modification (no need for getters/setters) */
|
|
|
|
/* Functions */
|
|
Paddle(int pos_x, int pos_y, int width, int height) {
|
|
this->rectangle = raylib::Rectangle(pos_x, pos_y, width, height);
|
|
this->color = raylib::Color::White();
|
|
this->velocity = raylib::Vector2(0,0);
|
|
points = 0;
|
|
return;
|
|
}
|
|
|
|
raylib::Rectangle getRect() {
|
|
return this->rectangle;
|
|
}
|
|
|
|
int getPoints() {
|
|
return points;
|
|
}
|
|
void incrementPoints() {
|
|
points++;
|
|
}
|
|
|
|
void updatePosition() {
|
|
this->rectangle.x += this->velocity.x;
|
|
this->rectangle.y += this->velocity.y;
|
|
return;
|
|
}
|
|
void draw() {
|
|
updatePosition();
|
|
this->rectangle.Draw(this->color);
|
|
return;
|
|
}
|
|
};
|
|
|
|
#endif
|