diff --git a/frontend/src/login_screen.rs b/frontend/src/login_screen.rs index 87871c3..71f1e31 100644 --- a/frontend/src/login_screen.rs +++ b/frontend/src/login_screen.rs @@ -36,9 +36,11 @@ impl Screen for LoginScreen { fn handle_frame(&mut self, ctx: &mut Context) { clear_background(BEIGE); + let txt_size = measure_text("Starting up...", None, FontSize::Large.size(), 1.0); + draw_text( "Starting up...", - screen_width() * 0.5, + screen_width() * 0.5 - txt_size.width * 0.5, screen_height() * 0.5, FontSize::Large.size() as f32, BLACK, diff --git a/frontend/src/util.rs b/frontend/src/util.rs index b66f9f4..0e12a55 100644 --- a/frontend/src/util.rs +++ b/frontend/src/util.rs @@ -1,3 +1,5 @@ +use macroquad::prelude::info; + pub fn refresh_page() { let location = web_sys::window() .unwrap() @@ -10,14 +12,11 @@ pub fn refresh_page() { } pub fn get_ws_url() -> String { - let location = web_sys::window() - .unwrap() - .document() - .unwrap() - .location() - .unwrap(); + let location = web_sys::window().unwrap().location(); - let protocol = if location.protocol().unwrap() == "https" { + info!("Current protocol: {:?}", location.protocol().unwrap()); + + let protocol = if location.protocol().unwrap() == "https:" { "wss" } else { "ws"