The graphics display

The brick engine provides true-color display, capable of running in windowed or full-screen mode. The programmer chooses the display resolution at run-time (up to a compile-time limit), and the display output can be scaled up when using the accelerated output mode.

Graphics output consists of an optional background-fill color, tile-based maps, sprites, and strings. The maps, sprites, and strings are organized into layers.

Layers

Each layer can contain one tile-based map and an unlimited number of sprites and strings. The layers are drawn in the order they were created, and can be reordered at any time. Each layer also has a camera position assigned to it. The camera determines which sprites and which part of the map are displayed. Strings are absolutely positioned and do not move when the camera is moved, so that status information such as score or health do not need to be repositioned as the camera moves.

Maps

Each layer can have one tile-based map. A map consists of an array of tiles and a block of map data. Each element in the map data consists of an index into the tile array, representing the tile to draw at that position in the map.

Tiles

Tiles are the building blocks of the map display and consist of one or more frames of graphical data. Tiles also have an animation mode, if multiple frames are loaded, and a collision mask. The collision mask allows a sprite to react differently to different types of tiles, such that some may permit the sprite to pass while others will block the sprite motion.

Sprites

Sprites are movable pieces of graphics data that usually represent an actor in the game. A sprite can be either an image, drawn onto the display, or a filter, which alters the underlying image data. Sprites can have multiple frames, though only one is drawn at any given time. Sprites also have numerous properties to control their in-game action.

Strings

Strings are useful for status information, on-screen messages, and the like. The brick engine has one simple font built in, and by default text strings will be drawn using this font. New fonts may be loaded at any time. A few ascii control characters are respected when used in strings, such as tab stop, new line, and carriage return.

 
overview/the_graphics_display.txt · Last modified: 2010/02/10 18:22 (external edit)