From 70514416c2ade2abe628efbd0a629a66febdeb13 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Tue, 6 Dec 2022 19:30:03 +0100 Subject: minor stuff, store translation as i8 --- evc/src/frame.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'evc/src/frame.rs') diff --git a/evc/src/frame.rs b/evc/src/frame.rs index 81390a2..3c40a3d 100644 --- a/evc/src/frame.rs +++ b/evc/src/frame.rs @@ -49,6 +49,11 @@ impl Frame { pub fn view_area_mut<'a>(&'a mut self, offset: Vec2, size: Vec2) -> View<&'a mut Frame> { View::new(self, offset, size) } + pub fn set(&mut self, pos: Vec2, color: Pixel) { + if pos.x >= 0 && pos.y >= 0 && pos.x < self.size.x && pos.y < self.size.y { + self[pos] = color + } + } } impl Index for Frame { -- cgit v1.2.3-70-g09d2