pub struct GridConfig {
pub screen_width: u32,
pub screen_height: u32,
pub grid_cols: u32,
pub grid_rows: u32,
}Expand description
Grid configuration
Fields§
§screen_width: u32Screen width in pixels
screen_height: u32Screen height in pixels
grid_cols: u32Number of grid columns
grid_rows: u32Number of grid rows
Implementations§
Source§impl GridConfig
impl GridConfig
Sourcepub fn cell_width(&self) -> u32
pub fn cell_width(&self) -> u32
Calculate cell width in pixels
Sourcepub fn cell_height(&self) -> u32
pub fn cell_height(&self) -> u32
Calculate cell height in pixels
Sourcepub fn point_to_cell(&self, point: Point) -> (u32, u32)
pub fn point_to_cell(&self, point: Point) -> (u32, u32)
Convert screen coordinates to grid cell
Sourcepub fn cell_to_region(&self, col: u32, row: u32) -> Region
pub fn cell_to_region(&self, col: u32, row: u32) -> Region
Convert grid cell to screen region
Trait Implementations§
Source§impl Clone for GridConfig
impl Clone for GridConfig
Source§fn clone(&self) -> GridConfig
fn clone(&self) -> GridConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GridConfig
impl Debug for GridConfig
Source§impl<'de> Deserialize<'de> for GridConfig
impl<'de> Deserialize<'de> for GridConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for GridConfig
impl Serialize for GridConfig
impl Copy for GridConfig
Auto Trait Implementations§
impl Freeze for GridConfig
impl RefUnwindSafe for GridConfig
impl Send for GridConfig
impl Sync for GridConfig
impl Unpin for GridConfig
impl UnsafeUnpin for GridConfig
impl UnwindSafe for GridConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more