pub struct Piece { /* private fields */ }
Implementations§
Source§impl Piece
Trivial getters and setters.
impl Piece
Trivial getters and setters.
pub fn center(&self) -> (f32, f32)
pub fn x(&self) -> f32
pub fn set_x(&mut self, x: f32)
pub fn y(&self) -> f32
pub fn set_y(&mut self, y: f32)
pub fn set_pos(&mut self, x: f32, y: f32)
pub fn angle(&self) -> f32
pub fn set_angle(&mut self, angle: f32)
pub fn side(&self) -> Side
pub fn kind(&self) -> PieceKind
pub fn set_kind(&mut self, kind: PieceKind)
pub fn needs_init(&self) -> bool
Source§impl Piece
Nontrivial piece stuff.
impl Piece
Nontrivial piece stuff.
Sourcepub fn forward_distance(&self) -> f32
pub fn forward_distance(&self) -> f32
The distance from a side’s send in rotchess units.
pub fn collidepoint_generic(x1: f32, y1: f32, x2: f32, y2: f32) -> bool
pub fn collidepoint(&self, x: f32, y: f32) -> bool
Sourcepub fn collidepiece(&self, x: f32, y: f32) -> bool
pub fn collidepiece(&self, x: f32, y: f32) -> bool
Whether a piece with center (x, y) collides with self.
Sourcepub fn on_board(x: f32, y: f32) -> bool
pub fn on_board(x: f32, y: f32) -> bool
Whether a piece with center (x, y) is on the board.
TODO: this probably should be in a board struct. we might want to move Pieces and Board into the same struct?
Sourcepub fn should_promote(kind: PieceKind, side: Side, y: f32) -> bool
pub fn should_promote(kind: PieceKind, side: Side, y: f32) -> bool
Whether a piece with given characteristics should promote.
TODO: like on_board, this should probably be in a board struct.
pub fn capture_points_unchecked(&self) -> impl Iterator<Item = &(f32, f32)>
pub fn move_points_unchecked(&self) -> impl Iterator<Item = &(f32, f32)>
pub fn init_auxiliary_data(&mut self)
pub fn update_capmove_points_unchecked(&mut self)
Sourcepub fn update_capture_points_unchecked(&mut self)
pub fn update_capture_points_unchecked(&mut self)
Update self’s capture points with the drawable DistancesAngles.
Sourcepub fn update_move_points_unchecked(&mut self)
pub fn update_move_points_unchecked(&mut self)
Update self’s move points with the drawable DistancesAngles.
Trait Implementations§
impl Eq for Piece
Auto Trait Implementations§
impl Freeze for Piece
impl RefUnwindSafe for Piece
impl Send for Piece
impl Sync for Piece
impl Unpin for Piece
impl UnwindSafe for Piece
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