Files
TempleOS-Rijn/LT/Demo/Graphics/Sprite1.CPZ
T
2018-09-08 21:45:20 +02:00

61 lines
1.9 KiB
Plaintext

/*
Graphics can be place into source code
files. The actual data is stored in the
file after the text area. $FG,2$CTRL-R$FG$ was used
to generate the graphic. A picture $FG,2$$$PI$$$FG$
entry was created by $FG,2$CTRL-R$FG$. Press $FG,2$CTRL-T$FG$ to
toggle to plain text mode and see
how it is encoded. You can place any text
you want in the quotes. The text doesn't matter,
but the number does matter. The number identifies
the picture and cannot be changed.
You make use of a picture in a program by entering
"insert binary", $FG,2$$$IB$$$FG$ commands by hand after pressing
$FG,2$CTRL-T$FG$. They behave like string constants
when compiled. That is, they are pointers.
$FG,2$Sprite1.CPZ$FG$ uses the persistent graphic base, $FG,2$Gs->grbase$FG$,
while the other demo's use $FG,2$grbase2$FG$ which must
be redrawn each update of the screen (by the
window manager task). This demo is simpler
because you do not need a window update routine.
*/
$PI,"<PI 1>",1$
void Sprite1()
{
GrBitMap *base=GrAlias(Gs->grbase,Fs);
I8 i;
PutS("$$CL$$");
for (i=0;i<GR_WIDTH>>2;i++) {
GrClear;
//When the image was generated with $FG,2$CTRL-R$FG$, no
//width was specified, so you can change it here.
//If you enter a width or color in $FG,2$CTRL-R$FG$, you
//can not change them.
base->pen_width=3;
//$FG,2$WHITE$FG$ is used here because when working
//with Gs->grbase, the graphic elements are XOR'ed
//onto the screen and you must undo the text
//background color.
base->bkcolor=WHITE;
GrElemsPlot(base,i,GR_HEIGHT>>1,0,$IB,"<IB 1>",1$);
Sleep(3);
}
coutln "Image size:",$IS,"<IS 1>",1$;
coutln "Image type:",$IT,"<IT 1>",1$;
GrDel(base);
}
Sprite1;®#øÿÿÿ#øÿÿÿ1 1 ""***þÿÿÿþÿÿÿ*