Initial Commit

This commit is contained in:
2023-03-17 23:33:34 +01:00
commit e22588c2cb
11 changed files with 432 additions and 0 deletions

36
src/layout.rs Normal file
View File

@ -0,0 +1,36 @@
use alloc::vec::Vec;
use serde::{Deserialize, Serialize};
#[derive(Default, Debug, Serialize, Deserialize)]
pub struct Layout {
pub buttons: Vec<Rect>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Rect {
pub x: f32,
pub y: f32,
#[serde(default = "default_width")]
pub w: f32,
#[serde(default = "default_height")]
pub h: f32,
}
impl Default for Rect {
fn default() -> Self {
Self {
x: 0.0,
y: 0.0,
w: default_width(),
h: default_height(),
}
}
}
fn default_width() -> f32 {
1.0
}
fn default_height() -> f32 {
1.0
}