Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drawable::dimensions() #567

merged 5 commits into from Feb 10, 2019


Copy link

@ozkriff ozkriff commented Jan 27, 2019

This PR:

  • Adds an approx::RelativeEq impl for Rect;
  • Adds a fn rotate(&mut self, rotation: f32) method to `Rect;
  • Adds a fn combine_with(self, other: Rect) -> Rect method to Rect;
  • Adds a fn dimensions(&self, _: &mut Context) -> Option<Rect> method to the Drawable trait;


  • I don't like that dimensions method requires Context - it's required only for Texts implementation. It can be solved by storing a dimensions: Rect field in Text during Text's creation, but it increases the costs of this operation which may be not desirable.
  • I really hope that I haven't messed up the math too much. The basic tests seem to be ok, but it needs some staring review.
  • Also, I'm not sure that combine_with is a descriptive name but can't think out anything better.
  • It'd be cool to remove the code duplication between bbox_for_vertices and rotate, but I don't see how it can be done since they work with different point types.

Closes #557

(Here's a branch of Zemeroth with a draft port to GGEZ 0.5.alpha.0 + this PR)

Copy link
Contributor Author

ozkriff commented Feb 10, 2019


@icefoxen icefoxen merged commit 36a8b78 into ggez:master Feb 10, 2019
Copy link


@ozkriff ozkriff deleted the i557_drawable_dimensions branch February 11, 2019 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants