Matrix/src/cell.rs

27 lines
523 B
Rust
Raw Normal View History

2024-05-07 07:56:02 +00:00
use crate::BRIGHTNESS;
use crate::HEIGHT;
use crate::Q;
use crate::WIDTH;
pub struct Cell {
pub x: u32,
pub y: u32,
pub state: u32,
}
pub fn init_grid() -> Vec<Vec<Cell>> {
let mut grid: Vec<Vec<Cell>> = Vec::new();
for j in 0..HEIGHT {
let mut row: Vec<Cell> = Vec::new();
for i in 0..WIDTH {
row.push(Cell {
x: i,
y: j,
state: 0,
});
}
grid.push(row);
}
grid
}