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


None yet
2 participants
Copy link

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)

ozkriff added some commits Jan 27, 2019

@ozkriff ozkriff referenced this pull request Jan 27, 2019


Port to GGEZ 0.5 #409


This comment has been minimized.

Copy link
Contributor Author

ozkriff commented Feb 10, 2019


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

0 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
continuous-integration/appveyor/pr AppVeyor build failed

This comment has been minimized.

Copy link

icefoxen commented Feb 10, 2019


@ozkriff ozkriff deleted the ozkriff:i557_drawable_dimensions branch Feb 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.