Code Monkey home page Code Monkey logo

bearlibterminal.rs's People

Contributors

henrythecat avatar mbilker avatar nabijaczleweli avatar ryan1729 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

bearlibterminal.rs's Issues

Compiling on a Mac?

Sorry, not sure how to do this. I've got the libBearLibTerminal.dylib and put it in my src. not sure what to do with it from there... cargo run says:

λ ~/sandbox/rust/bear/ master* cargo run
   Compiling bear v0.1.0 (/Users/justgage/sandbox/rust/bear)
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-m64" "-L" "/Users/justgage/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/justgage/sandbox/rust/bear/target/debug/deps/bear-f9575ad4cb149f8b.2gkhn179cjec6l3b.rcgu.o" "/Users/justgage/sandbox/rust/bear/target/debug/deps/bear-f9575ad4cb149f8b.2kyead65syd0h408.rcgu.o" "/Users/justgage/sandbox/rust/bear/target/debug/deps/bear-f9575ad4cb149f8b.4ihsln5i6kcoxe74.rcgu.o" "/Users/justgage/sandbox/rust/bear/target/debug/deps/bear-f9575ad4cb149f8b.4qp6saoq8ch4khbi.rcgu.o" "/Users/justgage/sandbox/rust/bear/target/debug/deps/bear-f9575ad4cb149f8b.4tb9vh2tlhjgmdsg.rcgu.o" "-o" "/Users/justgage/sandbox/rust/bear/target/debug/deps/bear-f9575ad4cb149f8b" "/Users/justgage/sandbox/rust/bear/target/debug/deps/bear-f9575ad4cb149f8b.7ldewih2fcza26m.rcgu.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/justgage/sandbox/rust/bear/target/debug/deps" "-L" "/Users/justgage/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/justgage/sandbox/rust/bear/target/debug/deps/libbear_lib_terminal-52c813dd64cd8b7e.rlib" "/Users/justgage/sandbox/rust/bear/target/debug/deps/libbear_lib_terminal_sys-2507a917265e469a.rlib" "/Users/justgage/sandbox/rust/bear/target/debug/deps/liblibc-83d68bd06eb59687.rlib" "/Users/justgage/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-edeacefc1391b975.rlib" "/Users/justgage/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-661c88e34f871df0.rlib" "/Users/justgage/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-f7c06680fdd716f3.rlib" "/Users/justgage/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-f2e753da53df829c.rlib" "/Users/justgage/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-961b28aeeb5bc8e1.rlib" "/Users/justgage/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-b6f6b59b6a29ec3a.rlib" "/Users/justgage/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-f31526d6d86acb04.rlib" "-lBearLibTerminal" "-lSystem" "-lresolv" "-lc" "-lm"
  = note: ld: library not found for -lBearLibTerminal
          clang: error: linker command failed with exit code 1 (use -v to see invocation)


error: aborting due to previous error

error: Could not compile `bear`.

To learn more, run the command again with --verbose.

My Cargo.toml file looks like:

[dependencies]
bear-lib-terminal = "2.0.0"

main.rs:

#[link(name = "libBearLibTerminal.dylib")]
use bear_lib_terminal::terminal;

pub fn main() {
    terminal::open("Test", 80, 30);
    terminal::print_xy(0, 0, "[color=red]asdf[bkcolor=blue]asdf");
    terminal::refresh();
    let _ = terminal::wait_event();
    terminal::close();
}

Alt key unhandled

BearLibTerminal.rs and BearLibTerminal-sys.rs do not handle BearLibTerminal's Alt key pressed event causing the EventIterator to end when the Alt key is pressed.

match key {
ffi::TK_SHIFT => Some(if released {Event::ShiftReleased} else {Event::ShiftPressed}),
ffi::TK_CONTROL => Some(if released {Event::ControlReleased} else {Event::ControlPressed}),
key => {
let ctrl = ffi::check(ffi::TK_CONTROL);
let shift = ffi::check(ffi::TK_SHIFT);

TK_ALT is defined as 0x72 at:

https://github.com/nabijaczleweli/BearLibTerminal/blob/f353dece2c1e3b6ecc31d4d1e2c2b38163cb6fec/Terminal/Include/C/BearLibTerminal.h#L143

Infinite Event iterator

Returns wait_event() on next().

while let Some(event) = terminal::wait_event() {
    // ...
}

Should be equivalent to

for event in terminal::events() {
    // ...
}

Increasing readability.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.