[−][src]Struct mief::elements::field::Field
The field where the game actually occurs.
Fields
ball: BallThe ball used for playing.
last_speed_change: f64The Δt since the last speed change.
players: [Player; 2]The players.
height: u32The height of the field.
width: u32The width of the field.
Methods
impl Field[src]
pub fn new(size: [u32; 2]) -> Field[src]
Initialize a new playing field with the given size.
pub fn get_player_scores(&self) -> [isize; 2][src]
Get the scores of all players.
pub fn on_button_pressed(&mut self, button: Button)[src]
Handle button press events.
pub fn on_button_released(&mut self, button: Button)[src]
Handle button release events.
pub fn on_render(&self, context: Context, graphics: &mut G2d)[src]
Draw the field with its contents.
pub fn on_resize(&mut self, new_width: u32, new_height: u32)[src]
Resize the field.
pub fn on_update(&mut self, update_arguments: &UpdateArgs)[src]
Update the field state.
fn update_scores(&mut self, status: BallStatus)[src]
If the ball left the field on the left or right side, the other side's player will get a point.