-
Notifications
You must be signed in to change notification settings - Fork 60
Consider unsealing the Point class #30
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
Comments
Thank you for the feedback. It was originally a class but got converted to a struct in this commit: 87b1568#diff-336d9b5ef45c6e307febd568f0845ed0 People generally prefer it a struct for "performance" reasons, but in any of my performance profiling I haven't seen a big difference either way. I feel like it's a situation where it won't ever please everyone. I'll need to think about and research it some more before changing it back. In the meantime could a potential workaround be to override the |
If it's not a problem in the profiler, it's not a problem! Anyone who says differently is guilty of premature optimization IMO. In the mean time I wrote a wrapper class so I can make things points and hand them to RogueSharp and back easily. It's not so much that I needed the - operator as I wanted to be able to interchange the points easily. |
I would much rather prefer an interface which has X and Y. This can then be used by Point, Actor, Cell, Behaviour, Item, etc, etc. |
I suppose a record or a ValueTuple could be used, too? |
I was very surprised that I couldn't subclass the Point class. I know I can use composition instead. I'm using an ECS pattern where components implement an IComponent interface (for serialization). Some of the components are just points with a different name. LocationComponent and DestinationComponent for example. It would be a lot cleaner for them to inherit point so I can do things like subtract them.
V.S.
The text was updated successfully, but these errors were encountered: