Skip to content

Instantly share code, notes, and snippets.

@extrawurst
Last active November 9, 2020 20:35
Show Gist options
  • Save extrawurst/98c9e7d069ead2f10624e5c701364403 to your computer and use it in GitHub Desktop.
Save extrawurst/98c9e7d069ead2f10624e5c701364403 to your computer and use it in GitHub Desktop.
#[export]
fn _draw(&self, owner: &CanvasItem) {
let start_time = OS::godot_singleton().get_ticks_usec();
let cntf = self.cnt as f32;
for n in 0..self.cnt {
let x = f32::sin(n as f32 / cntf * 360.0) * self.rad;
let y = f32::cos(n as f32 / cntf * 360.0) * self.rad;
let target = Vector2::new(x, y) + self.start;
owner.draw_line(
self.start,
target,
Color::rgb(0.0, 0.0, 1.0),
1.0,
false)
}
godot_print!(
"bench: {}",
OS::godot_singleton().get_ticks_usec() - start_time
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment