figs/
util.rs

1use std::collections::HashMap;
2
3use crate::entity::Entity;
4
5pub type Pnt = (f32, f32);
6pub type FigResult<T> = Result<T, Box<dyn std::error::Error>>;
7pub type EntityMap = HashMap<String, Entity>;
8
9pub fn pnt_to_buf(pnt: Pnt, width: usize) -> usize {
10    let x = pnt.0.round() as usize;
11    let y = pnt.1.round() as usize;
12
13    return x + y * width;
14}