novelrt / NovelRT

A cross-platform 2D game engine accompanied by a strong toolset for visual novels.
MIT License
184 stars 42 forks source link

Fix/math enhancements #554

Closed Pheubel closed 1 year ago

Pheubel commented 1 year ago

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...) This PR adds constexpr to most of the functions in NovelRT::Maths::Utilities so that they can be calculated ahead of time when possible. It also adds [[nodiscard]] to functions inside of structs from the NovelRT::Maths namespace.

Currently some of the maths API are still using camelCase, NovelRT is currently moving to PascalCase. This pR aims to update these to use PascalCase.

Is there an open issue that this resolves? If so, please link it here. This PR aims to resolve #529 and #530

What is the current behavior? (You can also link to an open issue here) Currently most functions that are part of a structure are not marked with [[nodiscard]] and most of the functions in NovelRT::Maths::Utilities that could be marked with constexpr are not marked with constexpr.

some structures use camelCasing for their functions.

What is the new behavior (if this is a feature change)? Developers will be warned when they are not using the result of a math related function. Their code might also be able to be optimized to perform some calculations ahead of time instead of during runtime.

All structures and functions inside the math namespace use PascalCase.

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?) This PR can cause errors to appear when a developer did not use the return of a function that has now been marked with [[nodiscard]] and if warnings should be treated as errors. To fix this, they should review their code to see if they either have a bug or redundant code that they can remove.

Additionally, the change in casing will cause developers to update their code in order to fix their code.

Other information: