Display current score
This commit is contained in:
parent
37af2957c4
commit
9a07457565
2 changed files with 15 additions and 0 deletions
12
src/board.rs
12
src/board.rs
|
|
@ -89,6 +89,18 @@ impl Board {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn render(&self, number_renderer: &NumberRenderer, c: &Context, gl: &mut Gl) {
|
pub fn render(&self, number_renderer: &NumberRenderer, c: &Context, gl: &mut Gl) {
|
||||||
|
c.view()
|
||||||
|
.rect(settings::BEST_RECT[0],
|
||||||
|
settings::BEST_RECT[1],
|
||||||
|
settings::BEST_RECT[2],
|
||||||
|
settings::BEST_RECT[3])
|
||||||
|
.rgba(settings::LABEL_COLOR[0],
|
||||||
|
settings::LABEL_COLOR[1],
|
||||||
|
settings::LABEL_COLOR[2],
|
||||||
|
settings::LABEL_COLOR[3])
|
||||||
|
.fill(gl);
|
||||||
|
number_renderer.render(self.score as u32, settings::BEST_RECT[0] + settings::BEST_RECT[2] / 2.0, settings::BEST_RECT[1] + settings::BEST_RECT[3] / 2.0, settings::BEST_RECT[2], settings::TEXT_LIGHT_COLOR, c, gl);
|
||||||
|
|
||||||
self.render_board(c, gl);
|
self.render_board(c, gl);
|
||||||
self.render_tiles(number_renderer, c, gl);
|
self.render_tiles(number_renderer, c, gl);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,9 @@ pub static TILE_MOVE_TIME: f64 = 0.1;
|
||||||
pub static TILE_NEW_TIME: f64 = 0.1;
|
pub static TILE_NEW_TIME: f64 = 0.1;
|
||||||
pub static TILE_COMBINE_TIME: f64 = 0.1;
|
pub static TILE_COMBINE_TIME: f64 = 0.1;
|
||||||
|
|
||||||
|
pub static BEST_RECT: [f64, ..4] = [284.0, BOARD_PADDING, 96.0, 48.0];
|
||||||
|
pub static SCORE_RECT: [f64, ..4] = [284.0 - 96.0 - BOARD_PADDING, BOARD_PADDING, 96.0, 48.0];
|
||||||
|
|
||||||
pub static LABEL_COLOR: [f32, ..4] = [187.0 / 255.0, 173.0 / 255.0, 160.0 / 255.0, 1.0];
|
pub static LABEL_COLOR: [f32, ..4] = [187.0 / 255.0, 173.0 / 255.0, 160.0 / 255.0, 1.0];
|
||||||
pub static BUTTON_COLOR: [f32, ..4] = [142.0 / 255.0, 122.0 / 255.0, 102.0 / 255.0, 1.0];
|
pub static BUTTON_COLOR: [f32, ..4] = [142.0 / 255.0, 122.0 / 255.0, 102.0 / 255.0, 1.0];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue