For years, I’ve been reaping the benefits of Free Software in my personal projects. Perthion, my 2D game engine, was originally based on PyGame, a freely available module that provides an easy to use API for SDL 1.2. In time I moved the renderer into a custom C extension module for improved performance, migrated from PyGame to custom SDL 1.3 bindings for iOS support, and then to marcusva’s public domain PySDL2 bindings.
More recently, I’ve been experimenting with running Perthion on PyPy3. PyPy cannot use C extension modules designed for the standard interpreter (CPython), so another solution was needed for the renderer. Inspired by PySDL2’s use of the ctypes module, which made it equally usable in both CPython and PyPy, I decided to adapt my CPython render module into a C library. In addition to this new flexibility, I now had a stand-alone library which could be beneficial to the development community.
So, in hopes that it is both useful in its current state and able attract contributors to help improve and extend it, I have released this library as the Splat Graphics Library. SplatGL, or just Splat, is a simple 2D render library suitable for drawing sprite and tile based games. It supports basic position, rotation, and scale transforms for each image. It can use truecolor images provided to it as an SDL_Surface. Splat works by renderering a Canvas object, which contain one or more layers, which can have any number of image instances attached to it. Each instance can be positioned and oriented independently.
Splat is written in C and provides a C/C++ API, as well as a Python interface that I am currently using in the latest version of my engine. Although it does not yet have all the functionality of the original extension module, I plan to continue developing it and adding the missing functionality, and more. The README.md file in the git repository contains a number of ideas for next steps for the project. Currently I’ve only tested building the library on Linux, but it should be portable to any platform that has recent OpenGL and SDL 2 support. To further its potential accessibility, I am releasing the code under the zlib license, the same license used by the SDL 2.0 libraries.
More information:
Project page
Github repository
@SplatGL on Twitter