heron icon indicating copy to clipboard operation
heron copied to clipboard

Reduce friction caused by requiring an explicit `2d`/`3d` feature flag

Open jcornaz opened this issue 3 years ago • 0 comments

To use heron, one must enable either the 2d or 3d feature flag: https://docs.rs/heron/3.0.0/heron/index.html#add-the-dependency-and-choose-to-work-with-either-2d-or-3d

This can be friction for new users, who can stumble into unclear error messages: https://discord.com/channels/691052431525675048/966502688751779931/966599689749270558

I think we can improve the situation.

  • [ ] Fail faster, with a more explicit compilation error

Maybe something like:

#[cfg(not(any(feature = "2d", feature = "3d")))]
compile_error!("the feature \"2d\" or \"3d\" must be enabled to use heron");
  • [ ] Enable 3d by default.

So that a setup would become:

  • For a 3d game: heron = "3.0.0"
  • For a 2d game: heron = { version = "3.0.0", default-features = false, features = ["2d"] }

The rationale behind choosing 3d as the default instead of 2d is that 3d is a "superset" of the 2d capabilities in the sense that one could make a 2d game using the 3d version of heron, but the not the opposite.

jcornaz avatar Apr 21 '22 08:04 jcornaz