mirror of
https://github.com/edera-dev/sprout.git
synced 2026-11-04 16:42:20 +00:00
fix(boot): use more of the graphical menu for titles (#122)
This commit is contained in:
2 files changed
+6
-17
No files matched your search
@@ -7,9 +7,6 @@ pub type Glyph = [u8; GLYPH_SIZE];
|
|||||||
/// Three dots, which are drawn where a title is cut off.
|
/// Three dots, which are drawn where a title is cut off.
|
||||||
pub const ELLIPSIS: Glyph = [0x00, 0x00, 0x00, 0x00, 0x00, 0xDB, 0xDB, 0x00];
|
pub const ELLIPSIS: Glyph = [0x00, 0x00, 0x00, 0x00, 0x00, 0xDB, 0xDB, 0x00];
|
||||||
|
|
||||||
/// A heart, which is drawn next to the selected entry.
|
|
||||||
pub const HEART: Glyph = [0x00, 0x66, 0xFF, 0xFF, 0xFF, 0x7E, 0x3C, 0x18];
|
|
||||||
|
|
||||||
/// The glyphs for the printable ASCII characters from space to tilde.
|
/// The glyphs for the printable ASCII characters from space to tilde.
|
||||||
/// This is the public domain 8x8 font that is commonly used by hobby operating systems.
|
/// This is the public domain 8x8 font that is commonly used by hobby operating systems.
|
||||||
const GLYPHS: [Glyph; 95] = [
|
const GLYPHS: [Glyph; 95] = [
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use crate::entries::BootableEntry;
|
use crate::entries::BootableEntry;
|
||||||
use crate::menu::font::{self, ELLIPSIS, GLYPH_SIZE, Glyph, HEART};
|
use crate::menu::font::{self, ELLIPSIS, GLYPH_SIZE, Glyph};
|
||||||
use crate::menu::logo::{LOGO, LOGO_HEIGHT, LOGO_WIDTH};
|
use crate::menu::logo::{LOGO, LOGO_HEIGHT, LOGO_WIDTH};
|
||||||
use crate::menu::{BootMenu, wait_for_events};
|
use crate::menu::{BootMenu, wait_for_events};
|
||||||
use alloc::format;
|
use alloc::format;
|
||||||
@@ -52,7 +52,7 @@ const PANEL_EDGE: BltPixel = BltPixel::new(0x4a, 0x2e, 0x66);
|
|||||||
/// The color of the pill behind the selected entry, taken from the Sprout logo.
|
/// The color of the pill behind the selected entry, taken from the Sprout logo.
|
||||||
const PILL_SELECTED: BltPixel = BltPixel::new(0xff, 0x7a, 0xb8);
|
const PILL_SELECTED: BltPixel = BltPixel::new(0xff, 0x7a, 0xb8);
|
||||||
|
|
||||||
/// The color of the title and the heart.
|
/// The color of the title.
|
||||||
const ACCENT: BltPixel = BltPixel::new(0xff, 0xa6, 0xd0);
|
const ACCENT: BltPixel = BltPixel::new(0xff, 0xa6, 0xd0);
|
||||||
|
|
||||||
/// The color of entries that aren't selected.
|
/// The color of entries that aren't selected.
|
||||||
@@ -265,10 +265,10 @@ impl Layout {
|
|||||||
.max()
|
.max()
|
||||||
.unwrap_or(0);
|
.unwrap_or(0);
|
||||||
let status = HINT.len().max(HINT_MOUSE.len()).max(STATUS_WIDEST.len());
|
let status = HINT.len().max(HINT_MOUSE.len()).max(STATUS_WIDEST.len());
|
||||||
let panel_width = ((longest + 4) * cell + padding * 2)
|
let panel_width = ((longest + 3) * cell + padding * 2)
|
||||||
.max(40 * cell)
|
.max(40 * cell)
|
||||||
.max((status + 8) * cell)
|
.max((status + 8) * cell)
|
||||||
.min(width.saturating_sub(margin * 2).min(width * 3 / 5));
|
.min(width.saturating_sub(margin * 2).min(width * 4 / 5));
|
||||||
|
|
||||||
// The header is as tall as the logo, and the logo needs room to bounce.
|
// The header is as tall as the logo, and the logo needs room to bounce.
|
||||||
let fit = |logo: usize| {
|
let fit = |logo: usize| {
|
||||||
@@ -322,8 +322,8 @@ impl Layout {
|
|||||||
visible,
|
visible,
|
||||||
panel: (panel_x, panel_y, panel_width, panel_height),
|
panel: (panel_x, panel_y, panel_width, panel_height),
|
||||||
radius: cell,
|
radius: cell,
|
||||||
text_x: panel_x + padding + cell * 3,
|
text_x: panel_x + padding + cell,
|
||||||
columns: list_width.saturating_sub(cell * 4) / cell,
|
columns: list_width.saturating_sub(cell * 2) / cell,
|
||||||
footer: list_y + list + cell,
|
footer: list_y + list + cell,
|
||||||
logo: (group_x, top + bounce, logo_width, logo_height),
|
logo: (group_x, top + bounce, logo_width, logo_height),
|
||||||
bounce,
|
bounce,
|
||||||
@@ -736,14 +736,6 @@ fn render(
|
|||||||
layout.height,
|
layout.height,
|
||||||
PILL_SELECTED,
|
PILL_SELECTED,
|
||||||
);
|
);
|
||||||
draw_glyph(
|
|
||||||
fb,
|
|
||||||
layout.x + layout.cell,
|
|
||||||
text_row,
|
|
||||||
layout.scale,
|
|
||||||
&HEART,
|
|
||||||
TEXT_SELECTED,
|
|
||||||
);
|
|
||||||
TEXT_SELECTED
|
TEXT_SELECTED
|
||||||
} else {
|
} else {
|
||||||
TEXT
|
TEXT
|
||||||
|
|||||||
Reference in new issue
Block a user