Skip to content

Line drawing functionality

Jeremy Soller requested to merge ca1ek:master into master

Created by: ca1ek

I wrote a function to draw lines.

Code I used to test it:

extern crate orbclient;

use orbclient::window::Window;
use orbclient::color::Color;

fn main() {
    let mut window = Window::new(20, 20, 640, 480, &"Hello!").unwrap();
    let mut counter = 0.0; 
    loop {
        window.line(0, 0, 400 - counter as i32, 0 + counter as i32, Color::rgb(255, 0, 0));
        window.sync();
        counter += 0.033;
    }

}

Orbital variant of the code is painfully slower than the SDL2 one due to lack of hw acceleration.

Merge request reports