survivor

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

commit
29890b20208854ea5574717682e5a973a5f45dd2
parent
2d1167e132698099f20af896df540418dfc15eae
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-02-20 20:00
FAQ: aspect ratio

Diffstat

M README.md 5 +++++
M src/win.rs 6 +++---

2 files changed, 8 insertions, 3 deletions


diff --git a/README.md b/README.md

@@ -69,6 +69,11 @@ The game is designed to run on 30fps. The amount of computation that needs to
   69    69 be done scales with the size of the window. So if you get a bad frame rate,
   70    70 there is a good chance that it will improve if you reduce the window size.
   71    71 
   -1    72 ### Things are stretched in one direction, circles are ovals
   -1    73 
   -1    74 The aspect ratio of pixels depends on the font. You can adjust
   -1    75 `win::ASPECT_RATIO` to compensate for that.
   -1    76 
   72    77 ## TODO (patches welcome)
   73    78 
   74    79 -	Add more weapons

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

@@ -1,14 +1,14 @@
    1     1 use crate::sprites;
    2     2 use crate::term::Screen;
    3     3 
    4    -1 const Y_FACTOR: f32 = 1.4;
   -1     4 const ASPECT_RATIO: f32 = 1.4;
    5     5 
    6     6 pub fn convert_x(x: f32) -> i64 {
    7     7     return x as i64;
    8     8 }
    9     9 
   10    10 pub fn convert_y(y: f32) -> i64 {
   11    -1     return (y / Y_FACTOR) as i64;
   -1    11     return (y / ASPECT_RATIO) as i64;
   12    12 }
   13    13 
   14    14 pub fn iconvert_x(x: usize) -> f32 {
@@ -16,7 +16,7 @@ pub fn iconvert_x(x: usize) -> f32 {
   16    16 }
   17    17 
   18    18 pub fn iconvert_y(y: usize) -> f32 {
   19    -1     return y as f32 * Y_FACTOR;
   -1    19     return y as f32 * ASPECT_RATIO;
   20    20 }
   21    21 
   22    22 pub struct Window<'a> {