Full screen gui

This commit is contained in:
geens 2025-08-12 16:21:14 +02:00
parent 66d0c1218f
commit 5aa2961604
5 changed files with 38 additions and 5 deletions

1
Cargo.lock generated
View File

@ -1663,6 +1663,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"bytes",
"clap",
"eframe",
"egui",
"futures",

View File

@ -6,8 +6,8 @@ git pull
qjackctl /start-server &
JACK_PID=$!
cargo run --release audio_engine &
cargo run --release --bin audio_engine &
AUDIO_ENGINE_PID=$!
cargo run --release gui &
cargo run --release --bin gui -- -f&
GUI_PID=$!

View File

@ -9,6 +9,7 @@ path = "src/ui/position_indicator_test.rs"
[dependencies]
anyhow = "1.0"
clap = { version = "4.0", features = ["derive"] }
eframe = { version = "0.29", default-features = true, features = [ "default_fonts", "glow" ] }
egui = "0.29"
simple_logger = "5"

21
gui/src/args.rs Normal file
View File

@ -0,0 +1,21 @@
use anyhow::Result;
use clap::Parser;
#[derive(Parser)]
#[command(name = "gui")]
#[command(version, about = "FCB1010 Looper Pedal GUI")]
pub struct Args {
/// Launch in full screen mode
#[arg(short = 'f', long = "full-screen")]
pub full_screen: bool,
}
impl Args {
pub fn new() -> Result<Self> {
let res = Self::try_parse();
if let Err(res) = &res {
log::error!("{res}");
}
res.map_err(|_| anyhow::anyhow!("Failed to parse arguments"))
}
}

View File

@ -1,3 +1,4 @@
mod args;
mod interpolation;
mod osc_client;
mod pendulum;
@ -26,6 +27,9 @@ impl DisplayStr for osc::TrackState {
#[tokio::main]
async fn main() -> Result<()> {
// Parse arguments
let args = args::Args::new()?;
// Configuration
let socket_path = "fcb_looper.sock";
@ -49,10 +53,16 @@ async fn main() -> Result<()> {
});
// Run egui on main thread
let mut viewport_builder = egui::ViewportBuilder::default()
.with_inner_size([800.0, 600.0])
.with_min_inner_size([50.0, 50.0]);
if args.full_screen {
viewport_builder = viewport_builder.with_fullscreen(true);
}
let options = eframe::NativeOptions {
viewport: egui::ViewportBuilder::default()
.with_inner_size([800.0, 600.0])
.with_min_inner_size([50.0, 50.0]),
viewport: viewport_builder,
..Default::default()
};