diff options
author | Juan J. Martinez <jjm@usebox.net> | 2020-12-30 19:07:31 +0000 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2020-12-30 19:23:41 +0000 |
commit | 2682bc5d1d864341aaeb42a449db73c3ecd16d70 (patch) | |
tree | 9116764364b4ee0ce7f6037305077807b57776de /docs/spman.md | |
download | ubox-msx-lib-1.0.tar.gz ubox-msx-lib-1.0.zip |
Initial import1.0
Diffstat (limited to 'docs/spman.md')
-rw-r--r-- | docs/spman.md | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/docs/spman.md b/docs/spman.md new file mode 100644 index 0000000..b9512b8 --- /dev/null +++ b/docs/spman.md @@ -0,0 +1,36 @@ +## Overview + +**spman** is a simple sprite manager that provides: + +- support for 16x16 sprites. +- an easy way to manage sprite patterns. +- a simple yet effective sprite flicker that allows displaying more than 4 sprites + on the same line, with support for "fixed" sprites that are excluded from + flickering. + +It should be easy to modify and customize (`spman.c` is around 100 lines of code). + +The manager is used as follows: + +1. Initialize the manager with [spman_init](#spman_init). +2. Allocate patterns with [spman_alloc](#spman_alloc). This can be done at any + time, is not needed to allocate all the patterns in one go. +3. In the game loop: + - Allocate sprites to be drawn on screen, using + [spman_alloc_fixed_sprite](#spman_alloc_fixed_sprite) for sprites excluded + from the flicker and [spman_alloc_sprite](#spman_alloc_sprite) for any + other sprite. + - Update the sprites on screen with [spman_update](#spman_update). + +The allocate/update cycle needs to happen per frame, so the flicker function is +effective. The longer between updates, the slower the flickering will be. If +the game updates at least 25/30 FPS, that's good enough for most games. + +There are other functions to flush allocated sprites without updating the +screen, or to hide all the sprites on screen. + +The manager supports all 64 patterns and up to 31 visible sprites (one sprite +is used by the flicker). + +**spman** comes from "Sprite Pattern MANager". + |