60 lines
1.9 KiB
Plaintext
60 lines
1.9 KiB
Plaintext
//This file uses an image stored in the source
|
|
//code after the text area. CTRL-R was used to
|
|
//create the image. A $$PI$$ enter was generated
|
|
//by CTRL-R. Then, an insert-binary command
|
|
//was added by toggling to plain text mode
|
|
//with CTRL-T, examining the number in the $$PI$$
|
|
//command duplicating it in a $$IB$$ command.
|
|
//
|
|
//The $$IB$$ command behaves like a string constant
|
|
//when compiled. That is, you can assign it to
|
|
//a pointer variable.
|
|
//
|
|
//Note: If you press CTRL-T, the text in quotes
|
|
//on $$PI$$ and $$IB$$ commands was added to make
|
|
//the commands visible. The text is ignored by
|
|
//the compiler. The $$PI$$ command is also ignored
|
|
//but the $$IB$$,$$IS$$ and $$IT$$ commands generate
|
|
//values.
|
|
//
|
|
//Graphics/Sprite1.CPZ uses the persistent graphic base,grbase,
|
|
//while the other GRDEMO's use grbase2 which must
|
|
//be redrawn each update of the screen by the
|
|
//operating system (25Hz). This demo is simpler
|
|
//because you do not need a window update routine.
|
|
|
|
|
|
$PI,"<PI 1>",1$
|
|
|
|
|
|
|
|
|
|
void Sprite1()
|
|
{
|
|
U1 *img=$IB,"",1$;
|
|
GrBitMap *base=GrNew(grbase);
|
|
I4 i;
|
|
PutS("$$CL$$");
|
|
for (i=0;i<grwidth>>2;i++) {
|
|
GrClear;
|
|
|
|
//When the image was generated with CTRL-R, no
|
|
//width was specified, so you can change it here.
|
|
//If you enter a width or color in CTRL-R, you
|
|
//can not change them.
|
|
base->pen_width=3;
|
|
|
|
//"GR_WHITE" is used here because when working
|
|
//with grbase, the graphic elements are XOR'ed
|
|
//onto the screen and you must undo the text
|
|
//background color.
|
|
GrElemsPlot(base,i,grheight>>1,0,img,GR_WHITE);
|
|
|
|
Sleep(3);
|
|
}
|
|
coutln "Image size:",$IS,"<IS 1>",1$;
|
|
coutln "Image type:",$IT,"<IT 1>",1$;
|
|
GrDel(base);
|
|
}
|
|
|
|
Sprite1; |