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
merged 5 commits into from Feb 10, 2019

Conversation

Projects
None yet
2 participants
@ozkriff
Copy link
Contributor

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;

Notes:

  • 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

Open

Port to GGEZ 0.5 #409

@ozkriff

This comment has been minimized.

Copy link
Contributor Author

ozkriff commented Feb 10, 2019

r?

@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
Details
continuous-integration/appveyor/pr AppVeyor build failed
Details
@icefoxen

This comment has been minimized.

Copy link
Contributor

icefoxen commented Feb 10, 2019

r+!

@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.