raylib-cpp icon indicating copy to clipboard operation
raylib-cpp copied to clipboard

Different Default-Colours Wrapping

Open Knoficooki opened this issue 11 months ago • 8 comments

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.

Knoficooki avatar Jan 08 '25 23:01 Knoficooki

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

Knoficooki avatar Jan 10 '25 01:01 Knoficooki

Oh wait the examples...

Knoficooki avatar Jan 10 '25 01:01 Knoficooki

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.

RobLoach avatar Jan 10 '25 01:01 RobLoach

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 avatar Jan 10 '25 01:01 Knoficooki

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

Knoficooki avatar Jan 10 '25 02:01 Knoficooki

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.

RobLoach avatar Jan 10 '25 02:01 RobLoach

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

RobLoach avatar Jan 28 '25 09:01 RobLoach

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

Knoficooki avatar Jan 28 '25 09:01 Knoficooki