fix the sim score plugin

This commit is contained in:
Dustin Carlino 2018-12-12 10:43:06 -08:00
parent 0cbc2e5d7e
commit 3c710c2e8a
3 changed files with 10 additions and 4 deletions

View File

@ -105,8 +105,10 @@ impl GUI<RenderingHints> for UI {
if let Some(p) = self.get_active_plugin() {
p.draw(g, &mut ctx);
} else {
// If no other mode was active, give the ambient plugins in ViewMode a chance.
// If no other mode was active, give the ambient plugins in ViewMode and SimMode a
// chance.
self.primary_plugins.view_mode().draw(g, &mut ctx);
self.plugins.sim_mode().draw(g, &mut ctx);
}
self.canvas.draw_text(g, hints.osd, BOTTOM_LEFT);
@ -216,6 +218,10 @@ impl PluginsPerUI {
fn edit_mode(&self) -> &EditMode {
self.list[0].downcast_ref::<EditMode>().unwrap()
}
fn sim_mode(&self) -> &Box<Plugin> {
&self.list[1]
}
}
impl UI {

View File

@ -40,7 +40,7 @@ impl LogScroller {
pub fn event(&mut self, input: &mut UserInput) -> bool {
let ev = input.use_event_directly().clone();
if let Some(Button::Keyboard(Key::Escape)) = ev.press_args() {
if let Some(Button::Keyboard(Key::Return)) = ev.press_args() {
return true;
}

View File

@ -15,7 +15,7 @@ pub const LINE_HEIGHT: f64 = 22.0;
// TODO Totally made up. Should query the font or something.
const MAX_CHAR_WIDTH: f64 = 25.0;
#[derive(Clone)]
#[derive(Debug, Clone)]
struct TextSpan {
text: String,
fg_color: Color,
@ -35,7 +35,7 @@ impl TextSpan {
}
// TODO parse style from markup tags
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct Text {
lines: Vec<Vec<TextSpan>>,
bg_color: Color,