object: Fix and test Z ordering.

We're going to add some kind of pseudo double buffering to the surface blitter
soon[TM], so we need to make sure that Z ordering works the way we want it to.

It did so far, but only when the Z value is set _after_ adding the object onto
another one. The test case now added makes sure that either this issue nor some
related issue (that might come up soon) won't happen again.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Insert missing Null<>s for static platforms.

Of course if we want to make a field nullable, we have to do so in static
platforms. I've taken care of them mostly already, but missed a few ones. With
this commit these are now added.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
timer: Add support for the cpp target.

This inserts a bunch of conditionals which are quite ugly right now. But let's
refactor Timer later when we have a working cpp target.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Add preliminary TermCurses class for cpp target.

This currently doesn't calculate width and height and doesn't display colors,
but that should be enough to get the job done.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
appbuilder: Generate target specific main() code.

This involves a bit of ugliness in the build function, to ensure we generate the
right fields for the specific target as we don't have the target constant
available during macro evaluation.

Of course, this integrates our newly created TermCurses class, so the cpp should
give us a somewhat useful output.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
example.hxml: Add cpp (64 bit) target.

This adds /example/build/ to .gitignore.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Rename hase.display.ISurface to ISurfaceProvider.

This resembles the actual meaning of the interface way better.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
termcurses: Get terminal size using ioctl().

This requires some inline C in order to reliably get the terminal dimensions. My
original approach was adding a new exthase library, but this would have been
_way_ too much overhead by adding nasty build.xml files and other stuff. Using
inline __cpp__ constructs, the implementation is way more seamless and doesn't
break on various systems... like for example on Nix(OS) ;-)

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
termcurses: Add support for fg and bg colors.

At the moment, it doesn't detect the terminal type and just assumes you have 256
color support. Also this hides the cursor and doesn't show it again at
termination, so we really need to add a cleanup function.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
termcurses: Add handler for SIGINT and SIGTERM.

This may get quirky when using multiple threads. But that's something we're
going to look at *if* that happens or if we want to use multiple threads for
ourselves (though, I'm quite certain that we don't want to override the signal
handler again).

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
termcurses: Accumulate escapes into a StringBuf.

That way we can avoid unnecessary syscalls of write() and it more or less feels
like "transactions".

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Merge branch 'curses', closes #4.

We now support the cpp target with a curses-like output. It actually doesn't
test the terminal type and thus might not work on most terminals and was tested
on xterm with 256 color support so far.

Of course that means that there is plenty of room for optimization and we
currently write _raw_ CSI and simple escapes, so don't take this as a cross
platform implementation at all.

The reason we cannot use real (n)curses for this are because we want:

 * To optimize for ASCII sprites, not a generic TUI.
 * To have 256 color support.
 * To have possible room for future hacks and implementations, like drawing
   Xlib overlays on top of the terminal.