# HG changeset patch # User Robin Stumm # Date 1487208209 -3600 # Thu Feb 16 02:23:29 2017 +0100 # Node ID dd2dbcbe4e923e83cf3933fbb78841a7ac2fb569 # Parent 49fd6f6cf705faaf20dd53355ec08cf36a55561c update dependencies diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -2,29 +2,16 @@ name = "cursedlife" version = "0.0.1" dependencies = [ - "clippy 0.0.13 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "ncurses 5.73.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", + "ncurses 5.85.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "advapi32-sys" -version = "0.1.2" +name = "gcc" +version = "0.3.43" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "clippy" -version = "0.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-normalization 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "getopts" @@ -33,54 +20,54 @@ [[package]] name = "kernel32-sys" -version = "0.1.4" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libc" -version = "0.1.10" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "ncurses" -version = "5.73.0" +version = "5.85.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" -version = "0.3.11" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "advapi32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] +name = "redox_syscall" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "time" -version = "0.1.32" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "kernel32-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "unicode-normalization" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] name = "winapi" -version = "0.2.3" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -89,14 +76,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] -"checksum advapi32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "307c92332867e586720c0222ee9d890bbe8431711efed8a1b06bc5b40fc66bd7" -"checksum clippy 0.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6914195cf94ee35ce7dec728a66095f6b4f5a5dd595d1588ba7c6352fc4b02fc" +"checksum gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)" = "c07c758b972368e703a562686adb39125707cc1ef3399da8c019fc6c2498a75d" "checksum getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9047cfbd08a437050b363d35ef160452c5fe8ea5187ae0a624708c91581d685" -"checksum kernel32-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e014dab1082fd9d80ea1fa6fcb261b47ed3eb511612a14198bb507701add083e" -"checksum libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "cd70bd1f9f3bfadfdcdf92869faecc795686617d3a9acfe74d0c89a4bb6d142b" -"checksum ncurses 5.73.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d7e71c12c0b61e836772a5608165d01d07f1afc31c6976f715c539111d04e588" -"checksum rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9f7c7a46a8a1f876a89c594f7171a4152f5d7db20bfd4861c4f59b314ee81bff" -"checksum time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "7a293822233b81c06fc328921cb771c87a8826a29f4ec595fa78221e482e12f3" -"checksum unicode-normalization 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c1f678822e45cdc6cf6f56ebd0f4b467328b3425c05e2398a29ddcc50ff0e278" -"checksum winapi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d2fc09e3b1c07b43c4f877efd63681b575e21e014c8b9bcaa85a0991ed8324" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)" = "684f330624d8c3784fb9558ca46c4ce488073a8d22450415c5eb4f4cfb0d11b5" +"checksum ncurses 5.85.0 (registry+https://github.com/rust-lang/crates.io-index)" = "21f71f0e1ae96558612b1e9d188ec4f23149a11ee4fb4b96e130523bea52d605" +"checksum rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "022e0636ec2519ddae48154b028864bdce4eaf7d35226ab8e65c611be97b189d" +"checksum redox_syscall 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8dd35cc9a8bdec562c757e3d43c1526b5c6d2653e23e2315065bc25556550753" +"checksum time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "211b63c112206356ef1ff9b19355f43740fc3f85960c598a93d3a3d3ba7beade" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "cursedlife" version = "0.0.1" -authors = ["dermetfan "] +authors = ["Robin Stumm "] [dependencies] -ncurses = "5.73" -time = "0.1" -rand = "0.3" -getopts = "0.2" +ncurses = "~5.85.0" +time = "~0.1.36" +rand = "~0.3.15" +getopts = "~0.2.14" diff --git a/src/main.rs b/src/main.rs --- a/src/main.rs +++ b/src/main.rs @@ -20,8 +20,8 @@ initscr(); cbreak(); noecho(); - nodelay(stdscr, !START_PAUSED); - keypad(stdscr, true); + nodelay(stdscr(), !START_PAUSED); + keypad(stdscr(), true); curs_set(CURSOR_VISIBILITY::CURSOR_INVISIBLE); start_color(); init_pair(BG_COLORS, COLOR_WHITE, COLOR_BLACK); @@ -85,7 +85,7 @@ let mut maxy = 0; let mut maxx = 0; - getmaxyx(stdscr, &mut maxy, &mut maxx); + getmaxyx(stdscr(), &mut maxy, &mut maxx); let maxy = maxy; let maxx = maxx; @@ -207,7 +207,7 @@ QUIT => break 'game_loop, PAUSE => { paused = !paused; - nodelay(stdscr, !paused); + nodelay(stdscr(), !paused); continue 'game_loop; }, NEXT => break, @@ -233,7 +233,7 @@ let sleep = frame_duration - f64::min(render_duration, frame_duration); if sleep > 0. { - std::thread::sleep_ms((sleep * 1000.) as u32); + std::thread::sleep(std::time::Duration::from_millis((sleep * 1000.0) as u64)); } } @@ -251,7 +251,6 @@ } impl Game { - fn update(&mut self) { let count_neighbors = |cells: &Vec>, row, col| { let mut neighbors = 0; @@ -301,12 +300,12 @@ } fn render(&self) { - let color_pair = COLOR_PAIR(self.color_pair) as i32; + let color_pair = COLOR_PAIR(self.color_pair); wattron(self.window, color_pair); for row in 0..self.cells.len() { for col in 0..self.cells[row].len() { - let cell_char = if self.cells[row][col] { self.alive } else { self.dead } as u64; + let cell_char = if self.cells[row][col] { self.alive } else { self.dead } as u32; mvwaddch(self.window, row as i32, col as i32, cell_char); } } @@ -325,7 +324,6 @@ wattroff(self.window, color_pair); } - } enum BorderPart { @@ -350,10 +348,9 @@ } impl Border { - - fn get_ncurses_char(&self, part: BorderPart) -> u64 { + fn get_ncurses_char(&self, part: BorderPart) -> u32 { match self { - &Border::Blank => ' ' as u64, + &Border::Blank => ' ' as u32, &Border::Single => match part { BorderPart::Top => ACS_HLINE(), BorderPart::Bottom => ACS_HLINE(), @@ -389,7 +386,6 @@ &Border::Solid => ACS_BLOCK() } } - } struct Cursor { @@ -399,7 +395,6 @@ } impl Cursor { - fn process_input(&mut self, ch: i32, window: &WINDOW, cells: &mut Vec>) -> bool { let mut maxyx = (0i32, 0i32); getmaxyx(*window, &mut maxyx.0, &mut maxyx.1); @@ -417,11 +412,10 @@ } fn render(&self, game: &Game) { - let char_at_cursor = if game.cells[self.y as usize][self.x as usize] { game.alive } else { game.dead } as u64; - let color_pair = COLOR_PAIR(self.color_pair) as i32; + let char_at_cursor = if game.cells[self.y as usize][self.x as usize] { game.alive } else { game.dead } as u32; + let color_pair = COLOR_PAIR(self.color_pair); wattron(game.window, color_pair); mvwaddch(game.window, self.y as i32, self.x as i32, char_at_cursor); wattroff(game.window, color_pair); } - }