Sprite32.hsf 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. [Main]
  2. Name=Sprite32
  3. Type=Function
  4. Subtype=tigcc.a
  5. Header Files=sprites.h
  6. Definition=void Sprite32 (short x, short y, short height, const unsigned long *sprite, void *vm_addr, short mode);
  7. Real Definition=extern void Sprite32(short asm("d0"),short asm("d1"),short asm("d2"),__cpulong asm("a0"),void* asm("a1"),short asm("d3"))__ATTR_LIB_ASM__;
  8. See Also=sprites.h/ClipSprite32
  9. [Library Call]
  10. Asm=1
  11. [Registers]
  12. x=d0
  13. y=d1
  14. height=d2
  15. sprite=a0
  16. vm_addr=a1
  17. mode=d3
  18. [Description]
  19. Draws a sprite with a width of 32 pixels or less on the screen.
  20. [Explanation]
  21. Sprite32 works exactly like <A HREF="$$LINK(sprites.h/Sprite8)">Sprite8</A>, but it takes sprites with a width of 32 pixels.
  22. <I>sprite</I> is now a pointer to the array of unsigned long integers which defines the sprite.
  23. So, to define a sprite (or sprite mask), use something like
  24. <PRE>static const unsigned long sprite[] = {...};
  25. </PRE>
  26. <B>Note:</B> If you define a sprite mask and invert it with the '~' operator, you need to take
  27. care of the possibility of the first two bytes being zero in one constant. In this case, the constant will
  28. be assumed to be a 16 bit value, so only 16 bits will be inverted. Then the constant is promoted to an
  29. unsigned long integer, and the first 16 bits are still zero as if they actually belonged to the mask.
  30. To take care of this problem, add the <B>'L'</B> (long) suffix to the end of the value.
  31. <BR><BR>
  32. If you want to use sprites wider than 32 pixels (which is not very likely), one solution is to
  33. use a "kernel"-based program and <CODE>graphlib::put_sprite</CODE> (see <A HREF="$$INFOLINK(faq)">Frequently Asked Questions</A>
  34. for more info about how to do it). If you don't want to use kernel-based programs, the proposed method depends
  35. on what the use of the sprite will be:
  36. <UL>
  37. <LI>
  38. If you don't need too fast action, the built-in TIOS function <A HREF="$$LINK(graph.h/BitmapPut)">BitmapPut</A> may be good enough.
  39. </LI>
  40. <LI>
  41. If you need a very fast sprite routine for very large sprites, then you must write it yourself, or use prewritten ones in
  42. ExtGraph or Genlib.
  43. </LI>
  44. </UL>
  45. <BR><BR>
  46. See <A HREF="$$LINK(sprites.h/Sprite8)">Sprite8</A> for more info about sprites, and
  47. <A HREF="$$LINK(sprites.h/ClipSprite32)">ClipSprite32</A> for a version that handles out-of-screen sprites gracefully.