simple display (from: GUI library for D)

Adam D. Ruppe destructionator at gmail.com
Sun Apr 10 18:54:08 PDT 2011


KennyTM~ wrote:
> Taking the version on that link, I have ported it to use the native
> Cocoa/Core Graphics in OS X, instead of X11

Thanks!

> 1. *Please use spaces instead of tabs.*

Spaces are the spawn of Satan! I hate them, but when it comes time
to submit to phobos, I'll run a find/replace of them so it's
consistent with the prevailing style there. Until then though,
I'll write it in my native style... so these early drafts will
remain tabs, but spaces will be used in the final copy.

> 2. Color's constructor's arguments should better be "red" "green"
> "blue" "alpha" rather than "a" "b" "c" "d".
> 3. The unit of "pulseTimeout" should be documented (milliseconds).

Indeed.

>  4. In the function "fromHsl", there is a (h is real.nan).
> However, 'is' on primitives is reduced to '==' and (nan == nan)
> is false, so (his real.nan) will always be false. You should use
> std.math.isNaN().

Ah, so that's what it is. I was sure it was some form of "is nan"
but it's not something I use often so I assumed it was like null.

Changed.

> 5. Why use the ANSI version (LoadIconA, etc.), not the Unicode
> version (LoadIconW, etc.) of API on Windows? I think the latter
> is preferred.

Yeah. core.sys.windows.windows is woefully incomplete though, and
only defined the A versions. Since I was already sick of
copy/pasting headers after Xlib, I took the path of least
resistance and aliased to what it had. (Annoyingly though, I still
had to copy/paste a bunch of GDI prototypes! Not a big deal -
structs and enums are way more painful than functions, but
still, aaargh.)

I'll fix it up next time I have some time to kill. They're all
aliased in one place so it will be easy to find.


More information about the Digitalmars-d mailing list