Minor edits
parent
699e62a1c8
commit
f184a40877
|
@ -9,6 +9,7 @@ use nalgebra::{Point2, Vector2};
|
|||
use crate::{RenderInput, RenderState};
|
||||
|
||||
/// Represents a rectangular region inside a sprite.
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub(crate) struct SpriteRect {
|
||||
/// The position of the top-left corner of this rectangle, in fractional units.
|
||||
/// (0.0 is left edge of sprite, 1.0 is right edge)
|
||||
|
@ -19,6 +20,18 @@ pub(crate) struct SpriteRect {
|
|||
pub dim: Vector2<f32>,
|
||||
}
|
||||
|
||||
impl SpriteRect {
|
||||
/// Northeast corner of this rect
|
||||
pub fn ne_corner(&self) -> Point2<f32> {
|
||||
self.pos + Vector2::new(-self.dim.x, self.dim.y) / 2.0
|
||||
}
|
||||
|
||||
/// Southwest corner of this rect
|
||||
pub fn sw_corner(&self) -> Point2<f32> {
|
||||
self.pos + Vector2::new(self.dim.x, -self.dim.y) / 2.0
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) trait UiElement {
|
||||
fn push_to_buffer_child(
|
||||
&self,
|
||||
|
|
Loading…
Reference in New Issue