[][src]Struct mief::elements::scoreboard::Scoreboard

pub struct Scoreboard {
    title: String,
    height: u32,
    width: u32,
    scores: [isize; 2],
}

The scoreboard displays information on the game, such as the current score and the name.

Fields

title: String

The name of the game.

height: u32

The height of the scoreboard.

width: u32

The width of the scoreboard.

scores: [isize; 2]

The players' scores.

Methods

impl Scoreboard[src]

pub fn new(size: [u32; 2], title: &str) -> Scoreboard[src]

Initialize a new scoreboard with a given size ([width, height]) and a title.

fn determine_font_size(&self) -> u32[src]

Determine the font size based on the height of the scoreboard.

fn draw_text(
    &self,
    text: &str,
    alignment: &TextAlignment,
    position_x: f64,
    font: &mut Glyphs,
    context: &Context,
    graphics: &mut G2d
)
[src]

Draw the given text aligned at position_x on the screen. The text is always vertically aligned at the middle of the scoreboard.

pub fn on_render(&self, font: &mut Glyphs, context: Context, graphics: &mut G2d)[src]

Render the scoreboard.

pub fn on_resize(&mut self, new_width: u32, new_height: u32)[src]

Resize the scoreboard.

pub fn on_update(&mut self, scores: [isize; 2])[src]

Update the scoreboard.