Log in

No account? Create an account

Previous Entry | Next Entry

more Gnometris

The thing that's really frustrating about implementing the accelerated canvas for Gnometris is that I don't get paid to work on Gnome and so I have little time to hack around on it. What makes the implementation mind-numbing is that I've hit roadblocks a couple of times that have caused me to start over. And it's happened again--maybe.

The first road-block was an experiment that I did with goocanvas that dead-ended when I realized features I needed weren't implemented and the goocanvas project was stalled.

The second road-block was my decision to throw out the GTK+ UI and the mass of angry people that hated that idea. Their arguments were convincing, so I scrapped that work.

So, I'm working on the third approach and I've basically run in to a dead-end. Or at least, I think it's a dead end.

My approach this time around was to make essentially as little changes to the Gnometris code-base as possible using a lot of #ifdef's and #ifndef's. Wherever a method used to render to the backing buffer, it would get redirected to a ClutterCairo context. Everything looked like it would work.

Now, I see that perhaps the only way to really make this work is to have two entirely different code paths in Gnometris: one for legacy support and one for clutter. On the plus side, that would mean some kind of start-up time rather than compile-time configurability. On the other hand, that means essentially two separate code-bases to maintain with two different theme engines, etc.

Anyway, I'm looking for suggestions that might come from a fresh set of eyes looking at my approach. It's really quite ugly due to all the #ifdef's. I put the code up on github. It compiles, however blocks aren't on the playing field yet (but the block rendering cache works) and my hacking has managed to kill off the preview window functionality.

I'm not opposed to throwing out legacy support since Mesa software rendering with these few number of objects would apparently still render around 30 FPS which would be faster than our current (legacy) Cairo-based renderer.


( 5 comments — Leave a comment )
Aug. 14th, 2008 10:24 pm (UTC)
Since gnometris is written in C++: What about subclassing? You could have an AbstractField which holds the common code and provides abstract hook methods for those parts which are currently different. ClutterField and ClassicField would inherit from AbstractField. The redraw() method of ClutterField would be empty.
Aug. 14th, 2008 11:08 pm (UTC)
a lot of work but doable
Yes, that's possible. However, all of the existing Cairo code and associated "themes" assume that they are responsible for redrawing the entire field every time there's any movement event. So those routines would need to be re-factored before any work on clutter began. And without my touching it, it already has some unsettling inheritance going on.

It doesn't seem like a Tetris game should be this complicated. But then I guess that's the point. We're making it that way.
Aug. 15th, 2008 08:41 am (UTC)
Re: a lot of work but doable
I don't think that is complicated the least bit (not design wise at least). Writing the code for subclassing and interfaces is a bitch with GObjects and that's probably why people tend to avoid it. And that makes for a lot of bad coding in the G*-world.

For a library as simple as GtkHotkey I used interfaces and abstract classes extensively from the get go. See http://www.grillbar.org/wordpress/?p=250 and http://www.grillbar.org/gtkhotkey-0.1/doc/ for API docs.

I try to avoid #ifdefs except for repeated-header-inclusion guarding. In fact I will go as far as to state that most ifdefs in the g-stack are a sign of missing OO design (not all though).
Aug. 15th, 2008 08:41 am (UTC)
What is missing in goocanvas?
Hi Jason,

what is missing in goocanvas that makes you scrap the code? Did you ask on goocanvas ML about the missing functinoality?

As far as I know goocanvas is not dead, Damon fixes bugs and have no problems in adding features.

Aug. 15th, 2008 02:51 pm (UTC)
Re: What is missing in goocanvas?
It was stalled at the time that I was looking at it which was around this time frame:

I know that things have picked up since then. In fact, it probably now has everything that would be needed.
( 5 comments — Leave a comment )


color, uphair, smile
Jason D. Clinton

Latest Month

September 2011


Page Summary

Powered by LiveJournal.com
Designed by Tiffany Chow