Colors in Raylib

Mike Parker aldacron at gmail.com
Tue Mar 1 04:14:06 UTC 2022


On Tuesday, 1 March 2022 at 02:42:52 UTC, Steven Schveighoffer 
wrote:
> On 2/28/22 6:48 AM, Salih Dincer wrote:

>
> In general, the raylib enumerations are overly verbose for D, 
> e.g. `KeyboardKey.KEY_X`, instead of just `KeyboardKey.X`. I'd 
> love to provide "better enums".
>

In Derelict, I exclusively used anonymous enums with an alias to 
the base type like Guillaume noted above. When I did bindbc-sdl, 
I decided to go with named enums + the template I pasted 
above---I put the mixin at the bottom of each enum declaration. 
Though I do use anonymous enums now for any that are intended to 
be used as bit flags.

The mixin approach allows you to keep the stronger typing of 
named enums and still maintain one-to-one compatibility with the 
with the C source if both are important to you. I'm ambivalent 
about it now.





More information about the Digitalmars-d-learn mailing list