SergiusIW / collider-rs

Rust library for continuous 2-D collision detection.
Apache License 2.0
92 stars 9 forks source link

Moved {cell_width, padding} from HbProfile to collider::Collider::new(). #6

Closed ckaran closed 5 years ago

ckaran commented 5 years ago

cell_width() and padding() were functions that didn't accept any arguments. As a result, they could only return hard-coded values (or lookup values in a global dictionary, which would be awkward). This commit removes both cell_width() and padding() functions from the HbProfile trait, and adds them as arguments to collider::Collider::new(). This allows you to create/destroy Collider instances on the fly, which can be useful in certain types of simulators.

WARNING I also accidentally committed changes I made to the tests in src/core/dur_hitbox/mod.rs. Please check that I didn't change the tests before accepting this commit (all tests passed with my changes).

SergiusIW commented 5 years ago

This change seems fine to me. The dir_hitbox tests that you changed seemed to be incorrectly using equality tests instead of assignment operators, so your changes to that are appropriate.