55 lines
1.2 KiB
Plaintext
55 lines
1.2 KiB
Plaintext
//$FG,2$This demo uses $FG,4$grbase2$FG,2$, so you must add a$FG$
|
||
//$FG,4$update_win$FG,2$ routine because $FG,4$grbase2$FG,2$ is not$FG$
|
||
//persistent. (It gets erased each update by
|
||
//the system.)
|
||
|
||
|
||
$PI,"<PI 2>",2$
|
||
|
||
|
||
GrBitMap *base=GrAlias(grbase2,Fs);
|
||
|
||
|
||
void DrawIt(TssStruct *tss)
|
||
{
|
||
//Without this, the text of other windows below
|
||
//would appear.
|
||
ClearWinText(tss);
|
||
|
||
//$FG,2$We can change the pen width because it was not$FG$
|
||
//$FG,2$define in $FG,4$CTRL-R$FG,2$.$FG$
|
||
base->pen_width=2;
|
||
base->bkcolor=BLACK;
|
||
GrElemsPlot(base,0,0,0,$IB,"<IB 2>",2$);
|
||
}
|
||
|
||
void Sprite2()
|
||
{
|
||
double theta=0,phi=0;
|
||
I8 *r1,*r2,*temp;
|
||
void *old_update=Fs->update_win;
|
||
Fs->update_win=&DrawIt;
|
||
|
||
base->x=200;
|
||
base->y=200;
|
||
base->flags|=BMF_TRANSFORMATION;
|
||
while (!ScanKey) {
|
||
r1=GrTheta(theta);
|
||
r2=GrPhi(phi);
|
||
|
||
temp=base->r;
|
||
base->r=GrMulMat(r1,r2);
|
||
Free(temp);
|
||
|
||
Free(r1);
|
||
Free(r2);
|
||
|
||
Sleep(40);
|
||
|
||
theta+=pi2/100;
|
||
phi +=pi2/130;
|
||
}
|
||
Fs->update_win=old_update;
|
||
}
|
||
|
||
Sprite2; |