Of course, a game system isn't any good without games to play on it. There are a couple of problems with this right now:

  • It's new, so I've only written two games for it, and am working on a third
  • The game engine... isn't.

Luckily, a complicated engine isn't required to get a game of your own running on here. The display is simply a 64x64 array, that is written with a single call. The engine just added some sprite-like copies for convenience later on.

The sample games should give you plenty of reference code for getting things on the display. At the core, you need to do:

int width = 64;
int height = 64;

ledscape_config_t * config = &ledscape_matrix_default;

ledscape_t * const leds = ledscape_init(config, 0);

uint32_t * const p = (uint32_t*)calloc(width*height,4);

ledscape_draw(leds_, p);

The array 'p', is stored as XRGB, where X is "don't care", and R, G, and B are red, green and blue respectively. Each uint32 represents a single pixel.



Audio is done simply by using SDL in an audio-only mode. It speaks to the default audio device, which is provided here by a USB audio adapter.


The control panels simply show up as inputs to the Linux GPIO interface. The table of GPIO inputs is given in the Preparing the Cape section. The software is easier to use. To initialize it, do:

player_controls[0] = new controls_t(1);
player_controls[1] = new controls_t(2, true);
player_controls[2] = new controls_t(3);

The player number is passed in as the first argument to the controls_t constructor. Player 1 and 2 are obvious. Player 3 is the "1 Player" and "2 player" start buttons, as Primary and Secondary action button.

The 'true' option inverts the joystick. Because the players face each other, if players are playing simultaneously, one player is seeing everything upside down, and it can be helpful to invert the joystick.

Once each frame, the controls must be refreshed. This involves some amount of device file access, so it is only done on command:


To get the state of the controls, just do:


The complete list of controls is:








Menu Entry

The last step is to add your new game to the menu. The file Menus.png is a 'sprite sheet', containing a series of 64x32 sprites. Each sprite should contain some interesting graphics, as well as the menu text, and left/right arrows. The sample menu contains 3 pictures.

The menu program simply loads the sprite sheet, and the code must be modified to change the menu items. The vector 'game_sprites' holds all of the menu sprites, so just add any new sprites to that vector.

The menu program will return an exit code containing the number of the sprite selected. This is used by the 'run-menu' script to actually run the next game.

This guide was first published on May 04, 2015. It was last updated on 2015-05-04 16:05:58 -0400.

This page (New Games) was last updated on Mar 20, 2015.

Text editor powered by tinymce.