Skip to main content

Crate tegrine

Crate tegrine 

Source
Expand description

§Example drawing a line

use anyhow::Result;
use tegrine::instances::{Tegrine, D2, Instance, Dot, RGBA};
use std::{thread::sleep, time::Duration};


fn main() -> Result<()> {
	let mut z = Tegrine::new()?;

	{
		let i = z.push_instance(Instance::default());

		z.x[i].push_dot(Dot::new_vertex(
			D2::new(z.ws.x / 2, z.ws.y / 2),
			RGBA::new(255, 0, 0, 255),
			vec![1]
		));

		z.x[i].push_dot(Dot::new(
			D2::new(
				(z.ws.x as f64 / 1.5) as isize,
				(z.ws.y as f64 / 1.3) as isize,
			),
			RGBA::new(255, 0, 0, 255)
		));
	}

	z.draw(&D2::new(0, 0))?;
	sleep(Duration::from_secs(6));

	Ok(())
}

Modules§

instances
Initialization module
render
The entire purpose of Tegrine: Draw