15.hss 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. [Main]
  2. Title=I don't understand how to define sprites!
  3. [Top]
  4. <TABLE CELLPADDING="4"><TR><TD VALIGN="TOP"><B>Q:</B></TD><TD>
  5. I can't understand how sprites are defined; I looked in many program sources, and every
  6. sprite definition looks for me as an array of random hex numbers!?
  7. </TD></TR><TR><TD VALIGN="TOP"><B>A:</B></TD><TD>
  8. Well, suppose that you want to make a sprite which is a
  9. filled circle. Make a grid on the paper, and make a sprite shape by filling
  10. grid squares. Then, replace each filled square with 1 and each blank square
  11. with 0. In above example, it may look like:
  12. <BR><BR>
  13. 00111000<BR>
  14. 01111100<BR>
  15. 11111110<BR>
  16. 11111110<BR>
  17. 01111100<BR>
  18. 00111000
  19. <BR><BR>
  20. Then, produce rows as a set of binary numbers, and convert them
  21. to hex. For example:
  22. <BR><BR>
  23. 00111000 binary = 38 hex<BR>
  24. 01111100 binary = 7C hex
  25. <BR><BR>
  26. etc. These hex numbers describe the sprite, i.e. the sprite
  27. definition should be
  28. <PRE>unsigned char sprite [] = {0x38, 0x7C, ...};
  29. </PRE>
  30. assuming that <A HREF="$$LINK(sprites.h/Sprite8)">Sprite8</A> will be used. That's all...
  31. <BR><BR>
  32. <B>Note:</B> TIGCC also supports binary numbers (<CODE>0b...</CODE>).
  33. </TD></TR></TABLE>