Sprite32.hsf 1.8 KB

12345678910111213141516171819202122232425262728293031
  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,short,short,__cpulong,void*,short)__ATTR_LIB_C__;
  8. [Description]
  9. Draws a sprite with a width of 32 pixels or less on the screen.
  10. [Explanation]
  11. Sprite32 works exactly like <A HREF="$$LINK(Sprite8)">Sprite8</A>, but it takes sprites with a width of 32 pixels.
  12. <I>sprite</I> is now a pointer to the array of unsigned long integers which defines the sprite.
  13. So, to define a sprite (or sprite mask), use something like
  14. <PRE>static const unsigned long sprite[] = {...};
  15. </PRE>
  16. <B>Note:</B> If you define a sprite mask and invert it with the '~' operator, you need to take
  17. care of the possibility of the first two bytes being zero in one constant. In this case, the constant will
  18. be assumed to be a 16 bit value, so only 16 bits will be inverted. Then the constant is promoted to an
  19. unsigned long integer, and the first 16 bits are still zero as if they actually belonged to the mask.
  20. To take care of this problem, add the <B>'L'</B> (long) suffix to the end of the value.
  21. <BR><BR>
  22. If you want to use sprites wider than 32 pixels (which is not very likely), one solution is to
  23. use DoorsOS and its "put_sprite" function (see <A HREF="$$INFOLINK(faq)">Frequently Asked Questions</A>
  24. for more info about how to do it). If you don't want to use DoorsOS, the proposed method depends
  25. on what the use of the sprite will be. If you don't need too fast action, the built-in TIOS function
  26. <A HREF="$$LINK(graph.h/BitmapPut)">BitmapPut</A> may be good enough. If you need a very fast sprite
  27. routine for very large sprites, then you must write it yourself.
  28. <BR><BR>
  29. See <A HREF="$$LINK(Sprite8)">Sprite8</A> for more info about sprites.