Skip to content

Instantly share code, notes, and snippets.

@JeremySorensen
JeremySorensen / bin.rs
Created October 30, 2016 05:34
TRDL demo squares
extern crate glutin;
extern crate trdl;
use std::os::raw::c_void;
fn make_shape(off_x: f32, off_y: f32, color: (f32, f32, f32)) -> (trdl::FilledPath) {
// let a0 = (150f32 + off_x, 150f32 + off_y);
// let b0 = (300f32 + off_x, 200f32 + off_y);
// let bc1 = (350f32 + off_x, 250f32 + off_y);
// let bc2 = (200f32 + off_x, 250f32 + off_y);
@JeremySorensen
JeremySorensen / bin.rs
Created October 30, 2016 04:08
main program making use of TRDL to draw shapes
extern crate glutin;
extern crate trdl;
use std::os::raw::c_void;
fn make_shape(off_x: f32, off_y: f32) -> (trdl::FilledPath) {
let a0 = (150f32 + off_x, 150f32 + off_y);
let b0 = (300f32 + off_x, 200f32 + off_y);
let bc1 = (350f32 + off_x, 250f32 + off_y);
let bc2 = (200f32 + off_x, 250f32 + off_y);
@JeremySorensen
JeremySorensen / insert_edge_method.rs
Created September 29, 2016 06:12
insert_edge with self
fn insert_edge(&mut self, start_index: usize, end_index: usize) {
@JeremySorensen
JeremySorensen / insert_edge.rs
Created September 29, 2016 05:55
insert_edge with funky lifetimes
fn insert_edge<'a, 'b>(edge_list: &'b mut Vec<HalfEdge<'a>>, start_index: usize, end_index: usize)