Full screen gui
This commit is contained in:
parent
66d0c1218f
commit
5aa2961604
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -1663,6 +1663,7 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
"clap",
|
||||||
"eframe",
|
"eframe",
|
||||||
"egui",
|
"egui",
|
||||||
"futures",
|
"futures",
|
||||||
|
|||||||
@ -6,8 +6,8 @@ git pull
|
|||||||
qjackctl /start-server &
|
qjackctl /start-server &
|
||||||
JACK_PID=$!
|
JACK_PID=$!
|
||||||
|
|
||||||
cargo run --release audio_engine &
|
cargo run --release --bin audio_engine &
|
||||||
AUDIO_ENGINE_PID=$!
|
AUDIO_ENGINE_PID=$!
|
||||||
|
|
||||||
cargo run --release gui &
|
cargo run --release --bin gui -- -f&
|
||||||
GUI_PID=$!
|
GUI_PID=$!
|
||||||
@ -9,6 +9,7 @@ path = "src/ui/position_indicator_test.rs"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
|
clap = { version = "4.0", features = ["derive"] }
|
||||||
eframe = { version = "0.29", default-features = true, features = [ "default_fonts", "glow" ] }
|
eframe = { version = "0.29", default-features = true, features = [ "default_fonts", "glow" ] }
|
||||||
egui = "0.29"
|
egui = "0.29"
|
||||||
simple_logger = "5"
|
simple_logger = "5"
|
||||||
|
|||||||
21
gui/src/args.rs
Normal file
21
gui/src/args.rs
Normal 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"))
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
mod args;
|
||||||
mod interpolation;
|
mod interpolation;
|
||||||
mod osc_client;
|
mod osc_client;
|
||||||
mod pendulum;
|
mod pendulum;
|
||||||
@ -26,6 +27,9 @@ impl DisplayStr for osc::TrackState {
|
|||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<()> {
|
||||||
|
// Parse arguments
|
||||||
|
let args = args::Args::new()?;
|
||||||
|
|
||||||
// Configuration
|
// Configuration
|
||||||
let socket_path = "fcb_looper.sock";
|
let socket_path = "fcb_looper.sock";
|
||||||
|
|
||||||
@ -49,10 +53,16 @@ async fn main() -> Result<()> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Run egui on main thread
|
// Run egui on main thread
|
||||||
let options = eframe::NativeOptions {
|
let mut viewport_builder = egui::ViewportBuilder::default()
|
||||||
viewport: egui::ViewportBuilder::default()
|
|
||||||
.with_inner_size([800.0, 600.0])
|
.with_inner_size([800.0, 600.0])
|
||||||
.with_min_inner_size([50.0, 50.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: viewport_builder,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user