Form
#include "sgl.h"
void * dist;
Uint16 size_x;
Uint16 size_y;
void slGetFrameData (dist, size_x, size_y);
argument
void * dist-
Uint16 size_x --X size after being read.
Uint16 size_y --Y size after being read.
Number of returns
void --Nothing is returned.
function
Reads the contents of the frame buffer (for one screen), scales (thinns) to the specified size, and sets it.
Since it is processed in units of 4 dots, the X size is a multiple of 4.
The buffer has 2 bytes / dot for low resolution and 1 byte / dot for high resolution.
And write.
Example
If you want to display the read data as a sprite,
Low resolution:
slSpriteColMode ( SPR_PAL_RGB ); / * default * /
year,
SPR_ATTRIBUTE (PN_???, No_Palet , No_Gouraud , SPdis | ECdis | CL32KRGB ,
sprNoflip );
Execute the sprite display function with attributes such as.
For high resolution slSpriteColMode ( SPR_PAL );
SPR_ATTRIBUTE (PN_???, No_Palet , No_Gouraud , SPdis | ECdis | CL256Bnk ,
sprNoflip );
It is displayed by the attribute of.
caution
This function waits for VDP1 to finish drawing, skips the frame buffer, and
It is set in the buffer. Since reading the frame buffer has a considerable weight, it takes about 5 msec. At 32x24 (= 768) dots.
Please use it paying attention to the processing time.
It is better to take the buffer to be read on the work and transfer it to VRAM by blanking.
It seems to have less weight than deploying directly to VRAM.
reference
Form
#include "sgl.h"
FIXED pos [ XYZS ];
ATTR * attr;
ANGLE z_ang;
Bool slDispSprite (pos, atrb, z_ang);
argument
FIXED pos [ XYZS ] --Sprite position.
ATTR * attr --Sprite attributes.
ANGLE z_ang --Sprite rotation angle.
Number of returns
Bool --Error code (see below).
function
Specify the position, scale, and angle of rotation to display the sprite.
Similar to slPutPolygon (), it also sorts by Z value.
If a negative value is specified for the scale, the scale will be calculated based on the Z position.
Multiply the scale complement to get the scale for display.
For example, if you specify -2.0 for the scale and it is in a position (Z position) where it is displayed at 0.5 times, it will be displayed at 1.0 times.
If the scale is zero, the sprite's display coordinates (Z) are too far, or an attempt is made to display a sprite that exceeds the maximum display number, the error code FALSE is returned.
Example
FIXED pos [ XYZS ] = {
toFIXED (0.0), toFIXED (0.0), toFIXED (110.0), toFIXED ( ORIGINAL )
};
SPR_ATTR attr = SPR_ATTRIBUTE (0, 0, No_Gouraud , CL16Bnk , sprNoflip | _ZmCC );
slDispSprite (pos, attr, DEGtoANG (0.0));
caution
This function uses the slave CPU to get the coordinate values and determine the sort.
reference
Form
#include "sgl.h"
FIXED pos [ XYZSS ];
ATTR * attr;
ANGLE z_ang;
Bool slDispSpriteHV (pos, attr, z_ang);
argument
FIXED pos [ XYZSS ] --Sprite position.
ATTR * attr --Sprite attributes.
ANGLE z_ang --Sprite rotation angle.
Number of returns
Bool --Error code (see below).
function
Display the deformed sprite by specifying the vertical and horizontal display scales.
Unlike the slDispSprite () function above, if you specify a negative scale, the character will be highlighted.
If the scale is zero, the sprite's display coordinates (Z) are too far, or an attempt is made to display a sprite that exceeds the number displayed, the error FALSE is returned.
Example
#define FX0 toFIXED (0.0)
FIXED pos [ XYZSS ] = {
FX0, FX0, toFIXED (110.0), toFIXED ( ORIGINAL ), toFIXED (2.0)
};
SPR_ATTR attr = SPR_ATTRIBUTE (0, 0, No_Gouraud , CL16Bnk , sprNoflip | _ZmCC );
slDispSpriteHV (pos, attr, DEGtoANG (0.0));
caution
This function uses the master CPU to get the coordinate values and determine the sort.
reference
Form
#include "sgl.h"
FIXED pos [ XYZSS ];
ATTR * attr;
ANGLE z_ang;
Bool slDispSpriteSZ (pos, attr, ang_z);
argument
FIXED pos [ XYZSS ] --Sprite position.
ATTR * attr --Sprite attributes.
ANGLE z_ang --Sprite rotation angle.
Number of returns
Bool --Error code (see below).
function
Display the deformed sprite by specifying the vertical and horizontal display sizes.
If a negative size is specified, it will be displayed in reverse.
Returns error FALSE if the size is zero, the sprite's display coordinates (Z) are too far, or if you try to display more sprites than the number displayed.
Example
#define FX0 toFIXED (0.0)
FIXED pos [ XYZSS ] = {
toFIXED (30.0), FX0, toFIXED (110.0), toFIXED (0.5), toFIXED (2.0)
};
SPR_ATTR attr = SPR_ATTRIBUTE (0, 0, No_Gouraud , CL16Bnk [a], sprNoflip | _ZmCC );
slDispSpriteSZ (pos, attr, DEGtoANG (0.0));
caution
This function uses the master CPU to get the coordinate values and determine the sort.
reference
Form
#include "sgl.h"
FIXED pos [4] [ XY ];
FIXED pos_z;
SPR_ATTR * attr;
Bool slDispSprite4P (pos, pos_z, attr);
argument
FIXED pos [4] [ XY ] --Coordinates of 4 vertices.
FIXED pos_z; --Sort reference value.
SPR_ATTR * attr; --Attribute.
Number of returns
Bool --Error code (see below).
function
Specify 4 points on the screen to display the deformed sprite.
The four points are specified by the offset position with respect to the center of the window, and the Z position that represents the whole is specified separately.
Specify the 4 points in the order of upper left, upper right, lower right, lower left (clockwise).
If any of the four points exceed the range of the clip, the error code FALSE is returned.
Example
FIXED pos [4] [ XY ] = {
{ toFIXED (0.0), toFIXED (0.0)},
{ toFIXED (40.0), toFIXED (10.0)},
{ toFIXED (70.0), toFIXED (60.0)},
{ toFIXED (10.0), toFIXED (50.0)}
};
SPR_ATTR attr = SPR_ATTRIBUTE (2, 0x100, No_Gouraud , CL16Bnk ,
sprNoflip | _ZmCC );
slDispSprite4P (pos, toFIXED (150.0), attr);
caution
This function uses the master CPU to get the coordinate values and determine the sort.
reference
Form
#include "sgl.h"
SPRITE * spr;
FIXED pos_z;
Bool slSetSprite (spr, pos_z);
argument
SPRITE * spr --VDP1 command data to display.
FIXED pos_z --Criteria for sorting.
Number of returns
Bool --Error code (see below).
function
Sets the sprite control command data to be passed to the hardware in the transfer list.
Use this when you want to set a modified sprite that cannot be created by a library function, or a window that affects only a specific sprite.
Returns the error code FALSE if the maximum number of polygons is exceeded or if it is used beyond the Z clipping boundary.
Example
SPRITE attr = {
FUNC_Sprite , / * Drawing Sprite * /
0, / * Link (Ignore) * /
ECdis | SPenb | CL16Look | CL_Trans , / * Color mode. * /
(0x1b000 >> 3), / * Color bank number. * /
(0x12400 >> 3), / * Character address. * /
((64/8) << 8 | 96), / * Character size ((x / 8) << 8 | y) * /
0, / * A (x) * /
0, / * A (y) * /
64, / * B (x) * /
0, / * B (y) * /
64, / * C (x) * /
96, / * C (y) * /
0, / * D (x) * /
96, / * D (y) * /
0, / * Gouraud table address * /
0 / * Dummy. * /
};
slSetSprite (attr, toFIXED (145.0));
caution
This function uses the slave CPU to determine the sort.
reference
Form
#include "sgl.h"
Sint16 left, top, right, bottom;
Uint16 zlim;
Sint16 cen_x, cen_y;
Bool slWindow (left, top, right, bottom, zlim, cen_x, cen_y);
argument
Sint16 left --The right edge of the window.
Sint16 top --The top of the window.
Sint16 right --The left edge of the window.
Sint16 bottom --The bottom of the window.
Uint16 zlim --Z limit.
Sint16 cen_x --X coordinate of vanishing point (coordinate origin).
Sint16 cen_y --Y coordinate of vanishing point (coordinate origin).
Number of returns
Bool --Error code (see below).
function
Set the range to limit the display of sprites and polygons.
The display range is the position on the TV screen and can be specified up to twice during display.
zlim will not be displayed beyond this.
cen_x and cen_y are the vanishing point positions for polygons and the coordinate origins for sprites.
The position on the screen is (0, 0) in the upper left and (319, 223) in the lower right <normal screen size>
is.
When the total number of windows is 3 or more, FALSE is returned as the return value of the function. If successful, TRUE will be returned.
Example
The upper left coordinate (10,15) and lower right coordinate (300,195) of the window, the vanishing point is the center of this window, and the Z limit value is 5000h.
slWindow (10, 15, 300, 195, 0x5000, 145, 75);
See also the note below.
caution
slPutPolygon (), before calling slWindow ()
If you use a sprite-setting function such as slPutSprite (), they will use a full-screen window, and the second window will be set by the renamed slWindow ().
Usually slWindow (...); / * Window 1 * /
...
slPutPolygon (...);
slPutSprite (...);
...
slWindow (...); / * Window 2 * /
...
slPutSprite (...);
slPutPolygon (...);
Set the window at the beginning of the process, and set another window again where you want to switch.
reference