organicomplex 0.7.0

Interactive complex-valued cellular automaton on 2D and 3D grids in search of that stuff - emergence, open-endedness, organicity etc.
extern crate sdl2;

use sdl2::mouse::MouseButton;

#[derive(Clone, Copy, Hash, Eq, PartialEq, Debug)] // for HashSet
pub enum Button {
    Left,
    Middle,
    Right
}

// "There and back again"... TODO: avoid duplications

pub fn to_sdl(b: Option<Button>) -> Option<MouseButton> {
    use Button::*;
    match b {
        Some(b) => match b {
            Left => Some(MouseButton::Left),
            Middle => Some(MouseButton::Middle),
            Right => Some(MouseButton::Right)
        },
        None => None
    }
}

pub fn from_sdl(b: Option<MouseButton>) -> Option<Button> {
    use Button::*;
    match b {
        Some(b) => match b {
            MouseButton::Left => Some(Left),
            MouseButton::Middle => Some(Middle),
            MouseButton::Right => Some(Right),

            _ => None
        },
        None => None
    }
}