survivor

graphical action game for the linux terminal
git clone https://git.ce9e.org/survivor.git

commit
f9d1d6b3f8c84f80666ecf770d656e9d31ac2e04
parent
8769e417b5a2580865adad0bc89c0d16fac359dd
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-02-18 21:10
split circle when completely outside of screen

Diffstat

M src/main.rs 8 ++++----

1 files changed, 4 insertions, 4 deletions


diff --git a/src/main.rs b/src/main.rs

@@ -66,11 +66,11 @@ fn sprite(screen: &mut term::Screen, cx: f32, cy: f32, sprite: &sprites::Sprite,
   66    66 fn circle(screen: &mut term::Screen, cx: f32, cy: f32, r: f32, color: [u8; 3]) {
   67    67     let r2 = r * r;
   68    68 
   69    -1     let y0 = screen.convert_y(cy - r).max(0) as usize;
   70    -1     let x0 = screen.convert_x(cx - r).max(0) as usize;
   -1    69     let y0 = screen.convert_y(cy - r).max(0).min(screen.height as i64 - 1) as usize;
   -1    70     let x0 = screen.convert_x(cx - r).max(0).min(screen.width as i64 - 1) as usize;
   71    71 
   72    -1     let y1 = screen.convert_y(cy + r).min(screen.height as i64 - 1) as usize;
   73    -1     let x1 = screen.convert_x(cx + r).min(screen.width as i64 - 1) as usize;
   -1    72     let y1 = screen.convert_y(cy + r).max(0).min(screen.height as i64 - 1) as usize;
   -1    73     let x1 = screen.convert_x(cx + r).max(0).min(screen.width as i64 - 1) as usize;
   74    74 
   75    75     for y in y0..=y1 {
   76    76         let dy = screen.iconvert_y(y) - cy;