Compiz Fusion Plugin Development October 18th, 2009

compiz-spinner-rimsIn between the massive changes to the site (see my twitter) and setting up new developer relationships, I was inspired to work with Compiz Fusion – or what most now just call Compiz. I’ve always wanted to do some plugins, but the problem is jumping into their largely undocumented API. That’s changing a bit now, since there seems to be a better effort and they’ve got a nice start with the Compiz Wiki. Doesn’t it always seem you can just throw MediaWiki (or in this case MoinMoin) at something and it appears to fix itself.

In the past we’ve all pimped out Compiz to the point where we’re basically expecting a Spinner Rims plug-in, but I want to change that a bit. Firstly I think that many effects use too much blending with Opacity, which can be sluggish on older or low-performance hardware. Plus I think the Dodge focus effect, Show Desktop, and other effects that simply “move” windows look really clean.

Read the rest of this entry »

A better SDL wrapper for Java October 15th, 2009

I’ve been using SDL for a long time in C++, and I’ve toyed sdljava, which are rather complete bindings for SDL for Java. While the bindings are rather complete, they where created using SWIG, which is a (great) code generator, but still the result is that these bindings are kinda clunky and rather bloated. For example, there are many intermediate classes that are prefixed with SWIG_. This motivated me to write my own, which I call SDLbits.

While it’s not as complete as sdljava, it’s much smaller and is hand written. While the idea of hand-writing lots of C wrapper code seems daunting, it was not much more than writing a class with many native methods, running javah and writing some simple glue. Here is quick rundown of what is supported:

  • Video functions including support forĀ OpenGL bindings. We also provide our own very small GL bindings, GLbits.
  • Audio functions with support for callbacks to generate audio from Java.
  • Event functions (including SDL_SetEventFilter with a callback) and simple class system that allows for use of instanceof.
  • Joystick, Keyboard, and Mouse functions for polling device input.
  • Time functions like SDL_Delay and SDL_GetTicks incase their Java counterparts have undesired affects

However, it’s also important to note what wasn’t implemented:

  • Input/output (RWops) for files, since a java.io.File or java.nio.FileChannel (and variants) should be used instead.
  • Thread functions for SDL, since java.lang.Thread should be used instead.

Comparison of SDLbits and sdljavaWhile the code is not 100% complete, it can easily be thought of as at least 85% completed, and work will continue as warranted. It doesn’t hurt that the code is licensed under the LGPL, so anyone can modify and commit changes. Even though the code isn’t complete I compared the amount of both C and Java code between the projects: