Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
24
src/main.rs
24
src/main.rs
@@ -7,8 +7,10 @@ use std::{
|
||||
use anyhow::{Result, anyhow};
|
||||
use macroquad::{
|
||||
color::*,
|
||||
miniquad::{error, info},
|
||||
window::set_fullscreen,
|
||||
miniquad::{
|
||||
conf::LinuxBackend,
|
||||
error, info,
|
||||
},
|
||||
};
|
||||
use midly::Smf;
|
||||
use serialport::SerialPortType;
|
||||
@@ -173,8 +175,6 @@ struct App {
|
||||
tx: Sender<SerialCommand>,
|
||||
rx: Receiver<SerialStatus>,
|
||||
connected: Option<String>,
|
||||
startup_time: f64,
|
||||
fullscreen_set: bool,
|
||||
}
|
||||
|
||||
impl App {
|
||||
@@ -187,8 +187,6 @@ impl App {
|
||||
tx: tx_cmd,
|
||||
rx: rx_status,
|
||||
connected: None,
|
||||
startup_time: macroquad::time::get_time(),
|
||||
fullscreen_set: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,11 +251,6 @@ impl App {
|
||||
}
|
||||
|
||||
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)) {
|
||||
Ok(status) => match status {
|
||||
SerialStatus::SerialDisconnected => self.connected = None,
|
||||
@@ -292,7 +285,14 @@ impl App {
|
||||
}
|
||||
}
|
||||
|
||||
#[macroquad::main("singer")]
|
||||
fn window_conf() -> macroquad::prelude::Conf {
|
||||
let mut conf = macroquad::prelude::Conf::default();
|
||||
conf.fullscreen = true;
|
||||
conf.platform.linux_backend = LinuxBackend::WaylandWithX11Fallback;
|
||||
conf
|
||||
}
|
||||
|
||||
#[macroquad::main(window_conf)]
|
||||
async fn main() {
|
||||
let mut app = App::new();
|
||||
app.run().await;
|
||||
|
||||
Reference in New Issue
Block a user