Ran cargo fmt, clippy fixes, suppressed some warns
I will start working on stack traces tonight and tomorrow. We need to be able to 'unwind' by finding calling functions.
This commit is contained in:
@@ -11,20 +11,31 @@ pub struct Frame<'f> {
|
||||
impl<'a> Frame<'a> {
|
||||
pub fn new(window: &'a Window) -> Self {
|
||||
Self {
|
||||
data: vec![vec![Colour::Black; window.dimensions().x()]; window.dimensions().y()],
|
||||
data: vec![
|
||||
vec![Colour::Black; window.dimensions().x()];
|
||||
window.dimensions().y()
|
||||
],
|
||||
window,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn render(&self) -> Result<(), RenderError> {
|
||||
let data: Vec<&[Colour]> = self.data.iter().map(|v| v.as_slice()).collect::<Vec<_>>();
|
||||
let data: Vec<&[Colour]> =
|
||||
self.data.iter().map(|v| v.as_slice()).collect::<Vec<_>>();
|
||||
self.window
|
||||
.render(data.as_slice())
|
||||
.map_err(|_| RenderError::Generic)
|
||||
}
|
||||
|
||||
pub fn write_pixel(&mut self, x: usize, y: usize, color: Colour) -> Result<(), RenderError> {
|
||||
if x >= self.window.dimensions().x() || y >= self.window.dimensions().y() {
|
||||
pub fn write_pixel(
|
||||
&mut self,
|
||||
x: usize,
|
||||
y: usize,
|
||||
color: Colour,
|
||||
) -> Result<(), RenderError> {
|
||||
if x >= self.window.dimensions().x()
|
||||
|| y >= self.window.dimensions().y()
|
||||
{
|
||||
return Err(RenderError::Generic);
|
||||
}
|
||||
self.data[y][x] = color;
|
||||
|
||||
Reference in New Issue
Block a user