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

Different Default-Colours Wrapping #347

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Knoficooki
Copy link

I was wondering about the implementation of the Colour that are already provided by raylib... why functions?
If there is a reason, I'm sorry, please explain.

But in the mean time I changed them to constexpr's.


/**
* Returns src alpha-blended into dst color with tint
*/
[[nodiscard]] Color AlphaBlend(::Color dst, ::Color tint) const { return ::ColorAlphaBlend(dst, *this, tint); }

/* I think it deprecated
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to remove the old functions, I agree we shouldn't need these with the const expressions. May need to update some oft he examples though.

Comment on lines 245 to 247
/**
* As an alternative to a function calling convention
*/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will become the doxygen docs for LightGray. It might be best to just remove the block as it's pretty clear what it does 😎

Suggested change
/**
* As an alternative to a function calling convention
*/

Deleting Colour Functions and setting the const-expressions to static, because I forgot to do that
@Knoficooki
Copy link
Author

Knoficooki commented Jan 10, 2025

I think that's it?
If there is something else, please let me know : )

@Knoficooki
Copy link
Author

Oh wait the examples...

@RobLoach
Copy link
Owner

Getting the following error...

Color.hpp:240:28: error: ‘constexpr const raylib::Color raylib::Color::Magenta’ has incomplete type
  240 |     static constexpr Color Magenta = MAGENTA

I believe it's because MAGENTA is a macro that's expanded to:

CLITERAL(Color){ 245, 245, 245, 255 }

Since it expands with Color it there, it references the raylib::Color instead of ::Color. I believe...

Not entirely sure if that's correct, but I'm not sure of a good workaround.

@Knoficooki
Copy link
Author

the problem ist that a static constexpr can not be from the same type the class it is defined in,
rn I'm error hunting the examples

@Knoficooki
Copy link
Author

ooh hehe, some function-wrappers don't take the Color class...
But rn I dont have time to fix this... I will do it tomorrow

@RobLoach
Copy link
Owner

RobLoach commented Jan 10, 2025

No time urgency. Take all the time you need :)

As long as Color.hpp builds, it'll be easy to find/replace the Color usage.

Pulling the default colours out of the Color Class. Don’t know if it’s a good idea though.
@RobLoach
Copy link
Owner

Color.hpp:249:21: error: the type ‘const raylib::Color’ of ‘constexpr’ variable ‘raylib::RayWhite’ is not literal
  249 |     constexpr Color RayWhite = RAYWHITE;

@Knoficooki
Copy link
Author

Didn't update the docs yet and also don't really know if it's a good idea, or if it works at all, I'm not on Desktop so can't build

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.

2 participants