Commented out the GUI modules until I can figure out how to get it working again.

The rust SDL2 bindings have changed in a way that makes the lifetimes
very strict.  This is probably a good thing from a safety standpoint,
but means I'll likely need to re-architect the GUI drawing code.

For now I'm going to leave that on the back-burner and focus on getting
the console version working.
This commit is contained in:
Nathan Vegdahl 2015-01-29 20:35:19 -08:00
parent 5652b62fc8
commit c6cfebdb75
4 changed files with 36 additions and 27 deletions

View File

@ -8,8 +8,8 @@ authors = ["Nathan Vegdahl <cessen@cessen.com>"]
name = "led"
path = "src/main.rs"
[dependencies]
sdl2 = "0.0.17"
[dependencies.sdl2]
git = "https://github.com/AngryLawyer/rust-sdl2.git"
[dependencies.docopt]
git = "https://github.com/docopt/docopt.rs.git"
@ -19,3 +19,6 @@ git = "https://github.com/gchp/rustbox.git"
[dependencies.freetype-rs]
git = "https://github.com/PistonDevelopers/freetype-rs.git"
[dependencies]
rustc-serialize = "*"

View File

@ -1,5 +1,5 @@
use std::io::{IoResult, BufferedReader, BufferedWriter};
use std::io::fs::File;
use std::old_io::{IoResult, BufferedReader, BufferedWriter};
use std::old_io::fs::File;
use std::path::Path;
use buffer::line::{Line, LineEnding, line_ending_to_str};

View File

@ -3,24 +3,24 @@
extern crate rustbox;
extern crate docopt;
extern crate "rustc-serialize" as rustc_serialize;
extern crate freetype;
extern crate sdl2;
//extern crate freetype;
//extern crate sdl2;
use std::path::Path;
use docopt::Docopt;
use editor::Editor;
use term_ui::TermUI;
use term_ui::formatter::ConsoleLineFormatter;
use gui::GUI;
use gui::formatter::GUILineFormatter;
//use gui::GUI;
//use gui::formatter::GUILineFormatter;
mod string_utils;
mod buffer;
mod files;
mod editor;
mod term_ui;
mod font;
mod gui;
//mod font;
//mod gui;
@ -37,7 +37,7 @@ Options:
// Struct for storing command-line arguments
#[derive(RustcDecodable, Show)]
#[derive(RustcDecodable, Debug)]
struct Args {
arg_file: Option<String>,
flag_gui: bool,
@ -54,19 +54,19 @@ fn main() {
// Initialize and start UI
if args.flag_gui {
// Load file, if specified
let editor = if let Option::Some(s) = args.arg_file {
Editor::new_from_file(GUILineFormatter::new(4), &Path::new(s.as_slice()))
}
else {
Editor::new(GUILineFormatter::new(4))
};
// GUI
sdl2::init(sdl2::INIT_VIDEO);
let mut ui = GUI::new_from_editor(editor);
ui.main_ui_loop();
sdl2::quit();
// // Load file, if specified
// let editor = if let Option::Some(s) = args.arg_file {
// Editor::new_from_file(GUILineFormatter::new(4), &Path::new(s.as_slice()))
// }
// else {
// Editor::new(GUILineFormatter::new(4))
// };
//
// // GUI
// sdl2::init(sdl2::INIT_VIDEO);
// let mut ui = GUI::new_from_editor(editor);
// ui.main_ui_loop();
// sdl2::quit();
}
else {
// Load file, if specified

View File

@ -43,7 +43,10 @@ pub struct TermUI {
impl TermUI {
pub fn new() -> TermUI {
let rb = rustbox::RustBox::init(&[Some(rustbox::InitOption::BufferStderr)]).unwrap();
let rb = match rustbox::RustBox::init(&[Some(rustbox::InitOption::BufferStderr)]) {
Ok(rbox) => rbox,
Err(_) => panic!("Could not create Rustbox instance."),
};
let w = rb.width();
let h = rb.height();
let mut editor = Editor::new(ConsoleLineFormatter::new(4));
@ -58,7 +61,10 @@ impl TermUI {
}
pub fn new_from_editor(ed: Editor<ConsoleLineFormatter>) -> TermUI {
let rb = rustbox::RustBox::init(&[Some(rustbox::InitOption::BufferStderr)]).unwrap();
let rb = match rustbox::RustBox::init(&[Some(rustbox::InitOption::BufferStderr)]) {
Ok(rbox) => rbox,
Err(_) => panic!("Could not create Rustbox instance."),
};
let w = rb.width();
let h = rb.height();
let mut editor = ed;