schveiguy / raylib-d

Resurrected copy of onroundit's raylib-d
zlib License
55 stars 14 forks source link

Changed the Color struct. #55

Closed Kapendev closed 3 months ago

Kapendev commented 3 months ago

Resolves #45 #42
I also added constructors, which required modifying a small part of raygui.

schveiguy commented 3 months ago

Ah, thanks for the PR. However, raylib/package.d is auto-generated and I don't want to put custom code there. This is why e.g. Vector2 is located in raylib_types.

Can you move it there, and then change the generating.md appropriately?

Kapendev commented 3 months ago

I moved it to raylib_types and changed the markdown file too.

schveiguy commented 3 months ago

It was mentioned that maybe Color.init should be all 0s (including alpha). I'm thinking we should make that the case, and just have the default parameter for alpha be 255 in the constructor. What do you think?

Making one byte not be zero can have an effect on default initializers in things that contain a Color. When you have to set something to all 0 it's pretty efficient.

Kapendev commented 3 months ago

Looks good! I'm considering whether this will be released as a point release or wait for a major release, because technically it breaks code (the raygui code being an example).

Maybe a point release? I also want to work on the Linear mixin, so maybe these two could go together.

Kapendev commented 3 months ago

It was mentioned that maybe Color.init should be all 0s (including alpha). I'm thinking we should make that the case, and just have the default parameter for alpha be 255 in the constructor. What do you think?

Making one byte not be zero can have an effect on default initializers in things that contain a Color. When you have to set something to all 0 it's pretty efficient.

a=255 will also break some code. Everything being zero makes more sense if we don't want that. There used to be #42 , but with how things are built now (constructors), that's not an issue anymore. I prefer a=0, but it's a better idea to ask on Discord for that.