_images/cage.png

Welcome to CAGE

CAGE is an elementary game development library. It was initially designed and developed to help teach 2D game development using the C programming language. CAGE prefers readability over flexibility and ease-of-use over a rich feature set, in the spirit of less is more.



As a library, CAGE is just a thin layer on top of SDL2, the Simple Direct-media Library. CAGE offers the essential constructs for developing 2D games. It lets you handle images, sprites, animations, fonts, sounds and other game-specific entities using a clear and straighforward API.

The short version

Here is one of the shortest and most boring game you can write using CAGE:

void* create(void)
{
    return (void*)create_font("font.png");
}

void update(void* data, float elapsed_ms)
{
    draw_text((font*)data, "Hello, World", xy(0, 0));
}

void destroy(void* data)
{
    destroy_font((font*)data);
}

int main(int argc, char ** argv)
{
    return game_loop(create, update, destroy);
}

Yes, there are easier ways to write games, and C may not look like the best choice. There is no but here. LÖVE2D, HaxeFlixer and Cocos2D are fine examples.

However, if you enjoy the beauty of C, if you want minimal cognitive burden and if you want to have long-living, portable code, then CAGE could be a viable option.

For the full story all at once, jump over to samples / wizard.c. Or, follow along with the docs and learn CAGE step by step.