Advertisement Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Just do it

Sign in to follow this  


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...
Sign in to follow this  


Recommended Comments

No problem! I happened to use it often when re-re-reimplementing matrix/grid-like structures, with (i,j) access over a 1D array :)

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!