moving_sprite.cpp: afegit umbral a stopRotate()
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "moving_sprite.h"
|
||||
|
||||
#include <cmath> // Para std::abs
|
||||
#include <utility>
|
||||
|
||||
#include "texture.h" // Para Texture
|
||||
@@ -98,9 +99,11 @@ void MovingSprite::startRotate() {
|
||||
}
|
||||
|
||||
// Detiene la rotación y resetea el ángulo a cero
|
||||
void MovingSprite::stopRotate() {
|
||||
rotate_.enabled = false;
|
||||
rotate_.angle = 0.0;
|
||||
void MovingSprite::stopRotate(float threshold) {
|
||||
if (threshold == 0.0F || std::abs(rotate_.amount) <= threshold) {
|
||||
rotate_.enabled = false;
|
||||
rotate_.angle = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
// Establece la posición y_ el tamaño del objeto
|
||||
|
||||
Reference in New Issue
Block a user