On Mon, 20 May 2013 13:40:06 -0700, Diggory <digg...@googlemail.com> wrote:
UI toolkits are a lot of work but they're not as unreasonably big as
everyone seems to be suggesting... I've written a couple myself in a
procedural language using Direct3D to draw everything. Had all the
standard controls, various layout options, even a syntax highlighted
code editor, clipboard interaction, keyboard focus, etc.
The main difficulties with doing the same thing in opengl and making it
cross platform seem to be:
- Font rendering, especially with support for the combining unicode
characters and RTL languages. It would probably be worth finding an
existing library for this.
- Making it consistent with the host OS, it would be possible to have a
number of skins for each OS but that would probably be breaking all
sorts of copyright rules. Generating the skin on the fly using the
native drawing commands shouldn't be too hard...
On the other hand you get the advantages of hardware acceleration and
pretty much unlimited custom drawing capabilities and I'd expect to see
a lot of interesting custom controls out there. I'd definitely favour
this option!
A native OS UI would be less work - although you'd effectively need to
write an implementation specifically for each OS, the OS would take care
of most of it for you. The main problems here would be getting
consistent behaviour across all OSes and also it would be a lot of work
to add controls that don't already exist in the OS.
What would be neat is if there was a CTFE based compiler which took some
form of markup describing part of the UI and converted it to D code.
That way you could mixin bits of UI markup either from files or string
literals, directly into your classes and it would be really easy to hook
up events and things.
As far as I am concerned this is pretty much the only way to do it. D's
CTFE gives us so much power in the markup->code translation phase we'd be
terminally stupid not to use it. :-D
--
Adam Wilson
IRC: LightBender
Project Coordinator
The Horizon Project
http://www.thehorizonproject.org/