home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************************
- * *
- * grp.c *
- * *
- ******************************************************************************/
-
- #include <stdlib.h>
- #include <stdio.h>
- #include <math.h>
- #include <swis.h>
- #include <os.h>
- #include <bbc.h>
- #include "GrpLib.h"
-
- #define BLACK 0x00000000
- #define BLUE 0x8B8B8B8B
- #define GREEN 0x63636363
-
- void SetTxtCurPos(int x, int y)
- {
- os_error *err;
- err=bbc_tab(x,y);
- }
-
- int GetClock(void)
- {
- os_regset regs;
- char blk[16];
- int i=0;
- int t=0;
-
- regs.r[0]=0x01; /* read system clock */
- regs.r[1]=(int)blk;
- os_swi(OS_Word,®s);
-
- t+=(int)(blk[i++])<<0;
- t+=(int)(blk[i++])<<8;
- t+=(int)(blk[i++])<<16;
- t+=(int)(blk[i++])<<24;
-
- return(t);
- }
-
- int xorg = 160,yorg = 128,dist = 640;
-
- void ReadMouse(int *x, int *y, int *b)
- {
- os_regset regs;
-
- os_swi(OS_Mouse,®s);
- *x=regs.r[0];
- *y=regs.r[1];
- *b=regs.r[2];
- }
-
- int Inkey()
- {
- os_regset regs;
-
- regs.r[0] = 129; /* kb read */
- regs.r[1] = 0; /* wait time low byte */
- regs.r[2] = 0; /* wait time high byte */
- os_swi(OS_Byte,®s);
- return( (regs.r[2]==0) ? regs.r[1] : 0);
- }
-
- /*****************************************************************************/
-
- /*****************************************************************************/
-
- #define PI 3.14159265359
-
- int main()
- {
-
- int time=0;
- char c;
- char *sprite;
- float t=0;
-
- InitGrp();
- Change2DParm(0,0,319,255);
-
- sprite = load("<Demo4$Dir>.F1");
-
- SwapView(0x00000000);
-
- while (1==1) {
-
- GrpReg[ 0] = (int)(128*cos(t- PI/2)+160);
- GrpReg[ 1] = (int)(128*sin(t- PI/2)+128);
- GrpReg[ 2] = (int)(128*cos(t- PI/6)+160);
- GrpReg[ 3] = (int)(128*sin(t- PI/6)+128);
- GrpReg[ 4] = (int)(128*cos(t+ PI/2)+160);
- GrpReg[ 5] = (int)(128*sin(t+ PI/2)+128);
- GrpReg[ 6] = 100+30*cos(- PI/2);
- GrpReg[ 7] = 150+30*sin(- PI/2);
- GrpReg[ 8] = 100+30*cos(- PI/6);
- GrpReg[ 9] = 150+30*sin(- PI/6);
- GrpReg[10] = 100+30*cos(+ PI/2);
- GrpReg[11] = 150+30*sin(+ PI/2);
- GrpReg[12] = (int)sprite;
- CallGrp(GrpReg,GrpStack,Spr2DPoly3);
-
- GrpReg[ 0] = (int)(128*cos(t- PI/2)+160);
- GrpReg[ 1] = (int)(128*sin(t- PI/2)+128);
- GrpReg[ 2] = (int)(128*cos(t-5*PI/6)+160);
- GrpReg[ 3] = (int)(128*sin(t-5*PI/6)+128);
- GrpReg[ 4] = (int)(128*cos(t+ PI/2)+160);
- GrpReg[ 5] = (int)(128*sin(t+ PI/2)+128);
- GrpReg[ 6] = 100+30*cos(- PI/2);
- GrpReg[ 7] = 150+30*sin(- PI/2);
- GrpReg[ 8] = 100+30*cos(-5*PI/6);
- GrpReg[ 9] = 150+30*sin(-5*PI/6);
- GrpReg[10] = 100+30*cos(+ PI/2);
- GrpReg[11] = 150+30*sin(+ PI/2);
- GrpReg[12] = (int)sprite;
- CallGrp(GrpReg,GrpStack,Spr2DPoly3);
-
- SwapView(0x00000000);
-
- while ((c=Inkey()) == 0);
-
- switch(c) {
- case '+' : t+= 0.03; break;
- case '-' : t-= 0.03; break;
- }
-
- }
-
- }
-