gemini-engine 1.2.0

A 2D/3D monospaced ASCII rendering engine for the terminal
Documentation
use crate::{
    containers::CanCollide,
    core::{CanDraw, ColChar, Vec2D},
};

/// A singular point with a [`Vec2D`] position and [`ColChar`]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Pixel {
    /// The position of the `Pixel`
    pub pos: Vec2D,
    /// The appearance/colour of the `Pixel`
    pub fill_char: ColChar,
}

impl Pixel {
    /// Create a new `Pixel`
    #[must_use]
    pub const fn new(pos: Vec2D, fill_char: ColChar) -> Self {
        Self { pos, fill_char }
    }
}

impl CanDraw for Pixel {
    fn draw_to(&self, canvas: &mut impl crate::core::Canvas) {
        canvas.plot(self.pos, self.fill_char);
    }
}

impl CanCollide for Pixel {
    fn collides_with_pos(&self, pos: Vec2D) -> bool {
        self.pos == pos
    }
}