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.
42 lines
917 B
C++
42 lines
917 B
C++
#ifndef PADDLE_H
|
|
#define PADDLE_H
|
|
|
|
class Paddle {
|
|
private:
|
|
/* Variables */
|
|
raylib::Rectangle rectangle;
|
|
raylib::Color color;
|
|
int points;
|
|
raylib::Vector2 initial_pos;
|
|
|
|
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);
|
|
|
|
/* Returns the raylib::Rectangle object of this paddle */
|
|
raylib::Rectangle getRect();
|
|
|
|
/* Returns the number of points that this paddle has earned */
|
|
int getPoints();
|
|
|
|
/* Increments the number of points that this paddle has earned */
|
|
void incrementPoints();
|
|
|
|
/* Sets the paddle position */
|
|
void setPosition(int x, int y);
|
|
|
|
/* Resets the paddle position */
|
|
void reset();
|
|
|
|
/* Update the paddle position, based on its velocity */
|
|
void updatePosition();
|
|
|
|
/* Draw the paddle onto the screen */
|
|
void draw();
|
|
};
|
|
|
|
#endif
|