aboutsummaryrefslogtreecommitdiffstats
path: root/src/state.rs
diff options
context:
space:
mode:
authorbrian cully <bjc@spork.org>2025-12-29 11:20:12 -0500
committerbrian cully <bjc@spork.org>2025-12-29 11:20:12 -0500
commit5378626d85b69b53b79d2539dea9c8746af88616 (patch)
tree435214a5407a151dcc644af3a47d5f0ad2ece32e /src/state.rs
parentf3bc843bcaa5c40ce93a6f1777d48e2ad7d097f5 (diff)
downloadpolyring-5378626d85b69b53b79d2539dea9c8746af88616.tar.gz
polyring-5378626d85b69b53b79d2539dea9c8746af88616.zip
wasm: separate update/render for later benching
Diffstat (limited to 'src/state.rs')
-rw-r--r--src/state.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/state.rs b/src/state.rs
index 61e82c9..09120fb 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -67,10 +67,6 @@ impl State {
self.canvas.height().into(),
);
self.render_points()?;
- if self.bounce_points() {
- //debug!("point bounced");
- }
- self.move_points();
// poly finding assumes sorted
self.points.sort_by(|a, b| {
@@ -100,6 +96,14 @@ impl State {
Ok(())
}
+ pub fn update(&mut self) -> JSResult<()> {
+ if self.bounce_points() {
+ //debug!("point bounced");
+ }
+ self.move_points();
+ Ok(())
+ }
+
fn render_points(&self) -> JSResult<()> {
for p in &self.points {
self.ctx.set_fill_style_str(&p.color);