fp_tui 0.2.2

A very basic tui library
Documentation
use super::{Position, Dimensions};

/// #### Description
/// A basic axis aligned bounding box implementation
///
#[derive(Debug, Clone, Copy)]
pub struct BoundingBox {
    /// #### Description
    /// Position of the bounding box
    ///
    position: Position,

    /// #### Description
    /// Dimensions of the bounding box
    ///
    dimensions: Dimensions
}

impl BoundingBox {
    /// #### Description
    /// Creates a bounding box with a position and dimensions
    ///
    /// #### Arguments
    /// * `position`: [Position] - The position of the bounding box
    /// * `dimensions`: [Dimensions] - The dimensions of the bounding box
    ///
    /// #### Returns
    /// [BoundingBox] - A bounding box with the given position and dimensions
    ///
    pub fn new(position: Position, dimensions: Dimensions) -> Self {
        return Self {position, dimensions};
    }

    /// #### Description
    /// Retrieves the X coordinate of the position of the bounding box
    ///
    /// #### Returns
    /// [u32] - The value of the X coordinate of the bounding box
    ///
    pub fn get_x(&self) -> i32 {
        return self.position.get_x();
    }

    /// #### Description
    /// Sets the X coordinate of the position of the bounding box
    ///
    /// #### Arguments
    /// * `value`: [u32] - The value to set the X coordinate to
    ///
    pub fn set_x(&mut self, value: i32) {
        self.position.set_x(value);
    }

    /// #### Description
    /// Retrieves the Y coordinate of the position of the bounding box
    ///
    /// #### Returns
    /// [u32] - The value of the Y coordinate of the bounding box
    ///
    pub fn get_y(&self) -> i32 {
        return self.position.get_y();
    }

    /// #### Description
    /// Sets the Y coordinate of the position of the bounding box
    ///
    /// #### Arguments
    /// * `value`: [u32] - The value to set the Y coordinate to
    ///
    pub fn set_y(&mut self, value: i32) {
        self.position.set_y(value);
    }

    /// #### Description
    /// Retrieves the width of the dimensions of the bounding box
    ///
    /// #### Returns
    /// [u32] - The value of the width of the bounding box
    ///
    pub fn get_width(&self) -> u32 {
        return self.dimensions.get_width();
    }

    /// #### Description
    /// Sets the width of the dimensions of the bounding box
    ///
    /// #### Arguments
    /// * `value`: [u32] - The value to set the width of the bounding box to
    ///
    pub fn set_width(&mut self, val: u32) {
        self.dimensions.set_width(val);
    }

    /// #### Description
    /// Retrieves the height of the dimensions of the bounding box
    ///
    /// #### Returns
    /// [u32] - The value of the height of the bounding box
    ///
    pub fn get_height(&self) -> u32 {
        return self.dimensions.get_height();
    }

    /// #### Description
    /// Sets the height of the dimensions of the bounding box
    ///
    /// #### Arguments
    /// * `value`: [u32] - The value to set the height of the bounding box to
    ///
    pub fn set_height(&mut self, val: u32) {
        self.dimensions.set_height(val);
    }

    /// #### Description
    /// Retrieves the position of the bounding box
    ///
    /// #### Returns
    /// [Position] - The position of the bounding box
    ///
    pub fn get_position(&self) -> Position {
        return self.position;
    }
}