Thsprite

From ProjectWiki
Revision as of 09:42, 27 June 2008 by Wikisysop (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

What is this?

Atm this is just a stub detailing thdualsprites.c functionality. purpose is to create dual screen sprite engine for danmaku, curtain fire, bullet hell games. The documentation is completely unfinished as is the library. Most features are supported already however.

should have the following features:

  • treats both screens as one long 384px high screen
  • be able to multiplex sprites giving up to 1024 sprites total (tho limited to 128 sprites in any of 8 48px high vertical blocks)
  • dynamically created/destroyed sprites
  • efficient use of hardware sprites only allocating sprite for which screen it can be viewed on
  • auto deallocation of hardware sprites that are not visible and reallocation if returned to screen
  • loose priority system, tries to give u whatever priority u request or closest match.. -1 = psuedo random priority

Types

User should typically not touch the data contained within these types...

spriteGfx_t - graphics object data and information.

  • size - in pixels, only using width atm because all my sprites are square, but will soon add x,y sizes
  • attr1 - size in attr1 format or any other attr1 info
  • attr2 - palette to use, again already in attr2 format
  • framesize - how many tiles make up 1 frame

thSprite_t - sprite object information..

  • which gfx object does this sprite use
  • attr0
  • attr1
  • attr2 - these are ofc the preformated attribs
  • ani - used to associate an animation object with this sprite


Gfx functions

These functions deal with loading and managing graphics and palettes in vram. Most will return or take an object of type spriteGfx_t.

thSpriteGfxLoad Loads a graphics object from file (converted to .thg format using my converter)

spriteGfx_t *thSpriteGfxLoad(const char *filename, int dstpal)

thSpriteGfxCreate Create a gfx object from raw data

spriteGfx_t *thSpriteGfxCreate(void *gfx, int width, int height, int dstpal)

thSpriteGfxPal Load sprite palette (rgb15,256 colors, 16 pals) entries is the number of colors up to 256 (or each frame to do color rotations ooo ahhh :P)

void thSpriteGfxPal(u16 *pal, int entries, int dstpal)

thSpriteGfxCopy Makes a copy of a gfx object

spriteGfx_t *thSpriteGfxCopy(spriteGfx_t *gfx)

thSpriteGfxClear Erases ALL sprites from obj mem starting with 'start'(since im loading a scene at a time this works best, can dynamically alloc later based on size and add thSpriteGfxUnload() mebbe?)

void thSpriteGfxClear(int start)

thSpritePngLoad Loads gfx object from .png file (this is not part of the spritelib really, but included for testing and eval)

spriteGfx_t *thSpritePngLoad(char *filename, int dstpal)

Sprite Functions

Personal tools
irssi scripts
eggdrop scripts