rog-aura: adjustment of layouts and key sizes

This commit is contained in:
Luke D. Jones
2022-07-29 15:56:03 +12:00
parent 7abad979c8
commit 6d97ef13a1
12 changed files with 531 additions and 427 deletions

View File

@@ -5,6 +5,7 @@ matches = [
locale = "US" locale = "US"
[[rows]] [[rows]]
height = 0.8
row = [ row = [
'NormalSpacer', 'NormalSpacer',
'FuncSpacer', 'FuncSpacer',
@@ -16,6 +17,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 0.8
row = [ row = [
'Esc', 'Esc',
'FuncSpacer', 'FuncSpacer',
@@ -38,6 +40,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.0
row = [ row = [
'Tilde', 'Tilde',
'N1', 'N1',
@@ -58,6 +61,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.0
row = [ row = [
'Tab', 'Tab',
'Q', 'Q',
@@ -78,6 +82,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.0
row = [ row = [
'Caps', 'Caps',
'A', 'A',
@@ -97,6 +102,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.0
row = [ row = [
'LShift', 'LShift',
'Z', 'Z',
@@ -115,6 +121,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.2
row = [ row = [
'LCtrl', 'LCtrl',
'LFn', 'LFn',
@@ -132,6 +139,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 0.8
row = [ row = [
'ArrowSpacer', 'ArrowSpacer',
'ArrowSpacer', 'ArrowSpacer',

View File

@@ -1,11 +1,11 @@
matches = [ matches = [
'G533', 'G533',
'GU502',
] ]
locale = "US" locale = "US"
[[rows]] [[rows]]
height = 0.8
row = [ row = [
'NormalSpacer', 'NormalSpacer',
'FuncSpacer', 'FuncSpacer',
@@ -17,6 +17,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 0.8
row = [ row = [
'Esc', 'Esc',
'FuncSpacer', 'FuncSpacer',
@@ -38,6 +39,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.0
row = [ row = [
'Tilde', 'Tilde',
'N1', 'N1',
@@ -57,6 +59,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.0
row = [ row = [
'Tab', 'Tab',
'Q', 'Q',
@@ -76,6 +79,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.0
row = [ row = [
'Caps', 'Caps',
'A', 'A',
@@ -94,6 +98,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.0
row = [ row = [
'LShift', 'LShift',
'Z', 'Z',
@@ -112,6 +117,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.0
row = [ row = [
'LCtrlMed', 'LCtrlMed',
'LFn', 'LFn',

View File

@@ -10,6 +10,7 @@ matches = [
locale = "US" locale = "US"
[[rows]] [[rows]]
height = 0.8
row = [ row = [
'NormalSpacer', 'NormalSpacer',
'FuncSpacer', 'FuncSpacer',
@@ -20,6 +21,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 0.8
row = [ row = [
'Esc', 'Esc',
'FuncSpacer', 'FuncSpacer',
@@ -40,6 +42,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.0
row = [ row = [
'Tilde', 'Tilde',
'N1', 'N1',
@@ -58,6 +61,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.0
row = [ row = [
'Tab', 'Tab',
'Q', 'Q',
@@ -76,6 +80,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.0
row = [ row = [
'Caps', 'Caps',
'A', 'A',
@@ -93,6 +98,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.0
row = [ row = [
'LShift', 'LShift',
'Z', 'Z',
@@ -109,6 +115,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.2
row = [ row = [
'LCtrl', 'LCtrl',
'LFn', 'LFn',
@@ -124,6 +131,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 0.8
row = [ row = [
'FuncSpacer', 'FuncSpacer',
'FuncSpacer', 'FuncSpacer',

View File

@@ -5,6 +5,7 @@ matches = [
locale = "US" locale = "US"
[[rows]] [[rows]]
height = 0.8
row = [ row = [
'NormalSpacer', 'NormalSpacer',
'FuncSpacer', 'FuncSpacer',
@@ -15,6 +16,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 0.8
row = [ row = [
'Esc', 'Esc',
'FuncSpacer', 'FuncSpacer',
@@ -39,6 +41,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.0
row = [ row = [
'Tilde', 'Tilde',
'N1', 'N1',
@@ -61,6 +64,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.0
row = [ row = [
'Tab', 'Tab',
'Q', 'Q',
@@ -83,6 +87,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.0
row = [ row = [
'Caps', 'Caps',
'A', 'A',
@@ -104,6 +109,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.0
row = [ row = [
'LShift', 'LShift',
'Z', 'Z',
@@ -124,8 +130,9 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.0
row = [ row = [
'LCtrlMed', 'LCtrl',
'LFn', 'LFn',
'Meta', 'Meta',
'LAlt', 'LAlt',
@@ -141,6 +148,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.0
row = [ row = [
'FuncSpacer', 'FuncSpacer',
'FuncSpacer', 'FuncSpacer',

View File

@@ -6,6 +6,7 @@ matches = [
locale = "US" locale = "US"
[[rows]] [[rows]]
height = 0.8
row = [ row = [
'NormalSpacer', 'NormalSpacer',
'FuncSpacer', 'FuncSpacer',
@@ -16,6 +17,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 0.8
row = [ row = [
'Esc', 'Esc',
'FuncSpacer', 'FuncSpacer',
@@ -38,6 +40,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.0
row = [ row = [
'Tilde', 'Tilde',
'N1', 'N1',
@@ -60,6 +63,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.0
row = [ row = [
'Tab', 'Tab',
'Q', 'Q',
@@ -80,6 +84,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.0
row = [ row = [
'Caps', 'Caps',
'A', 'A',
@@ -101,6 +106,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.0
row = [ row = [
'LShift', 'LShift',
'Z', 'Z',
@@ -121,6 +127,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 1.2
row = [ row = [
'LCtrl', 'LCtrl',
'LFn', 'LFn',
@@ -142,6 +149,7 @@ row = [
] ]
[[rows]] [[rows]]
height = 0.8
row = [ row = [
'FuncSpacer', 'FuncSpacer',
'FuncSpacer', 'FuncSpacer',

View File

@@ -193,7 +193,7 @@ pub enum KeyShape {
} }
impl KeyShape { impl KeyShape {
pub const fn ux(&self) -> f32 { pub const fn width(&self) -> f32 {
match self { match self {
Self::Tilde => 0.8, Self::Tilde => 0.8,
Self::Normal => 1.0, Self::Normal => 1.0,
@@ -208,7 +208,7 @@ impl KeyShape {
Self::LShift => 2.0, Self::LShift => 2.0,
Self::LShift3 => 0.67, Self::LShift3 => 0.67,
Self::RShift => 2.8, Self::RShift => 2.8,
Self::RshiftSmall => 1.7, Self::RshiftSmall => 1.8,
Self::RShift3 => 0.93, Self::RShift3 => 0.93,
Self::Return => 2.2, Self::Return => 2.2,
Self::Return3 => 0.7333, Self::Return3 => 0.7333,
@@ -223,17 +223,6 @@ impl KeyShape {
Self::RowEndSpacer => 0.1, Self::RowEndSpacer => 0.1,
} }
} }
pub const fn uy(&self) -> f32 {
match self {
Self::Func => 0.8,
Self::RowEndSpacer => 0.1,
Self::FuncBlank => 0.8,
Self::FuncSpacer => 0.8,
Self::Arrow | Self::ArrowBlank | Self::ArrowSpacer => 0.6,
Self::ArrowSplit | Self::ArrowSplitBlank | Self::ArrowSplitSpacer => 5.0,
_ => 1.0,
}
}
/// A blank is used to space keys out in GUI's and can be used or ignored /// A blank is used to space keys out in GUI's and can be used or ignored
/// depednign on the per-key effect /// depednign on the per-key effect

View File

@@ -8,7 +8,9 @@ impl KeyLayout {
matches: vec!["G513".into()], matches: vec!["G513".into()],
locale: "US".to_string(), locale: "US".to_string(),
rows: vec![ rows: vec![
KeyRow::new(vec![ KeyRow::new(
0.8,
vec![
Key::NormalSpacer, Key::NormalSpacer,
Key::FuncSpacer, Key::FuncSpacer,
Key::VolDown, Key::VolDown,
@@ -16,8 +18,11 @@ impl KeyLayout {
Key::MicMute, Key::MicMute,
Key::Fan, Key::Fan,
Key::Rog, Key::Rog,
]), ],
KeyRow::new(vec![ ),
KeyRow::new(
0.8,
vec![
Key::Esc, Key::Esc,
Key::FuncSpacer, Key::FuncSpacer,
Key::F1, Key::F1,
@@ -36,8 +41,11 @@ impl KeyLayout {
Key::F12, Key::F12,
Key::RowEndSpacer, Key::RowEndSpacer,
Key::Del, Key::Del,
]), ],
KeyRow::new(vec![ ),
KeyRow::new(
1.0,
vec![
Key::Tilde, Key::Tilde,
Key::N1, Key::N1,
Key::N2, Key::N2,
@@ -54,8 +62,11 @@ impl KeyLayout {
Key::BkSpc, Key::BkSpc,
Key::RowEndSpacer, Key::RowEndSpacer,
Key::Home, Key::Home,
]), ],
KeyRow::new(vec![ ),
KeyRow::new(
1.0,
vec![
Key::Tab, Key::Tab,
Key::Q, Key::Q,
Key::W, Key::W,
@@ -72,8 +83,11 @@ impl KeyLayout {
Key::BackSlash, Key::BackSlash,
Key::RowEndSpacer, Key::RowEndSpacer,
Key::PgUp, Key::PgUp,
]), ],
KeyRow::new(vec![ ),
KeyRow::new(
1.0,
vec![
Key::Caps, Key::Caps,
Key::A, Key::A,
Key::S, Key::S,
@@ -89,8 +103,11 @@ impl KeyLayout {
Key::Return, Key::Return,
Key::RowEndSpacer, Key::RowEndSpacer,
Key::PgDn, Key::PgDn,
]), ],
KeyRow::new(vec![ ),
KeyRow::new(
1.0,
vec![
Key::LShift, Key::LShift,
Key::Z, Key::Z,
Key::X, Key::X,
@@ -105,8 +122,11 @@ impl KeyLayout {
Key::Rshift, Key::Rshift,
Key::RowEndSpacer, Key::RowEndSpacer,
Key::End, Key::End,
]), ],
KeyRow::new(vec![ ),
KeyRow::new(
1.0,
vec![
Key::LCtrl, Key::LCtrl,
Key::LFn, Key::LFn,
Key::Meta, Key::Meta,
@@ -120,8 +140,11 @@ impl KeyLayout {
Key::ArrowSpacer, Key::ArrowSpacer,
Key::RowEndSpacer, Key::RowEndSpacer,
Key::RFn, Key::RFn,
]), ],
KeyRow::new(vec![ ),
KeyRow::new(
1.0,
vec![
Key::ArrowSpacer, Key::ArrowSpacer,
Key::ArrowSpacer, Key::ArrowSpacer,
Key::ArrowSpacer, Key::ArrowSpacer,
@@ -139,7 +162,8 @@ impl KeyLayout {
Key::Down, Key::Down,
Key::Right, Key::Right,
Key::ArrowSpacer, Key::ArrowSpacer,
]), ],
),
], ],
} }
} }

View File

@@ -7,15 +7,20 @@ impl KeyLayout {
matches: vec!["GA401".into(), "GA402".into()], matches: vec!["GA401".into(), "GA402".into()],
locale: "US".to_string(), locale: "US".to_string(),
rows: vec![ rows: vec![
KeyRow::new(vec![ KeyRow::new(
0.8,
vec![
Key::NormalSpacer, Key::NormalSpacer,
Key::FuncSpacer, Key::FuncSpacer,
Key::VolDown, Key::VolDown,
Key::VolUp, Key::VolUp,
Key::MicMute, Key::MicMute,
Key::Rog, Key::Rog,
]), ],
KeyRow::new(vec![ ),
KeyRow::new(
0.8,
vec![
Key::Esc, Key::Esc,
Key::FuncSpacer, Key::FuncSpacer,
Key::F1, Key::F1,
@@ -32,8 +37,11 @@ impl KeyLayout {
Key::F10, Key::F10,
Key::F11, Key::F11,
Key::F12, Key::F12,
]), ],
KeyRow::new(vec![ ),
KeyRow::new(
1.0,
vec![
Key::Tilde, Key::Tilde,
Key::N1, Key::N1,
Key::N2, Key::N2,
@@ -48,8 +56,11 @@ impl KeyLayout {
Key::Hyphen, Key::Hyphen,
Key::Equals, Key::Equals,
Key::BkSpc, Key::BkSpc,
]), ],
KeyRow::new(vec![ ),
KeyRow::new(
1.0,
vec![
Key::Tab, Key::Tab,
Key::Q, Key::Q,
Key::W, Key::W,
@@ -64,8 +75,11 @@ impl KeyLayout {
Key::LBracket, Key::LBracket,
Key::RBracket, Key::RBracket,
Key::BackSlash, Key::BackSlash,
]), ],
KeyRow::new(vec![ ),
KeyRow::new(
1.0,
vec![
Key::Caps, Key::Caps,
Key::A, Key::A,
Key::S, Key::S,
@@ -79,8 +93,11 @@ impl KeyLayout {
Key::SemiColon, Key::SemiColon,
Key::Quote, Key::Quote,
Key::Return, Key::Return,
]), ],
KeyRow::new(vec![ ),
KeyRow::new(
1.0,
vec![
Key::LShift, Key::LShift,
Key::Z, Key::Z,
Key::X, Key::X,
@@ -93,8 +110,11 @@ impl KeyLayout {
Key::Period, Key::Period,
Key::FwdSlash, Key::FwdSlash,
Key::Rshift, Key::Rshift,
]), ],
KeyRow::new(vec![ ),
KeyRow::new(
1.0,
vec![
Key::LCtrl, Key::LCtrl,
Key::LFn, Key::LFn,
Key::Meta, Key::Meta,
@@ -106,8 +126,11 @@ impl KeyLayout {
Key::ArrowSpacer, Key::ArrowSpacer,
Key::Up, Key::Up,
Key::ArrowSpacer, Key::ArrowSpacer,
]), ],
KeyRow::new(vec![ ),
KeyRow::new(
1.2,
vec![
Key::ArrowSpacer, Key::ArrowSpacer,
Key::ArrowSpacer, Key::ArrowSpacer,
Key::ArrowSpacer, Key::ArrowSpacer,
@@ -125,7 +148,8 @@ impl KeyLayout {
Key::Down, Key::Down,
Key::Right, Key::Right,
Key::ArrowSpacer, Key::ArrowSpacer,
]), ],
),
], ],
} }
} }

View File

@@ -7,15 +7,20 @@ impl KeyLayout {
matches: vec!["GX502".into(), "GU502".into()], matches: vec!["GX502".into(), "GU502".into()],
locale: "US".to_string(), locale: "US".to_string(),
rows: vec![ rows: vec![
KeyRow::new(vec![ KeyRow::new(
0.8,
vec![
Key::NormalSpacer, Key::NormalSpacer,
Key::FuncSpacer, Key::FuncSpacer,
Key::VolDown, Key::VolDown,
Key::VolUp, Key::VolUp,
Key::MicMute, Key::MicMute,
Key::Rog, Key::Rog,
]), ],
KeyRow::new(vec![ ),
KeyRow::new(
0.8,
vec![
Key::Esc, Key::Esc,
Key::FuncSpacer, Key::FuncSpacer,
Key::F1, Key::F1,
@@ -34,8 +39,11 @@ impl KeyLayout {
Key::F12, Key::F12,
Key::RowEndSpacer, Key::RowEndSpacer,
Key::Del, Key::Del,
]), ],
KeyRow::new(vec![ ),
KeyRow::new(
1.0,
vec![
Key::Tilde, Key::Tilde,
Key::N1, Key::N1,
Key::N2, Key::N2,
@@ -54,8 +62,11 @@ impl KeyLayout {
Key::BkSpc3_3, Key::BkSpc3_3,
Key::RowEndSpacer, Key::RowEndSpacer,
Key::Home, Key::Home,
]), ],
KeyRow::new(vec![ ),
KeyRow::new(
1.0,
vec![
Key::Tab, Key::Tab,
Key::Q, Key::Q,
Key::W, Key::W,
@@ -72,8 +83,11 @@ impl KeyLayout {
Key::BackSlash, Key::BackSlash,
Key::RowEndSpacer, Key::RowEndSpacer,
Key::PgUp, Key::PgUp,
]), ],
KeyRow::new(vec![ ),
KeyRow::new(
1.0,
vec![
Key::Caps, Key::Caps,
Key::A, Key::A,
Key::S, Key::S,
@@ -91,8 +105,11 @@ impl KeyLayout {
Key::Return3_3, Key::Return3_3,
Key::RowEndSpacer, Key::RowEndSpacer,
Key::PgDn, Key::PgDn,
]), ],
KeyRow::new(vec![ ),
KeyRow::new(
1.0,
vec![
Key::LShift, Key::LShift,
Key::Z, Key::Z,
Key::X, Key::X,
@@ -109,8 +126,11 @@ impl KeyLayout {
Key::Rshift3_3, Key::Rshift3_3,
Key::RowEndSpacer, Key::RowEndSpacer,
Key::End, Key::End,
]), ],
KeyRow::new(vec![ ),
KeyRow::new(
1.0,
vec![
Key::LCtrl, Key::LCtrl,
Key::LFn, Key::LFn,
Key::Meta, Key::Meta,
@@ -128,8 +148,11 @@ impl KeyLayout {
Key::ArrowSpacer, Key::ArrowSpacer,
Key::RowEndSpacer, Key::RowEndSpacer,
Key::RFn, Key::RFn,
]), ],
KeyRow::new(vec![ ),
KeyRow::new(
1.0,
vec![
Key::ArrowSpacer, Key::ArrowSpacer,
Key::ArrowSpacer, Key::ArrowSpacer,
Key::ArrowSpacer, Key::ArrowSpacer,
@@ -147,7 +170,8 @@ impl KeyLayout {
Key::Down, Key::Down,
Key::Right, Key::Right,
Key::ArrowSpacer, Key::ArrowSpacer,
]), ],
),
], ],
} }
} }

View File

@@ -50,15 +50,20 @@ impl KeyLayout {
#[derive(Debug, Deserialize, Serialize)] #[derive(Debug, Deserialize, Serialize)]
pub struct KeyRow { pub struct KeyRow {
height: f32,
row: Vec<Key>, row: Vec<Key>,
} }
impl KeyRow { impl KeyRow {
pub fn new(row: Vec<Key>) -> Self { pub fn new(height: f32, row: Vec<Key>) -> Self {
Self { row } Self { height, row }
} }
pub fn row(&self) -> Iter<Key> { pub fn row(&self) -> Iter<Key> {
self.row.iter() self.row.iter()
} }
pub fn height(&self) -> f32 {
self.height
}
} }

View File

@@ -47,7 +47,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut path = PathBuf::from(DATA_DIR); let mut path = PathBuf::from(DATA_DIR);
#[cfg(feature = "mocking")] #[cfg(feature = "mocking")]
{ {
board_name = "G513".to_string(); board_name = "gx502".to_string();
path.pop(); path.pop();
path.push("rog-aura"); path.push("rog-aura");
path.push("data"); path.push("data");

View File

@@ -26,6 +26,7 @@ impl<'a> RogApp<'a> {
ui.spacing_mut().item_spacing = egui::vec2(0.0, 0.0); ui.spacing_mut().item_spacing = egui::vec2(0.0, 0.0);
let mut arrows_done = false; let mut arrows_done = false;
for row in states.keyboard_layout.rows() { for row in states.keyboard_layout.rows() {
let height = row.height();
ui.horizontal_top(|ui| { ui.horizontal_top(|ui| {
for key in row.row() { for key in row.row() {
// your boat // your boat
@@ -38,11 +39,11 @@ impl<'a> RogApp<'a> {
arrows_done = true; arrows_done = true;
} }
} else if shape.is_blank() || shape.is_spacer() { } else if shape.is_blank() || shape.is_spacer() {
blank(ui, shape); blank(ui, shape.width(), height);
} else if shape.is_group() { } else if shape.is_group() {
key_group(ui, colour, shape.ux(), shape.uy()).on_hover_text(label); key_group(ui, colour, shape.width(), height).on_hover_text(label);
} else { } else {
key_shape(ui, colour, shape).on_hover_text(label); key_shape(ui, colour, shape.width(), height).on_hover_text(label);
} }
} }
}); });
@@ -51,9 +52,8 @@ impl<'a> RogApp<'a> {
} }
} }
fn key_shape(ui: &mut egui::Ui, colour: Color32, shape: KeyShape) -> egui::Response { fn key_shape(ui: &mut egui::Ui, colour: Color32, ux: f32, uy: f32) -> egui::Response {
let desired_size = let desired_size = ui.spacing().interact_size.y * egui::vec2(2.0 * ux, 2.0 * uy);
ui.spacing().interact_size.y * egui::vec2(2.0 * shape.ux(), 2.0 * shape.uy());
let (mut rect, mut response) = ui.allocate_exact_size(desired_size, egui::Sense::click()); let (mut rect, mut response) = ui.allocate_exact_size(desired_size, egui::Sense::click());
rect = rect.shrink(3.0); rect = rect.shrink(3.0);
if response.clicked() { if response.clicked() {
@@ -94,32 +94,32 @@ fn key_group(ui: &mut egui::Ui, colour: Color32, ux: f32, uy: f32) -> egui::Resp
response response
} }
fn blank(ui: &mut egui::Ui, shape: KeyShape) { fn blank(ui: &mut egui::Ui, ux: f32, uy: f32) {
let desired_size = let desired_size = ui.spacing().interact_size.y * egui::vec2(2.0 * ux, 2.0 * uy);
ui.spacing().interact_size.y * egui::vec2(2.0 * shape.ux(), 2.0 * shape.uy());
ui.allocate_exact_size(desired_size, egui::Sense::click()); ui.allocate_exact_size(desired_size, egui::Sense::click());
} }
/// Draws entire arrow cluster block. This is visibly different to the split-arrows. /// Draws entire arrow cluster block. This is visibly different to the split-arrows.
fn arrow_cluster(ui: &mut egui::Ui, colour: Color32) { fn arrow_cluster(ui: &mut egui::Ui, colour: Color32) {
let height = 0.7;
let space = KeyShape::ArrowSpacer; let space = KeyShape::ArrowSpacer;
let shape = KeyShape::Arrow; let shape = KeyShape::Arrow;
ui.horizontal_top(|ui| { ui.horizontal_top(|ui| {
ui.with_layout(egui::Layout::top_down(Align::LEFT), |ui| { ui.with_layout(egui::Layout::top_down(Align::LEFT), |ui| {
blank(ui, space); blank(ui, space.width(), height);
ui.horizontal(|ui| { ui.horizontal(|ui| {
blank(ui, KeyShape::RowEndSpacer); blank(ui, KeyShape::RowEndSpacer.width(), height);
blank(ui, KeyShape::RowEndSpacer); blank(ui, KeyShape::RowEndSpacer.width(), height);
key_shape(ui, colour, shape).on_hover_text("Left"); key_shape(ui, colour, shape.width(), height).on_hover_text("Left");
}); });
}); });
ui.with_layout(egui::Layout::top_down(Align::LEFT), |ui| { ui.with_layout(egui::Layout::top_down(Align::LEFT), |ui| {
key_shape(ui, colour, shape).on_hover_text("Up"); key_shape(ui, colour, shape.width(), height).on_hover_text("Up");
key_shape(ui, colour, shape).on_hover_text("Down"); key_shape(ui, colour, shape.width(), height).on_hover_text("Down");
}); });
ui.with_layout(egui::Layout::top_down(Align::LEFT), |ui| { ui.with_layout(egui::Layout::top_down(Align::LEFT), |ui| {
blank(ui, space); blank(ui, space.width(), height);
key_shape(ui, colour, shape).on_hover_text("Right"); key_shape(ui, colour, shape.width(), height).on_hover_text("Right");
}); });
}); });
} }