Moved header files to source directory; converted easysock to CPP
This commit is contained in:
56
includes/paddle.hpp
Normal file
56
includes/paddle.hpp
Normal file
@@ -0,0 +1,56 @@
|
||||
#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) {
|
||||
this->rectangle = raylib::Rectangle(pos_x, pos_y, width, height);
|
||||
this->initial_pos = raylib::Vector2(pos_x, pos_y);
|
||||
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++;
|
||||
return;
|
||||
}
|
||||
|
||||
void reset() {
|
||||
this->rectangle.x = this->initial_pos.x;
|
||||
this->rectangle.y = this->initial_pos.y;
|
||||
this->velocity = raylib::Vector2(0,0);
|
||||
return;
|
||||
}
|
||||
|
||||
void updatePosition() {
|
||||
this->rectangle.x += this->velocity.x;
|
||||
this->rectangle.y += this->velocity.y;
|
||||
return;
|
||||
}
|
||||
void draw() {
|
||||
this->rectangle.Draw(this->color);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user