Close

Graphics Engine Overview for C Programs

A project log for 2019 Hackaday Superconference Badge

FPGA Running RISC-V Core in a Game Boy form factor

lutetiumLutetium 10/22/2019 at 13:380 Comments

A tile-based graphics engine containing several layers allows for complex manipulations. The most comprehensive information on how this system works is found in the through comments of the mach_defines.h file of soc/ipl/gloss

Layers from Top to Bottom:

Tileset Details:

The graphics engine is based on tile sets that are 256x512px in size, containing 16x16 pixel tiles which are indexed left-to-right beginning at the top. Tilesets are limited to a 16-bit color palette.

Writing to Tile Layers:

Each tile layer is 64x64 tiles in size, although the screen is 30x20 tiles in size. When a tile layer is enabled, any changes to that layer will be immediately viewable.

Moving Tile Layers:

As noted, tile layers are larger than the screen. These can be offset. Tile layers wrap around the screen so by filling all 64 slots and then offsetting the layer in that direction you effectively create infinite scrolling.

Scaling and Distorting Tile Layers:

More to come. See main.c of the IPL for working examples.

Working with the Sprite Layer:

The sprite layer is not yet fully available. See main.c in IPL and in the Flappy app for some working examples.

Discussions