From 640165d8cc0fa294add666b0f00fbc11ab217390 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Wed, 28 Aug 2019 14:57:47 +0200 Subject: [PATCH] launcher: Color modes --- src/modules/launcher.rs | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/src/modules/launcher.rs b/src/modules/launcher.rs index fcd2721..465e7a1 100644 --- a/src/modules/launcher.rs +++ b/src/modules/launcher.rs @@ -133,15 +133,22 @@ impl Launcher { ) -> Result, ::std::io::Error> { buf.memset(bg); + let x_off = self.font.borrow_mut().auto_draw_text( + &mut buf.subdimensions((0, 0, 1232, 32))?, + bg, + &Color::new(1.0, 1.0, 0.0, 1.0), + "=", + )?.0 + 8; + let x_off = if self.input.len() > 0 { let dim = self.font.borrow_mut().auto_draw_text( - &mut buf.subdimensions((0, 0, 1232, 32))?, + &mut buf.subdimensions((x_off, 0, 1232-x_off, 32))?, bg, &Color::new(1.0, 1.0, 1.0, 1.0), - &self.input, + &self.input[1..], )?; - dim.0 + 16 + x_off + dim.0 + 8 } else { 0 }; @@ -165,12 +172,22 @@ impl Launcher { ) -> Result, ::std::io::Error> { buf.memset(bg); - self.font.borrow_mut().auto_draw_text( + + let x_off = self.font.borrow_mut().auto_draw_text( &mut buf.subdimensions((0, 0, 1232, 32))?, bg, - &Color::new(1.0, 1.0, 1.0, 1.0), - &self.input, - )?; + &Color::new(1.0, 1.0, 0.0, 1.0), + "!", + )?.0 + 8; + + if self.input.len() > 0 { + self.font.borrow_mut().auto_draw_text( + &mut buf.subdimensions((x_off, 0, 1232-x_off, 32))?, + bg, + &Color::new(1.0, 1.0, 1.0, 1.0), + &self.input[1..], + )?; + }; Ok(vec![buf.get_signed_bounds()]) }