Just do it

Published February 22, 2006
Advertisement
I guess that simply adding the previous entry in my journal had me get back to it more seriously :)

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...
0 likes 2 comments

Comments

Rob Loach
Thanks a lot for that Index -> TileX/TileY solution.... Worked great!
February 24, 2006 11:36 AM
darkpanda
No problem! I happened to use it often when re-re-reimplementing matrix/grid-like structures, with (i,j) access over a 1D array :)
February 26, 2006 03:03 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

Me loves Georgia

705 views

Unrelated

1004 views

Learning...

714 views

Just do it

776 views

Good intentions...

609 views

Quick overview

557 views

Kickstart

639 views
Advertisement