Starting to work on motion through acceleration

This commit is contained in:
2018-10-10 14:24:43 +02:00
parent 467aed4374
commit c80e5286a5
4 changed files with 33 additions and 13 deletions
+5 -11
View File
@@ -6,7 +6,10 @@ use sfml::graphics::{
use engine::texture::Texture;
use engine::renderer::Drawable;
use engine::math::Matrix;
use engine::math::{
Matrix,
clamp,
};
/// This enum represents if the collision happens on the X axis or the Y axis.
#[derive(Copy, Clone)]
@@ -506,13 +509,4 @@ pub fn overlap(box1: FloatRect, box2: FloatRect) -> bool {
box2.top + box2.height > box1.top
}
/// Clamp a number between two boundaries.
pub fn clamp(number: f32, min: f32, max: f32) -> f32 {
if number < min {
min
} else if number > max {
max
} else {
number
}
}