launcher: Color modes

This commit is contained in:
Kenny Levinsen
2019-08-28 14:57:47 +02:00
parent 70bc9238c5
commit 640165d8cc
+23 -6
View File
@@ -133,15 +133,22 @@ impl Launcher {
) -> Result<Vec<(i32, i32, i32, i32)>, ::std::io::Error> { ) -> Result<Vec<(i32, i32, i32, i32)>, ::std::io::Error> {
buf.memset(bg); buf.memset(bg);
let x_off = if self.input.len() > 0 { let x_off = self.font.borrow_mut().auto_draw_text(
let dim = self.font.borrow_mut().auto_draw_text(
&mut buf.subdimensions((0, 0, 1232, 32))?, &mut buf.subdimensions((0, 0, 1232, 32))?,
bg, 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((x_off, 0, 1232-x_off, 32))?,
bg,
&Color::new(1.0, 1.0, 1.0, 1.0), &Color::new(1.0, 1.0, 1.0, 1.0),
&self.input, &self.input[1..],
)?; )?;
dim.0 + 16 x_off + dim.0 + 8
} else { } else {
0 0
}; };
@@ -165,12 +172,22 @@ impl Launcher {
) -> Result<Vec<(i32, i32, i32, i32)>, ::std::io::Error> { ) -> Result<Vec<(i32, i32, i32, i32)>, ::std::io::Error> {
buf.memset(bg); 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))?, &mut buf.subdimensions((0, 0, 1232, 32))?,
bg, bg,
&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), &Color::new(1.0, 1.0, 1.0, 1.0),
&self.input, &self.input[1..],
)?; )?;
};
Ok(vec![buf.get_signed_bounds()]) Ok(vec![buf.get_signed_bounds()])
} }