Skip to content

Commit

Permalink
Merge pull request #2 from OetkenPurveyorOfCode/windows_subsystem
Browse files Browse the repository at this point in the history
better title help
  • Loading branch information
OetkenPurveyorOfCode authored Apr 17, 2024
2 parents 31d67de + 60dea42 commit 6f76704
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ fn render_mouse_rect(buffer: &mut Vec<u32>, width: usize, rect: &Rect) {
}
}

fn title_string(iterations: usize) -> String {
format!("Mandelbrot - ESC: EXIT - I/D: ITERATIONS={} - Arrows: MOVEMENT - +/-: ZOOM - R: Reset", iterations)
}

fn main() {
let mut buffer: Vec<u32> = vec![0; WIDTH * HEIGHT];
let options: WindowOptions = WindowOptions {
Expand All @@ -92,7 +96,7 @@ fn main() {
none: false,
};
let mut window = Window::new(
"Mandelbrot - ESC: EXIT - I/D: ITERATIONS=100 - Arrows: MOVEMENT - +/-: ZOOM - R: Reset",
&title_string(100),
WIDTH,
HEIGHT,
options,
Expand Down Expand Up @@ -222,8 +226,7 @@ fn main() {
if iterations < usize::MAX - increase {
iterations += increase;
}
let title = format!("Mandelbrot - ESC: EXIT- I/D: ITERATIONS={iterations} - Arrows: MOVEMENT - +/-: ZOOM");
window.set_title(&title);
window.set_title(&title_string(iterations));
dirty = true;
}
if window.is_key_down(Key::D) {
Expand All @@ -234,8 +237,7 @@ fn main() {
if iterations > decrease {
iterations -= decrease;
}
let title = format!("Mandelbrot - ESC: EXIT- I/D: ITERATIONS={iterations} - Arrows: MOVEMENT - +/-: ZOOM");
window.set_title(&title);
window.set_title(&title_string(iterations));
dirty = true;
}
if window.is_key_down(Key::NumPadPlus) {
Expand Down

0 comments on commit 6f76704

Please sign in to comment.