Skip to content

Suggest minor re-organization while working on windows implementation #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
34 changes: 23 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,38 @@
name = "rustbox"
version = "0.6.2"
authors = ["Greg Chapple <[email protected]>"]
description = "A rust implementation of the termbox library"
description = "A Rust implementation of the Termbox library."
repository = "https://github.com/gchp/rustbox"
homepage = "https://github.com/gchp/rustbox"
readme = "README.md"
license = "MIT"
keywords = [
"termbox",
"terminal",
"gui",
]
exclude = [
"examples/*"
]
keywords = ["termbox", "terminal", "gui",]
exclude = ["examples/*"]

[lib]
name = "rustbox"

[dependencies]
bitflags = "0.2.1"
termbox-sys = "0.2.7"
gag = "0.1.6"
num = "*"
time = "*"

[target.i686-unknown-linux-gnu.dependencies]
termbox-sys = "0.2.7"
gag = "0.1.6"

[target.x86_64-unknown-linux-gnu.dependencies]
termbox-sys = "0.2.7"
gag = "0.1.6"

[target.x86_64-apple-darwin.dependencies]
termbox-sys = "0.2.7"
gag = "0.1.6"

[target.i686-pc-windows-gnu.dependencies]
winapi = "*"
kernel32-sys = "*"

[target.x86_64-pc-windows-gnu.dependencies]
winapi = "*"
kernel32-sys = "*"
23 changes: 23 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#![feature(libc)]
#![feature(optin_builtin_traits)]

extern crate libc;
extern crate num;
extern crate time;

#[macro_use]
extern crate bitflags;

pub use rustbox::*;

#[cfg(all(target_os="linux"))]
#[path="rustbox-c/mod.rs"]
pub mod rustbox;

#[cfg(all(target_os="macos"))]
#[path="rustbox-c/mod.rs"]
pub mod rustbox;

#[cfg(all(target_os="windows"))]
#[path="rustbox-pure/mod.rs"]
pub mod rustbox;
File renamed without changes.
34 changes: 12 additions & 22 deletions src/rustbox.rs → src/rustbox-c/mod.rs
Original file line number Diff line number Diff line change
@@ -1,34 +1,24 @@
#![feature(libc)]
#![feature(optin_builtin_traits)]

extern crate gag;
extern crate libc;
extern crate num;
extern crate time;
extern crate termbox_sys as termbox;
#[macro_use] extern crate bitflags;
extern crate gag;

pub mod keyboard;
pub mod mouse;

pub use self::keyboard::Key;
pub use self::mouse::Mouse;
pub use self::running::running;
pub use self::style::{Style, RB_BOLD, RB_UNDERLINE, RB_REVERSE, RB_NORMAL};

use std::error::Error;
use std::fmt;
use std::io;
use std::char;
use std::default::Default;
use self::termbox::RawEvent;
use self::gag::Hold;

use std::default::Default;
use std::error::Error;
use std::{fmt, io, char};
use num::FromPrimitive;
use termbox::RawEvent;
use libc::c_int;
use gag::Hold;
use time::Duration;

pub mod keyboard;
pub mod mouse;

pub use self::running::running;
pub use keyboard::Key;
pub use mouse::Mouse;

#[derive(Clone, Copy)]
pub enum Event {
KeyEventRaw(u8, u16, u32),
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions src/rustbox-pure/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
extern crate winapi;
extern crate kernel32;