Starting to work on motion through acceleration
This commit is contained in:
+5
-11
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user