OpenCores
URL https://opencores.org/ocsvn/pdp1/pdp1/trunk

Subversion Repositories pdp1

[/] [pdp1/] [trunk/] [sw/] [src/] [main.rs] - Diff between revs 15 and 18

Show entire file | Details | Blame | View Log

Rev 15 Rev 18
Line 15... Line 15...
        .build_glium()
        .build_glium()
        .unwrap();
        .unwrap();
    let mut now: f32;
    let mut now: f32;
 
 
    // 2D vertex type for plot points
    // 2D vertex type for plot points
    #[derive(Copy, Clone)]
    #[derive(Copy, Clone, Debug)]
    struct Vertex {
    struct Vertex {
        position: [f32; 2],
        position: [f32; 2],
        time: f32  // Suggest using microseconds
        time: f32  // Suggest using microseconds
    }
    }
    implement_vertex!(Vertex, position, time);
    implement_vertex!(Vertex, position, time);
Line 95... Line 95...
    };
    };
 
 
    let t0 = time::get_time();
    let t0 = time::get_time();
 
 
    use std::sync::mpsc::{channel, Receiver};
    use std::sync::mpsc::{channel, Receiver};
    let verts : Receiver = (|| {
    let verts : Receiver = {
        use std::thread::spawn;
        use std::thread::spawn;
 
 
        let (tx, rx) = channel();
        let (tx, rx) = channel();
        spawn(move || {
        spawn(move || {
            loop {
            loop {
                let now = (time::get_time() - t0)
 
                    .num_microseconds().unwrap() as f32;
 
                let mut str = String::new();
                let mut str = String::new();
                std::io::stdin().read_line(&mut str).unwrap();
                std::io::stdin().read_line(&mut str).unwrap();
 
                let now = (time::get_time() - t0)
 
                    .num_microseconds().unwrap() as f32;
                // FIXME: Parse line.
                // FIXME: Parse line.
                let mut words = str.split_whitespace();
                let mut words = str.split_whitespace();
                let x = words.next().unwrap().parse().unwrap();
                let x = words.next().unwrap().parse().unwrap();
                let y = words.next().unwrap().parse().unwrap();
                let y = words.next().unwrap().parse().unwrap();
                let v = Vertex {position: [x, y], time: now };
                let v = Vertex {position: [x, y], time: now };
                tx.send(v).unwrap();
                tx.send(v).unwrap();
                //println!("Vertex: {:?}", [x,y]);
                //println!("Vertex: {:?}", v);
            }
            }
        });
        });
        rx
        rx
    })();
    };
 
 
    loop {
    loop {
        for event in window.poll_events() {
        for event in window.poll_events() {
            // Simplest nowait: use poll_events()
            // Simplest nowait: use poll_events()
            match event {
            match event {

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.