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

Conv and ConvFloat conversion traits, i32 in Size, new Offset type, fn extract #152

Merged
merged 13 commits into from
Feb 2, 2021

Conversation

dhardy
Copy link
Collaborator

@dhardy dhardy commented Feb 1, 2021

Replaces most uses of as for type-casting with new conversion traits, with accuracy checks at least during debug mode. (Possibly these traits should be spun off into a new crate.)

The Size type now uses i32 instead of u32 to avoid converting everywhere.

Size was made a vector type, then vector uses were replaced with a new Offset type so that Size can check values are non-negative at least sometimes.

Also fixes some missing redraws.

dhardy added 13 commits January 28, 2021 15:09
Rationale: this avoids a lot of casts in user-code, also
allowing more unified code (approx 350 lines simplified).
Cost: extra casts in windowing code (approx 150 lines).
Also approx 1300 lines simply replacing u32 with i32.
Let Coord be a position, not a vector from the origin. Let
Size be a vector between two positions. This saves all
conversions between Size and Coord (save one due to winit).
@dhardy dhardy merged commit 882e9b2 into master Feb 2, 2021
@dhardy dhardy mentioned this pull request Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant