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.
41 lines
880 B
C++
41 lines
880 B
C++
10 months ago
|
#include "includes/raylib-cpp/raylib-cpp.hpp"
|
||
|
#include "includes/paddle.hpp"
|
||
|
|
||
|
Paddle::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 Paddle::getRect() {
|
||
|
return this->rectangle;
|
||
|
}
|
||
|
|
||
|
int Paddle::getPoints() {
|
||
|
return points;
|
||
|
}
|
||
|
void Paddle::incrementPoints() {
|
||
|
points++;
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
void Paddle::reset() {
|
||
|
this->rectangle.x = this->initial_pos.x;
|
||
|
this->rectangle.y = this->initial_pos.y;
|
||
|
this->velocity = raylib::Vector2(0,0);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
void Paddle::updatePosition() {
|
||
|
this->rectangle.x += this->velocity.x;
|
||
|
this->rectangle.y += this->velocity.y;
|
||
|
return;
|
||
|
}
|
||
|
void Paddle::draw() {
|
||
|
this->rectangle.Draw(this->color);
|
||
|
return;
|
||
|
}
|