Compare commits
No commits in common. "e2d0ce2e59fd67be7857a624e1cdc5c4d66f332d" and "da8bc84c36aa846ae9091016a8128da6bbd2dd36" have entirely different histories.
e2d0ce2e59
...
da8bc84c36
2
Makefile
2
Makefile
@ -28,7 +28,7 @@ all: nms sneakers
|
||||
all-ncurses: nms-ncurses sneakers-ncurses
|
||||
|
||||
nms-ncurses: $(OBJ)/input.o $(OBJ)/error.o $(OBJ)/nmstermio_ncurses.o $(OBJ)/nmseffect.o $(OBJ)/nms.o | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $(BIN)/nms $^ -lncursesw target/release/libnmsrust.a
|
||||
$(CC) $(CFLAGS) -o $(BIN)/nms $^ -lncursesw
|
||||
|
||||
sneakers-ncurses: $(OBJ)/nmscharset.o $(OBJ)/nmstermio_ncurses.o $(OBJ)/nmseffect.o $(OBJ)/sneakers.o | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $(BIN)/sneakers $^ -lncursesw
|
||||
|
5
justfile
5
justfile
@ -7,11 +7,6 @@ build:
|
||||
cargo build --release
|
||||
make nms
|
||||
|
||||
# Build ncurses version
|
||||
build_ncurses:
|
||||
cargo build --release
|
||||
make nms-ncurses
|
||||
|
||||
|
||||
# Clean all project files
|
||||
clean:
|
||||
|
15
src/lib.rs
15
src/lib.rs
@ -2,7 +2,7 @@ mod args;
|
||||
mod charset;
|
||||
mod color;
|
||||
|
||||
use libc::{c_char, c_int, c_void};
|
||||
use libc::{c_char, c_int, c_uchar, c_void};
|
||||
use std::ffi::CString;
|
||||
use std::process;
|
||||
|
||||
@ -12,9 +12,10 @@ const VERSION: &str = "2.0.0";
|
||||
|
||||
extern "C" {
|
||||
fn nmseffect_set_clearscr(_: c_int) -> c_void;
|
||||
fn nmseffect_exec(input: *const c_char, len: c_int, autodecrypt_c: c_int) -> c_char;
|
||||
fn nmseffect_exec(input: *const c_char, len: c_int) -> c_char;
|
||||
static mut foregroundColor: c_int;
|
||||
static mut maskBlank: c_int;
|
||||
static mut autoDecrypt: c_int;
|
||||
}
|
||||
|
||||
/// Return a random character from charTable[].
|
||||
@ -66,7 +67,13 @@ pub extern "C" fn rust_main() {
|
||||
}
|
||||
}
|
||||
|
||||
let autodecrypt_c = if args.autodecrypt { 1 } else { 0 };
|
||||
unsafe {
|
||||
if args.autodecrypt {
|
||||
autoDecrypt = 1;
|
||||
} else {
|
||||
autoDecrypt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
let output = get_input("Enter input: ");
|
||||
if output.len() == 0 {
|
||||
@ -76,7 +83,7 @@ pub extern "C" fn rust_main() {
|
||||
let output_cstring = CString::new(output).unwrap();
|
||||
let ptr = output_cstring.as_ptr();
|
||||
let len = output_cstring.as_bytes().len();
|
||||
let _r = unsafe { nmseffect_exec(ptr, len as i32, autodecrypt_c) };
|
||||
let _r = unsafe { nmseffect_exec(ptr, len as i32) };
|
||||
}
|
||||
|
||||
fn get_input(prompt: &str) -> String {
|
||||
|
@ -32,6 +32,7 @@
|
||||
#define REVEAL_LOOP_SPEED 50 // miliseconds between each reveal loop
|
||||
|
||||
// Behavior settings
|
||||
int autoDecrypt = 0; // Auto-decrypt flag
|
||||
int maskBlank = 0; // Mask blank spaces
|
||||
static int colorOn = 1; // Terminal color flag
|
||||
|
||||
@ -54,7 +55,7 @@ static void nmseffect_sleep(int);
|
||||
* string that is provided as an argument. It returns the last character
|
||||
* pressed by the user.
|
||||
*/
|
||||
char nmseffect_exec(unsigned char *string, int string_len, int autoDecrypt) {
|
||||
char nmseffect_exec(unsigned char *string, int string_len) {
|
||||
struct charAttr *list_pointer = NULL;
|
||||
struct charAttr *list_head = NULL;
|
||||
struct charAttr *list_temp = NULL;
|
||||
|
@ -9,7 +9,7 @@
|
||||
#define NMSEFFECT_H 1
|
||||
|
||||
// Function prototypes
|
||||
char nmseffect_exec(unsigned char *, int string_len, int autoDecrypt);
|
||||
char nmseffect_exec(unsigned char *, int string_len);
|
||||
void nmseffect_set_returnopts(char *);
|
||||
void nmseffect_set_clearscr(int);
|
||||
void nmseffect_use_color(int);
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
// Static settings
|
||||
static int clearScr = 1; // clearScr flag
|
||||
int foregroundColor = COLOR_BLUE; // Foreground color setting
|
||||
static int foregroundColor = COLOR_BLUE; // Foreground color setting
|
||||
|
||||
/*
|
||||
* Initialize and configure the terminal for output. This usually means
|
||||
|
Loading…
Reference in New Issue
Block a user