Crates.io | lifers-raylib |
lib.rs | lifers-raylib |
version | 0.2.0 |
source | src |
created_at | 2024-06-01 18:26:32.759528 |
updated_at | 2024-07-10 17:06:33.834496 |
description | Raylib frontend for lifers |
homepage | |
repository | https://github.com/Froloket64/lifers-raylib.git |
max_upload_size | |
id | 1258809 |
size | 47,546 |
Raylib frontend for lifers
.
To use this frontend, simply create a cell type:
// Simple Game of Life-like cell
struct Cell {
is_alive: bool
}
Your cells don't have to be this simple, they can have many attributes (type, group, etc.).
Now just implement RenderCell<Color>
for it:
use raylib::color::Color;
use lifers::frontend::RenderCell;
impl RenderCell<Color> for Cell {
fn render_cell(&self) -> Color {
if cell.is_alive {
Color::WHITE
} else {
Color::BLACK
}
}
}
Then you can use it to create an Automaton
and pass it to RaylibFrontend
(or use FrontendBuilder
).