60 lines
1.7 KiB
Rust
60 lines
1.7 KiB
Rust
mod gtfs;
|
|
mod renderer;
|
|
use std::{collections::HashSet, os, process, thread, time::Duration};
|
|
use sdl3::{EventPump, event::{self, Event, EventWatchCallback}, sys::init::SDL_Quit};
|
|
use crate::{gtfs::Gtfs, renderer::Screen};
|
|
|
|
const SRC_FILE: &str = "/home/nahuel/Downloads/GTFS_Realtime.zip";
|
|
|
|
|
|
fn refresh_thread() {
|
|
|
|
}
|
|
|
|
|
|
fn main() {
|
|
|
|
let gtfs_prefs = gtfs::structs::Preferences {
|
|
route_numbers: HashSet::from([String::from("15A"), String::from("F1"), String::from("F2"), String::from("F3")]),
|
|
stop_codes: HashSet::from([String::from("1117")])
|
|
};
|
|
|
|
let screen_prefs = renderer::structs::Prefs {
|
|
font_path: String::from("resources/jd_lcd_rounded/jd-lcd-rounded.ttf"),
|
|
screen_width: 1920,
|
|
screen_height: 720,
|
|
};
|
|
|
|
// Init GTFS static info
|
|
println!("Loading GTFS data...");
|
|
//let _gtfs = Gtfs::load(SRC_FILE, >fs_prefs);
|
|
|
|
// Init screen
|
|
println!("Initializing screen...");
|
|
let mut screen = Screen::init(&screen_prefs);
|
|
println!("Startup done.");
|
|
|
|
// Start an asynchronous refresh thread
|
|
let _update_thread = thread::Builder::new().name("updater".to_string()).spawn(refresh_thread);
|
|
|
|
// Main event loop
|
|
let mut event_pump = screen.get_context().event_pump().unwrap();
|
|
loop {
|
|
let event = event_pump.wait_event();
|
|
|
|
match event {
|
|
Event::Quit { timestamp: _ } => {
|
|
process::exit(0);
|
|
}
|
|
|
|
Event::User { timestamp: _, window_id: _, type_: _, code: _, data1: _, data2: _ } => {
|
|
// a message from another thread, probably a refresh?
|
|
}
|
|
|
|
// Ignore all other events
|
|
_ => {}
|
|
}
|
|
|
|
}
|
|
}
|