MonoGame icon indicating copy to clipboard operation
MonoGame copied to clipboard

Point struct scalar multiplication/division operators

Open not-phoeniix opened this issue 7 months ago • 6 comments

Description of changes:

  • Added Point * int scalar multiplication operator overload
  • Added Point / int scalar division operator overload
  • Added XML documentation for both new overloads

I figured these would prove helpful due to the existence of Vector2/3/4 float scalar operators, preventing unnecessary conversions between Points and Vector2s.

not-phoeniix avatar May 03 '25 22:05 not-phoeniix

Care to address the suggestions from our AI Overlords @not-phoeniix so we can get this into the next preview?

SimonDarksideJ avatar Jun 12 '25 12:06 SimonDarksideJ

Care to address the suggestions from our AI Overlords @not-phoeniix so we can get this into the next preview?

How do we address it? If you can pass on a message though: "Hello Mr. Bot, Why are you suggesting a different exception message appears for Point compared to the Vector2 / 3 / 4 counterparts? Humans are generally capable of understanding System.DivideByZeroException means an attempt to divide by zero was made. Yours Sincerely Human"

squarebananas avatar Jun 12 '25 16:06 squarebananas

Yeah I assumed since the similar Vector 2/3/4 counterparts don't have this exception throw I'd keep it consistent across all data types and a System.DivideByZeroException error would be sufficient. If y'all think an exception would be better here then let me know and I'll add it but it seems unnecessary if the vectors don't have it either.

not-phoeniix avatar Jun 12 '25 16:06 not-phoeniix

Running builds again for test, but can we include some Unit Tests @not-phoeniix to complete this PR, we are trying to ensure that anything added includes tests for future proofing.

SimonDarksideJ avatar Jul 07 '25 20:07 SimonDarksideJ

Howdy! I added an additional operator overload and some unit tests. Let me know if there's anything else I can do!

not-phoeniix avatar Sep 03 '25 18:09 not-phoeniix

My apologies, I accidentally pushed a commit that wasn't building on Wednesday. I just updated it and verified it builds on my system, it should pass tests now.

not-phoeniix avatar Sep 05 '25 15:09 not-phoeniix