High level functions
void DrawPlane(short x,short y,Plane *plane,void *dest,TM_Mode mode,TM_Type type);
This function draws the plane plane
from x
and y
coordinates on the screen (virtual or not) dest
.
It updates the big virtual screen automatically if needed.
Parameters plane
, type
and mode
are not ordinary, here are their specifications :
plane
is the address of a Plane
structure, which is defined like this :
typedef struct
{
void *matrix; // Matrix of tiles
unsigned short width; // Map's width
void *sprites; // Sprite array
char *big_vscreen; // Big virtual screen
long mask; // Obsolete (kept for compatibility)
long reserved1; // Internal use (do not modify)
short force_update; // To force updating the big virtual screen
}Plane;
type
indicates the type of the plane : the size of the sprites (16x16 or 8x8), the type of the matrix of tiles and it indicates if the function works in B/W or in grayscales. Its type is TM_Type
, this type is a bit complex, and you don't need to know exactly what it is to use the function, because I wrote macros in the header file which can be used directly like a TM_Type
value. Read the appendix of this document to know all the allowed values.
mode
indicates the draw mode : RPLC
, OR
, MASK
, TRANW
or TRANB
. The type of this parameter is TM_Mode
, this type is complicated too, if you really want to know what it is, look at the header file, but that's not needed to be able to use the functions because I wrote macros in the header file which can be used directly for a parameter TM_Mode
. Read the appendix at the end of this document to know all the allowed values.
This function updates the big virtual screen only if it's needed, so to force the updating, put a nonzero value in the force_update
field. The DrawBuffer
function will clear this field after it updates the big virtual screen. You must do this in the initialization.
You can see an example using this function in the Example 1, provided with the library.
Note : It's strongly recommended to use macros defined in the header file for parameters type
and mode
.
void DrawAnimatedPlane(short x,short y,AnimatedPlane *plane,void *dest,TM_Mode mode,TM_AnimType type);
Draw the animated plane plane
form x
and y
coordinates to the screen (virtual or not) dest
.
It updates the big virtual screen automatically if needed.
The plane
parameter is the address of an AnimatedPlane
structure, which is defined like this :
typedef struct
{
Plane p;
void *tabanim; // Animation's matrix
short nb_anim; // Number of animations
short nb_step; // Number of animation's step
short step; // Current step number
short step_length; // Length of a step (in frames)
short frame; // Current frame number for the current step
}AnimatedPlane;
This structure contains a Plane
followed by all the necessary informations to animate it.
The matrix of the Plane
will not contain sprite numbers, but animation numbers, and the function will find the corresponding sprite number in the animation's matrix tabanim
.
The parameter mode
works exactly like in the previous function, please look at the appendix to know what are correct values.
The parameter type
works like in the previous function, but its possible values are not the same, they're given in the apppendix.
void DrawGrayPlane(short x,short y,Plane *plane,void *dest1,void *dest2,TM_GMode mode,TM_GType type);
This function draws the plane plane
from x
and y
coordinates on the screen (virtual or not) dest1/dest2
.
It updates the big virtual screen automatically if needed.
Parameters plane
, type
and mode
are not ordinary, here are their specifications :
plane
is the address of a Plane
structure, which is defined like this :
typedef struct
{
void *matrix; // Matrix of tiles
unsigned short width; // Map's width
void *sprites; // Sprite array
char *big_vscreen; // Big virtual screen
long mask; // Obsolete (kept for compatibility)
long reserved1; // Internal use (do not modify)
short force_update; // To force updating the big virtual screen
}Plane;
type
indicates the type of the plane : the size of the sprites (16x16 or 8x8), the type of the matrix of tiles and it indicates if the function works in B/W or in grayscales. Its type is TM_GType
, this type is a bit complex, and you don't need to know exactly what it is to use the function, because I wrote macros in the header file which can be used directly like a TM_GType
value. Read the appendix of this document to know all the allowed values.
mode
indicates the draw mode : RPLC
, OR
, MASK
, TRANW
or TRANB
. The type of this parameter is TM_GMode
, this type is complicated too, if you really want to know what it is, look at the header file, but that's not needed to be able to use the functions because I wrote macros in the header file which can be used directly for a parameter TM_GMode
. Read the appendix at the end of this document to know all the allowed values.
This function updates the big virtual screen only if it's needed, so to force the updating, put a nonzero value in the force_update
field. The DrawBuffer
function will clear this field after it updates the big virtual screen. You must do this in the initialization.
You can see an example using this function in the Example 1, provided with the library.
Note : It's strongly recommended to use macros defined in the header file for parameters type
and mode
.
void DrawGrayAnimatedPlane(short x,short y,AnimatedPlane *plane,void *dest1,void *dest2,TM_GMode mode,TM_GAnimType type);
Draw the animated plane plane
form x
and y
coordinates to the screen (virtual or not) dest1/dest2
.
It updates the big virtual screen automatically if needed.
The plane
parameter is the address of an AnimatedPlane
structure, which is defined like this :
typedef struct
{
Plane p;
void *tabanim; // Animation's matrix
short nb_anim; // Number of animations
short nb_step; // Number of animation's step
short step; // Current step number
short step_length; // Length of a step (in frames)
short frame; // Current frame number for the current step
}AnimatedPlane;
This structure contains a Plane
followed by all the necessary informations to animate it.
The matrix of the Plane
will not contain sprite numbers, but animation numbers, and the function will find the corresponding sprite number in the animation's matrix tabanim
.
The parameter mode
works exactly like in the previous function, please look at the appendix to know what are correct values.
The parameter type
works like in the previous function, but its possible values are not the same, they're given in the apppendix.
This function is used in the Example 3, provided with the library.
void DrawTiles(short col,short row,short width,void *matrix,void *dest,void *sprts,TM_TilesTypes type);
Draw the plane matrix
into the destination buffer dest
from line row
and column col
.
This function is a little bit different than others, because it draws directly the tiles (without scrolling them) from the tile matrix into a destination buffer which has the same size as the screen (240x128 pixels).
The drawing mode is RPLC
, so there is no need to erase the destination buffer before calling this function.
Here's the description of the parameters passed to the function :
col
: column of the first tile to draw.
row
: row of the first tile to draw.
width
: tile matrix width.
matrix
: tile matrix.
dest
: destination buffer (this is not a big_vscreen).
sprts
: sprite array.
type
: plane type. Indicates to the function if the tile matrix is a char
matrix or a short
matrix, the size of the tiles (16x16 or 8x8), if they're in grascales or in black and white, and if the function has to draw only what is seen on a TI-89 screen. The type TM_TilesType
is a bit complex, so macros are defined in the header file TileMap.h
which can be used directly like a TM_TilesType
value. They're summarized in the appendix.
void DrawGrayTiles(short col,short row,short width,void *matrix,void *dest1,void *dest2,void *sprts,TM_TilesTypes type);
Draw the plane matrix
into the destination buffer dest1/dest2
from line row
and column col
.
This function is a little bit different than others, because it draws directly the tiles (without scrolling them) from the tile matrix into a destination buffer which has the same size as the screen (240x128 pixels).
The drawing mode is RPLC
, so there is no need to erase the destination buffer before calling this function.
Here's the description of the parameters passed to the function :
col
: column of the first tile to draw.
row
: row of the first tile to draw.
width
: tile matrix width.
matrix
: tile matrix.
dest
: destination buffer (this is not a big_vscreen).
sprts
: sprite array.
type
: plane type. Indicates to the function if the tile matrix is a char
matrix or a short
matrix, the size of the tiles (16x16 or 8x8), if they're in grascales or in black and white, and if the function has to draw only what is seen on a TI-89 screen. The type TM_GTilesType
is a bit complex, so macros are defined in the header file TileMap.h
which can be used directly like a TM_GTilesType
value. They're summarized in the appendix.