moving_sprite.cpp: afegits nous metodes per controlar la rotació
This commit is contained in:
@@ -90,6 +90,19 @@ void MovingSprite::setRotate(bool enable) {
|
||||
rotate_.enabled = enable;
|
||||
}
|
||||
|
||||
// Habilita la rotación y establece el centro en el centro del sprite
|
||||
void MovingSprite::startRotate() {
|
||||
rotate_.enabled = true;
|
||||
rotate_.center.x = pos_.w / 2.0F;
|
||||
rotate_.center.y = pos_.h / 2.0F;
|
||||
}
|
||||
|
||||
// Detiene la rotación y resetea el ángulo a cero
|
||||
void MovingSprite::stopRotate() {
|
||||
rotate_.enabled = false;
|
||||
rotate_.angle = 0.0;
|
||||
}
|
||||
|
||||
// Establece la posición y_ el tamaño del objeto
|
||||
void MovingSprite::setPos(SDL_FRect rect) {
|
||||
x_ = rect.x;
|
||||
|
||||
Reference in New Issue
Block a user