From 61c757f2499d79efe4066ca2d8c1ff7827604543 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Fri, 29 Oct 2021 22:18:43 +0300 Subject: refactor!: separate rendering functionality --- src/buffer.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/buffer.rs (limited to 'src/buffer.rs') diff --git a/src/buffer.rs b/src/buffer.rs new file mode 100644 index 0000000..a2c5708 --- /dev/null +++ b/src/buffer.rs @@ -0,0 +1,16 @@ +#[derive(Debug, Clone)] +pub struct Buffer { + pub width: f32, + pub height: f32, + pub palette: Vec, +} + +impl Buffer { + pub fn from_height(height: f32, aspect_ratio: f32) -> Self { + Self { + height, + width: height * aspect_ratio, + palette: "$@B%8&WM#oahkbdpqwmZO0QLCJUYXzcvunxrjft/\\|()1{}[]?-_+~<>i!lI;:,\"^`'. ".chars().collect(), + } + } +} -- cgit v1.2.3