Skip to main content

nifty_runtime/
geometry.rs

1//! Geometry in logical points, origin top-left, y growing downward.
2
3#[derive(Clone, Copy, Debug, Default, PartialEq)]
4pub struct Size {
5    pub width: f32,
6    pub height: f32,
7}
8
9impl Size {
10    pub const ZERO: Self = Self::new(0.0, 0.0);
11
12    #[must_use]
13    pub const fn new(width: f32, height: f32) -> Self {
14        Self { width, height }
15    }
16}
17
18#[derive(Clone, Copy, Debug, Default, PartialEq)]
19pub struct Point {
20    pub x: f32,
21    pub y: f32,
22}
23
24#[derive(Clone, Copy, Debug, Default, PartialEq)]
25pub struct Frame {
26    pub origin: Point,
27    pub size: Size,
28}