Last active
November 9, 2020 20:35
-
-
Save extrawurst/98c9e7d069ead2f10624e5c701364403 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[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