Next: , Previous: , Up: Hacker's guide   [Contents][Index]


3.6 Graphics backends

3.6.1 Modularity

Liquid War 6 has a modular architecture which allows the programmer (and the player) to plug pretty much any rendering/graphics backend, provided this one is... developped.

As of 2009 the only available backend was mod-gl1, it would display the game using 3D acceleration, if available, through the SDL library, using its GL bindings.

As of 2012, other backends are begin developped, the idea is that each backend can provide the user with enough visual feedback to play, and convey input informations to the core engine.

The rest of the game is exactly the same, this means playing with mod-gl1 you can do exactly the same things than with mod-caca.

3.6.2 List of backends

3.6.3 How to write a new backend

The starting point for any hack are the files src/lib/gfx/gfx.h. This is where the API is defined.

Basically, the type lw6gfx_backend_t contains all the required callbacks. You must provide an implementation for each function.

Let’s take an example, taken from mod-gl1. When calling lw6gfx_get_video_mode and passing it a first argument which is a valid mod-gl1 backend, the function mod_gl1_utils_get_video_mode will be called. How this is done is a little C casting wizardry.

To understand how this works, read the files:

All the functions should be defined, but some of them are obviously more important. The two most critical functions are:


Next: , Previous: , Up: Hacker's guide   [Contents][Index]