[xmoto-dev] Re : About rendering lib

[ Thread Index | Date Index | More lists.tuxfamily.org/xmoto-dev Archives ]


Hi


When I first started working on the SDL_gfx port I would have liked
the game part
to be independent of the GUI. I would have written a gtk application
and only would have used the game logic.

I turned out this was not a easy as I expected. why?
-next to the "game" there are other useful parts (the menu's options
etc). I did not want to rewrite all this.
-I wanted to keep the game the same and because the game logic is very
bounded to framerates etc it's quite hard to write a different GUI I
would have ended up rewriting most of the code.


A simpler approach was to rewrite the VDraw library to use plain
SDL_fgx. This was a good start. The only problem is that there are
where still many opengl calls outside of the VDraw library.
I figured that any program that wants to implement xmoto will need to
be able to draw polygons. so I added the functions to VDraw. I tried
to keep the opengl way of doing things
so that I did not have to rewrite to much(see example on wiki) What I
like about this aproach is that the gui code can remain moostly the
same. As long a xmoto only use calls to VDraw there is no reason why
different drawing mechanisms can't be used(cairo?).

Currently the VDraw library is used by extending it (VApp extends the
VDraw).  this makes it hard to replace
I would propose to change this so that VDraw become a member of VApp.

I would like you to look at my  the current code.Rember that for me
this is only
a fast way of finding out what will and will not work(it's a working
hack/prototype)
http://box.mmapps.net/~keesj/xmoto_sdl_gfx_2006_12_09.tar.gz


On 12/9/06, Nicolas Adenis-Lamarre <nicolas@xxxxxxxxxxxxxxxxx> wrote:

A simple example :
class Entity() {
...
}

=> how to render an entity (and the others like block, biker, ...)

first, i thought to make something like it :

class Entity() {
...
  virtual draw() = 0;
}


but finally i think it's not the good method.
I think i will make the class Entity independant of the rendering and
make a virtual render methods :

enum RenderQuality {
ugly, low, medium, high, debug, testTheme
};

class Render {
}

and deriv :

class RenderOpenGl {
...
}
Yes this could work, only I think it is possible to write a Renderer
that only uses VDaw calls
and implement a OpenGL based VDraw  lib and a SDL_gfx based on.

Those are my first thoughts on this subject.

thanks



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/