diff --git a/assets/martian.tweak.toml b/assets/martian.tweak.toml index ffea183..c9cc7d2 100644 --- a/assets/martian.tweak.toml +++ b/assets/martian.tweak.toml @@ -1,3 +1,6 @@ +### +# Credits text, rendered as-is from the "Credits" menu button +### [credits] text = """ # Martian Chess @@ -29,6 +32,9 @@ Space Blanket Folds - https://www.textures.com/download/PBR0152/133187 Background 2D art by NASA: LINK HERE """ +### +# Intro text, typed out during normal gameplay +### [intro] # Higher rate is slower typing speed. Integers only! rate = 5 @@ -43,6 +49,9 @@ But Can you adapt? Will you be a part of the universal rhyme, and if so, which side are you on? """ +### +# Tutorial text, revealed interactively based on context +### [tutorial] intro = [ """ @@ -233,4 +242,4 @@ tonemapping = "ReinhardLuminance" exposure = 2.0 gamma = 1.0 pre_saturation = 1.0 -post_saturation = 1.0 +post_saturation = 1.0 \ No newline at end of file diff --git a/src/ui.rs b/src/ui.rs index e52004b..e98a40f 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -11,10 +11,11 @@ impl Plugin for UiPlugin { ( manage_cursor.run_if(any_component_changed::), interactive_button.run_if(any_component_changed::), - scale_ui - .run_if(any_component_changed::) - .run_if(resource_exists::()), - scale_ui.run_if(on_event::>()), + scale_ui.run_if( + on_event::>() + .or_else(any_component_changed::) + .and_then(resource_exists::()), + ), ), ); } @@ -90,12 +91,15 @@ fn scale_ui( *resolution_set = true; } - // Setting UI Scale based on ratio of expected to current ratio - let width_ratio = w.resolution.width() / width; - let height_ratio = w.resolution.height() / height; - let new_scale = (width_ratio).min(height_ratio) as f64; - if ui_scale.0 != new_scale { - ui_scale.0 = new_scale; + // Check if window is minimized + if w.resolution.height() > 0.0 && w.resolution.height() > 0.0 { + // Setting UI Scale based on ratio of expected to current ratio + let width_ratio = w.resolution.width() / width; + let height_ratio = w.resolution.height() / height; + let new_scale = (width_ratio).min(height_ratio) as f64; + if ui_scale.0 != new_scale { + ui_scale.0 = new_scale; + } } }); }