From 74f8c5f04fbcf6c6eba249b3a44528e755d4bfab Mon Sep 17 00:00:00 2001 From: Beefki Date: Mon, 14 Aug 2017 05:15:25 +0000 Subject: [PATCH] Suck less and compile more --- rust/curses_test/src/main.rs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/rust/curses_test/src/main.rs b/rust/curses_test/src/main.rs index 7b31227..476a368 100644 --- a/rust/curses_test/src/main.rs +++ b/rust/curses_test/src/main.rs @@ -4,23 +4,22 @@ use pancurses::{initscr, endwin, noecho, curs_set, cbreak, Input}; const SCREENWIDTH: i32 = 15; const SCREENHEIGHT: i32 = 15; - struct Character { row: i32, col: i32, symbol: char } -fn new_character(row: i32, col: i32, symbol: char) -> Character{ - let mut a = Character { - row: row, - col: col, - symbol: symbol, - }; - return a; +impl Character { + fn new(row: i32, col: i32, symbol: char) -> Character { + let mut a = Character { + row: row, + col: col, + symbol: symbol, + } + } } - fn main() { /*Create the window*/ @@ -32,10 +31,10 @@ fn main() { - getmaxyx(stdscr(), &mut max_y, &mut max_x); +// getmaxyx(stdscr(), &mut max_y, &mut max_x); /*Create our dude*/ - let draco = new_character(5,5,'@'); + let draco = Character::new(5,5,'@'); /*Set some ncurses config*/ init(); @@ -72,4 +71,4 @@ fn init() { * data (scope) in functions */ fn refresh_win(window: &pancurses::Window) { window.refresh(); -} +} \ No newline at end of file