Draft first working version of iced_glow 🎉

This commit is contained in:
Héctor Ramón Jiménez 2020-05-19 14:23:28 +02:00
parent 33448508a5
commit d4743183d4
51 changed files with 3212 additions and 42 deletions

33
glow/src/viewport.rs Normal file
View file

@ -0,0 +1,33 @@
use crate::Transformation;
/// A viewing region for displaying computer graphics.
#[derive(Debug)]
pub struct Viewport {
width: u32,
height: u32,
transformation: Transformation,
}
impl Viewport {
/// Creates a new [`Viewport`] with the given dimensions.
pub fn new(width: u32, height: u32) -> Viewport {
Viewport {
width,
height,
transformation: Transformation::orthographic(width, height),
}
}
pub fn height(&self) -> u32 {
self.height
}
/// Returns the dimensions of the [`Viewport`].
pub fn dimensions(&self) -> (u32, u32) {
(self.width, self.height)
}
pub(crate) fn transformation(&self) -> Transformation {
self.transformation
}
}