Delay the set_fullscreen
All checks were successful
Build project / Build (push) Successful in 1m44s
All checks were successful
Build project / Build (push) Successful in 1m44s
Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
10
src/main.rs
10
src/main.rs
@@ -173,6 +173,8 @@ struct App {
|
|||||||
tx: Sender<SerialCommand>,
|
tx: Sender<SerialCommand>,
|
||||||
rx: Receiver<SerialStatus>,
|
rx: Receiver<SerialStatus>,
|
||||||
connected: Option<String>,
|
connected: Option<String>,
|
||||||
|
startup_time: f64,
|
||||||
|
fullscreen_set: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl App {
|
impl App {
|
||||||
@@ -185,6 +187,8 @@ impl App {
|
|||||||
tx: tx_cmd,
|
tx: tx_cmd,
|
||||||
rx: rx_status,
|
rx: rx_status,
|
||||||
connected: None,
|
connected: None,
|
||||||
|
startup_time: macroquad::time::get_time(),
|
||||||
|
fullscreen_set: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,6 +253,11 @@ impl App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn update(&mut self) {
|
async fn update(&mut self) {
|
||||||
|
if !self.fullscreen_set && macroquad::time::get_time() - self.startup_time >= 1.0 {
|
||||||
|
set_fullscreen(true);
|
||||||
|
self.fullscreen_set = true;
|
||||||
|
}
|
||||||
|
|
||||||
match self.rx.recv_timeout(Duration::from_millis(100)) {
|
match self.rx.recv_timeout(Duration::from_millis(100)) {
|
||||||
Ok(status) => match status {
|
Ok(status) => match status {
|
||||||
SerialStatus::SerialDisconnected => self.connected = None,
|
SerialStatus::SerialDisconnected => self.connected = None,
|
||||||
@@ -285,7 +294,6 @@ impl App {
|
|||||||
|
|
||||||
#[macroquad::main("singer")]
|
#[macroquad::main("singer")]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
set_fullscreen(true);
|
|
||||||
let mut app = App::new();
|
let mut app = App::new();
|
||||||
app.run().await;
|
app.run().await;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user