Anyway, I have finally finished my embryo of 2D engine. It's basically very inspired from traditional 3D engine architecture, only with much less functionality - functionality will be added as needed, and hopefully not as pre-emptive stuff-in, I'M NOT MAKING AN ENGINE !!! :P
We have, then, RenderSceneNode objects, each of them having a vector of RenderSceneNode* as children, and a single RenderSceneNode* as parent.
I abstracted functionality on the fly in a way inspired by my habits of Java, leading to 2 interface-like classes which are Renderable (for objects with the ability to render) and Movable (for objects with positional data).
RenderSceneNode publicly inherits from both, and implements the tree-style function call of the render() method inherited from Renderable. RenderSceneNode also exposes a virtual onRender() interface that all class derived from RenderSceneNode should implement. The recursive call handles relative positioning in a 2D-vector style, since no support for rotation or scaling is implemented yet (such support is still at stake and hugely dependent on the debate "Sprites vs. Vector Graphics").
So far, classes derived from RenderSceneNode are fairly simple and designed for usability: TextObject, PictureObject (holds images loaded from files) and RectangleObject.
Of course, most is work-in-progress here, according to the iterative approach I decided to follow. Particularly, current implementation is coupled with SDL and SDL_ttf in a very ugly way (the actual declaration of the Renderable interface is "virtual void render(SDL_Surface *) = 0;" ...) and almost all classes have their member variables public.
To end my raw flow of thought about this project, I'm currently thinking of implementing dynamic scene creation (scripted and/or file-based) but I first want to make this damn Tetris operational ! :P
So long for now, with another picture of what Ctrl+F5 produces (in VC++ Express 2005):
(click for full size)
See you around...