-
-
Notifications
You must be signed in to change notification settings - Fork 918
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
👌 Use Offset
type directly in JoystickAction.update
calculations
#631
👌 Use Offset
type directly in JoystickAction.update
calculations
#631
Conversation
The original suggestion by @luanpotter was to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, much easier to read too!
Wouldn't it be the same amount of code qith Vector2 though? 🤔
We are trying to use Vector2 as much as possible for these datatypes.
Also, please add a changelog line.
The resulting value of the expression needs to be converted to Offset to pass it further. nextPoint we are controlling fully here. However, other values are Offsets. Using Vector2 results in 3 type conversions: to Vector2 for two input values and converting the result back to Offset. |
Ok, I wasn't able to come up with anything meaningful for this change;) but I'll figure something out. |
Makes sense, and I agree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, only missing the changelog entry, gonna mark a request changes on the PR so we don't merge this before having the entry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
8eb41a3
to
7b884f9
Compare
* Update README to point at rc5 (#630) * Update README to point at rc5 * Update README.md * 👌 Throw exception from `parseAnchor` in `examples/widgets` instead of returning null (#632) * Updated the widgets docs (#628) Co-authored-by: Erick <erickzanardoo@gmail.com> * Removing initialDimensions and removeGesture methods (#627) * Removing initialDimensions and removeGesture methods * Removing wrongly commited folder * PR suggestion * Making SpriteComponent and SpriteAnimationComponent follow the same standard for empty constructors (#620) * Added fallback support for the web on the `SpriteBatch` API (#612) * Added fallback support for the web on the `SpriteBatch` API * Refactored the SpriteBatch class * 👌 Use `Offset` type directly in `JoystickAction.update` calculations (#631) * Move files to src and comply with the dart package layout convention (#621) * 👌 Use `Offset` type directly in `JoystickAction.update` calculations (#631) * Move files to src and comply with the dart package layout convention * Fixing widgets example Co-authored-by: Serge Matveenko <lig@countzero.co> Co-authored-by: Erick Zanardo <erickzanardoo@gmail.com> * Fix gesture detection on children (#636) * Fix gesture detection on children * Remove unused imports * positionParent should be private * Fixed comment * Moved parent to BaseComponent * Fix formatting * Initial implementation of the Composition class. (#634) * Initial implementation of the Composition class * Added decodeImageFromPixels web support * Added a `required` to GameWidget and updated the docs (#638) * Added a required to GameWidget and updated the docs * Removed entry from CHANGELOG * Release v1.0.0-rc6 (#639) * Add hitbox to PositionComponent (#618) * Move out collision detection methods * Add possibility to define a hull for PositionComponents * Add example of how to use hull with tapable * Update contains point comment * Fix contains point * Hull should be based on center position * Remove collision detection parts * Added tests * Use percentage of size instead of absolute size * Separate hull from PositionComponent * Clarify hull example * Fix formatting * Override correct method * Use mixin for hitbox * Update changelog * Rename HasHitbox to Hitbox * Clarified names * Center to edge is considered as 1.0 * Fix test * Add spaces within braces * Removed extra spaces in the braces * Add hitbox docs * Fix link * Moved point rotation to Vector2 extension * Render hitbox within extension * Fix rebase * Fix rebase * Fix formatting * Removing Util.dart and moving its remaining parts to better places (#640) * Removing Util.dart and moving its remaining parts to better places * Fixing lint * Doc fixes * Doc fixes * PR suggestions * Adapting SpriteBatchComponent constructors to other components (#643) * Adapting ParallaxComponent constructors to other components (#642) * Adapating ParallaxComponent constructors to other components * Removing wrongly commited folder * Update doc/components.md Co-authored-by: Jochum van der Ploeg <jochum@vdploeg.net> * Update doc/components.md Co-authored-by: Jochum van der Ploeg <jochum@vdploeg.net> Co-authored-by: Jochum van der Ploeg <jochum@vdploeg.net> * Updating mds with recently 0.x patches * 🏷 Null safety support Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com> Co-authored-by: Jochum van der Ploeg <jochum@vdploeg.net> Co-authored-by: Erick <erickzanardoo@gmail.com> Co-authored-by: Renan <6718144+renancaraujo@users.noreply.github.com>
Description
Improved code a bit to utilize
Offset
support for+
and-
operators.Fixes #606
Type of change
Please delete options that are not relevant.
Checklist:
If something is unclear, please submit the PR anyways and ask about what you thought was unclear.
master
flutter format