Difference between revisions of "DCSE:BasicLibs:DrawSprite"

From Doors CS, Doors CSE, and Doors CE Wiki
Jump to navigationJump to search
(Created page with "This routine is only available on Doors CSE 8.0 and later for the color-screen TI-84 Plus C Silver Edition. ==Description== '''NOTE:''' You must load tiledata into temp memo...")
 
Line 68: Line 68:
  
 
See above, the only difference is that it will reference user variables for x/y.
 
See above, the only difference is that it will reference user variables for x/y.
 +
 +
===DrawSpriteList8x8A/B (Uservar Values)===
 +
Description pending
 +
 +
===DrawSpriteTileBGA (TIOS Values)===
 +
'''real(4,3,X,Y,WIDTH,HEIGHT,XOFFSET,YOFFSET,TRANSINDEX,UPDATELCD,MAPWIDTH,MAPSTRING''':<br>
 +
X = x value<br>
 +
Y = y value<br>
 +
WIDTH = width of sprite in 8x8 chunks (an 8x8 sprite is 1, 16x16 is 2, 12x12 is also 2 etc)<br>
 +
HEIGHT = height of sprite in 8x8 chunks (an 8x8 sprite is 1, 16x16 is 2, 12x12 is also 2 etc)<br>
 +
XOFFSET = offset for x value<br>
 +
YOFFSET = offset for y value<br>
 +
TRANSINDEX = transparent colour index, and colour in the sprite that matches this will be drawn transparent (0-255)<br>
 +
UPDATELCD = 0/1 to update LCD after drawing<br>
 +
MAPWIDTH = width of tilemap<br>
 +
MAPSTRING = string variable holding tilemap data (0-10)<br>
 +
 +
This function will draw the tiles for width*height at a specific sprite coordinate. The resultant tiles will be aligned
 +
to the map (it will only draw at intevals of 8-pixels). This is useful for restoring a tilemap background that has been
 +
overwritten by a sprite
 +
 +
===DrawSpriteTileBGB (Uservar Values)===
 +
'''real(4,3,X,Y,WIDTH,HEIGHT,XOFFSET,YOFFSET,TRANSINDEX,UPDATELCD,MAPWIDTH,MAPSTRING''':<br>
 +
X = x value<br>
 +
Y = y value<br>
 +
WIDTH = width of sprite in 8x8 chunks (an 8x8 sprite is 1, 16x16 is 2, 12x12 is also 2 etc)<br>
 +
HEIGHT = height of sprite in 8x8 chunks (an 8x8 sprite is 1, 16x16 is 2, 12x12 is also 2 etc)<br>
 +
XOFFSET = offset for x value<br>
 +
YOFFSET = offset for y value<br>
 +
TRANSINDEX = transparent colour index, and colour in the sprite that matches this will be drawn transparent (0-255)<br>
 +
UPDATELCD = 0/1 to update LCD after drawing<br>
 +
MAPWIDTH = width of tilemap<br>
 +
MAPSTRING = string variable holding tilemap data (0-10)<br>
 +
 +
This function is the same as above but references user variables instead of tios values
  
 
[[Category:Basic Libraries]] [[Category: SDK]]
 
[[Category:Basic Libraries]] [[Category: SDK]]

Revision as of 23:09, 23 October 2013

This routine is only available on Doors CSE 8.0 and later for the color-screen TI-84 Plus C Silver Edition.

Description

NOTE: You must load tiledata into temp memory before drawing tilemaps. See DCSE:BasicLibs:ManagePic.

Technical Details

DrawSpriteA (TI-OS Values)

real(4,0,X,Y,WIDTH,HEIGHT,XOFFSET,YOFFSET,TRANSINDEX,UPDATELCD,PICINDEXSTART,PICINDEX0,PICINDEX1...etc):
X = x value
Y = y value
WIDTH = width of sprite in 8x8 chunks (an 8x8 sprite is 1, 16x16 is 2, 12x12 is also 2 etc)
HEIGHT = height of sprite in 8x8 chunks (an 8x8 sprite is 1, 16x16 is 2, 12x12 is also 2 etc)
XOFFSET = offset for x value
YOFFSET = offset for y value
TRANSINDEX = transparent colour index, and colour in the sprite that matches this will be drawn transparent (0-255)
UPDATELCD = 0/1 to update LCD after drawing
PICINDEXSTART = pic index to start drawing from (in following list)
PICINDEX0 = pic index in sprite data sheet

Note that sprites are drawn from 8x8 chunks (or tiles) and are stored in tile/sprite data appvars that must be loaded into memory before use (see MANAGEPIC). For sprites larger than 8x8 the function takes a list of arguments for each index of the sprite (in 8x8 chunks). The sprites are drawn *column* first:

16x16 sprite list layout:

---------
| 1 | 3 |
---------
| 2 | 4 |
---------

24x24 sprite list layout:

-------------
| 1 | 4 | 7 |
-------------
| 2 | 5 | 8 |
-------------
| 3 | 6 | 9 |
-------------

Example: To draw an 8x8 sprite at 32,32 with a pic index of 155 that has a transparent colour index of 248:

real(4,0,32,32,1,1,248,1,0,155

Example: To draw a 16x16 sprite at 32,32 with a pic index list of 12,13,14,15 that has a transparent colour index 248:

real(4,0,32,32,2,2,248,1,0,12,13,14,15

You can use the PICINDEXSTART argument to specify which sprite to draw out of a list of sprites. This can be useful for drawing a differen sprite depending on a direction variable. For example drawing an 8x8 sprite where pic index 10=up, 11=down, 12=left & 13=right, and you have a direction variable "A" which holds 0=up, 1=down, 2=left & 3=right you can do:

real(4,0,32,32,1,1,248,1,A,10,11,12,13

This will select index 10 if A=0, 11 if A=1, 12 if A=2 & 13 if A=3 and so on.

DrawSpriteB (Uservar Values)

real(4,1,USERVAR_X,USERVAR_Y,WIDTH,HEIGHT,XOFFSET,YOFFSET,TRANSINDEX,UPDATELCD,PICINDEXSTART,PICINDEX0,PICINDEX1...etc):
X = x value
Y = y value
WIDTH = width of sprite in 8x8 chunks (an 8x8 sprite is 1, 16x16 is 2, 12x12 is also 2 etc)
HEIGHT = height of sprite in 8x8 chunks (an 8x8 sprite is 1, 16x16 is 2, 12x12 is also 2 etc)
XOFFSET = offset for x value
YOFFSET = offset for y value
TRANSINDEX = transparent colour index, and colour in the sprite that matches this will be drawn transparent (0-255)
UPDATELCD = 0/1 to update LCD after drawing
PICINDEXSTART = pic index to start drawing from (in following list)
PICINDEX0 = pic index in sprite data sheet

See above, the only difference is that it will reference user variables for x/y.

DrawSpriteList8x8A/B (Uservar Values)

Description pending

DrawSpriteTileBGA (TIOS Values)

real(4,3,X,Y,WIDTH,HEIGHT,XOFFSET,YOFFSET,TRANSINDEX,UPDATELCD,MAPWIDTH,MAPSTRING:
X = x value
Y = y value
WIDTH = width of sprite in 8x8 chunks (an 8x8 sprite is 1, 16x16 is 2, 12x12 is also 2 etc)
HEIGHT = height of sprite in 8x8 chunks (an 8x8 sprite is 1, 16x16 is 2, 12x12 is also 2 etc)
XOFFSET = offset for x value
YOFFSET = offset for y value
TRANSINDEX = transparent colour index, and colour in the sprite that matches this will be drawn transparent (0-255)
UPDATELCD = 0/1 to update LCD after drawing
MAPWIDTH = width of tilemap
MAPSTRING = string variable holding tilemap data (0-10)

This function will draw the tiles for width*height at a specific sprite coordinate. The resultant tiles will be aligned to the map (it will only draw at intevals of 8-pixels). This is useful for restoring a tilemap background that has been overwritten by a sprite

DrawSpriteTileBGB (Uservar Values)

real(4,3,X,Y,WIDTH,HEIGHT,XOFFSET,YOFFSET,TRANSINDEX,UPDATELCD,MAPWIDTH,MAPSTRING:
X = x value
Y = y value
WIDTH = width of sprite in 8x8 chunks (an 8x8 sprite is 1, 16x16 is 2, 12x12 is also 2 etc)
HEIGHT = height of sprite in 8x8 chunks (an 8x8 sprite is 1, 16x16 is 2, 12x12 is also 2 etc)
XOFFSET = offset for x value
YOFFSET = offset for y value
TRANSINDEX = transparent colour index, and colour in the sprite that matches this will be drawn transparent (0-255)
UPDATELCD = 0/1 to update LCD after drawing
MAPWIDTH = width of tilemap
MAPSTRING = string variable holding tilemap data (0-10)

This function is the same as above but references user variables instead of tios values