defun-games / claylib

A Common Lisp 2D/3D game toolkit built on top of Raylib 4.5.
zlib License
73 stars 4 forks source link

TEXT objects use %COLOR as tint sometimes #14

Closed mjkalyan closed 2 years ago

mjkalyan commented 2 years ago

For example, raylib's ImageDrawTextEx uses a custom Font object which has its own colour based on the asset, but it also takes a tint for opacity. This works but it's confusing for a user to think of a TEXT object's %COLOR slot as doing different things in different contexts (it is the actual colour of the text when using draw-object = DrawTextEx but a measure of opacity for image-draw = ImageDrawTextEx).

It appears to be an inconsistency in Raylib - but we could work around it by adding a %TINT slot.

shelvick commented 2 years ago

I agree it is kind of confusing. Not sure of the best way to solve it.

I assume Raylib means to use "color" as the full color of something and "tint" as mixing in a color. There may be places in the code where I've started using color instead of tint or vice versa, because it was easier for the CLOS hierarchy. We'll need to watch out for and probably fix those.

Beyond that... are there objects in Claylib that could be created with both color and tint? Those I think would be the most confusing ones.

mjkalyan commented 2 years ago

"tint" as mixing in a color

Oh whoops, I was thinking it was opacity or brightness because I had only observed its effects with gray-scale colors :man_facepalming:

It's still a little confusing to have it mean full colour or colour mix depending on context. However, now I'm not as troubled by the current design.

are there objects in Claylib that could be created with both color and tint?

I don't know if we're backed into any corners, but if for some reason we needed to use raylib's DrawText instead of DrawTextEx like we do now, then we would be specifying a color not a tint. That means we could have both color and tint slots but, practically, I'm not seeing any issues with the current design.

I'll keep an eye out for any cases where we actually need both.

I think I can close this now.