build awesome games using elementary c

SOURCE CODE DOCUMENTATION

CAGE Tiled sample

CAGE Ain’t a Game Engine

CAGE is an elementary game development library written in the spirit of less is more (or worse is better). CAGE favors readability over flexibility and ease-of-use over a rich set of features.

Hello, World

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

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

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

int main(void)
{
    return game_loop(create_game, update_game, destroy_game);
}

SDL2 inside

CAGE is just a thin layer on top of SDL2. It was designed to provide the minimal set of features you will need for 2D game development. It will also work on any platform SDL supports, including Linux, OS X, Windows, Android and iOS.

Make things simple, not simpler.

CAGE hides just enough complexity to make it easy to learn and fun to write games with. You will still have to code your game but you will get just enough help to let you be creative and productive.

Okay, but why C?

C is a raw, low-level computer language. It has no classes, no templates, no iteratable containers and no reusable algorithms. It is often being desribed as a cross-platform assembly. In other words, it is one small limitless programming language.

Tell me more

CAGE exports only small set of functions to help you manage your game’s graphics, sound, screen and controller. It spares you from writing a significant amount of boilerplate SDL2 code.

Game State

Game states are the basic constructs of a CAGE game. You can have your entire game inside just one monolithic game state or you can have a separate state per level, menu or cutscene.

Each state is implemented using three state functions. To start your game, you will need to provide your initial game state function set.

game_loop(create_game, update_game, destroy_game);

These functions manage the lifecycle of your game state: create your required assets, update and draw each frame and clean up when the state is not needed anymore.

Sprite Animation

CAGE makes it easier for you to create animated sprites. It has the essentials for loading a sprite imageset file, defining the animation sequences and playing them in your game code. tiled

Plays well with others

CAGE is not a game engine, as its name suggests. This makes it easier for you to integrate other libraries such as Chipmunk2D for 2D physics or TMX for reading Tiled 2D files. chipmunk

Transparent Code

CAGE does not hide stuff from you. If CAGE was over-engineered then this could have been bad. However, CAGE is simple enough, so its transparency can yield clarity.

error


CAGE is licensed under the zlib license