Friday, November 7, 2014

Window creation a D initiative?

D needs to solve its GUI problems. We need unified solutions for things. No more hundred libraries to do one thing poorly.
No small libraries that do one thing very well are what is needed. And I intend to get the snowball rolling.



The past

Where to begin? Well lets recap what I've done in the past for D in turns of windowing libraries.
I ported OOGL to D calling it D_OOGL for (obvious reasons).
From this I asked the question, but can you use OpenGL for GUI controls? The answer was yes and I created DOOGLE.

DOOGLE was an interesting case, because while it inherited a lot of code from D_OOGL it still didn't stand on its own in the window creation area. But it did hold its own for GUI controls. Although I did regret how I did aliasing and bunch of other nasty stuff to split interface from implementation.
One nice thing about it however, was that a button is just a container that you can click with some form of effect applied to its looks. So you can make a button contain pretty much anything you wanted including images.

At the time I thought DOOGLE had a lot of potential and in some ways it did. But it doesn't really solve the problem of in the D community almost everyone was playing round to create one (at some point). And this really made me give up eventually.

I am however glad it did happen, because I learnt a lot about the Windows API and X11 in general. But now its time to move on from this and solve actual problems that the D community has in general.

Window creation for D

Starting at how do we create Windows for use in e.g. games, GUI's ext.? Using outside libraries such as SDL and GLFW while being good solid libraries is adding an outside library to the mix which is not desirable.

This is where I'm beginning with DWC. It create windows, manipulates them in a fairly consistent way and creates an OpenGL context at also fairly reasonable consistency. More importantly it works on OSX x64, X11 x32 x64 and Windows x32 x64. Which pretty much puts it at the only library in D that can do this (with some Objective-C).

This is all pretty cool and all, but it doesn't get me very close to having a nice event system on top with controls support. Let alone a game development framework or GUI toolkit.

Future use case

So what exactly am I planning on doing in the future? Well lets take a look.

Short term

  1. Create a Github organization whose purpose is to provide a game development framework.
  2. Move DWC over to the Github organisation.
  3. Create OpenGL function wrappers (to D types e.g. arrays).
  4. Finish off my image loading (png) library (has abstraction to image).
  5. Do the reverse of loading (png) saving, for image library.
  6. Enable DWC to use the colour (rgba) data type from the image loading library for e.g. icon.
Long term
  1. Window and context creation
  2. OpenGL wrappers to D types AND structify e.g. shader program.
  3. OpenGL tooling such as frame buffer utilising image library.
  4. 3D model loading/exporting utilising the image library for textures.
  5. Controls(interface) / event system on top of the windowing library.
  6. GUI controls
  7. Native GUI controls such as menu with fallback to OpenGL.
Okay this is a rather big list for myself. But its not complete. My end goal for the organisation would be to have a Unity like interface on top of it all. But the most important thing, being able to drop down to D code at any level you wish.

Conclusion

Unfortunately in the D community we have a bad tendency with GUI toolkits and the like to not agree upon them. To solve this I have built a library which can handle the entirety of the window creation needs (for pretty much all of them). Which at the very least could help us focus all our time and effort on one library instead of 10.

For each project under the organisation a few rules will exist to keep them strong. Define the scope at the start, do not cross it. Keep the scope to the abstraction required to do that functionality.

No comments:

Post a Comment