Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- OPTION STRICT
- ACLS
- XSCREEN 0
- '-Variables-
- VAR I% 'Generic loop counter
- VAR T% 'Past MAINCNT
- VAR CHFLAG% 'Text change flag
- VAR ST% 'Current text string
- VAR ANG# 'Sine/rotate angle
- VAR TCY%=179 'Text y-alignment
- VAR VCX%=199 'Vector x-alignment
- VAR VCY%=59 'Vector y-alignment
- VAR VSC#=50 'Vector scale factor
- VAR VCL%=&HFFFFFFFF 'Vector color
- VAR SDP#=25 'Sine depth
- VAR STM%=0 'String pointer max
- '-Arrays-
- DIM ARR#[10,2] 'Vector data LOAD
- DIM VTX#[5,2] 'Vector vertex data
- DIM ROT#[5,2] 'Rotated vertices
- DIM LIN%[5,2] 'Vector line data
- '-DEFs-
- 'Callback for text control
- DEF TEXTCALL
- IF CHFLAG% THEN
- SPCHR CALLIDX,CALLIDX,24*ST%,1,24
- ENDIF
- SPOFS CALLIDX,199,TCY%+ROUND(SDP#*SIN(RAD(ANG#+(CALLIDX/399)*360)))
- SPROT CALLIDX,ANG#
- SPCOLOR CALLIDX,RGB(255,0,0)
- END
- 'Callback for vector control
- DEF VECTORCALL
- VAR OY%
- SPOFS CALLIDX OUT ,OY%
- SPOFS CALLIDX,VCX%+ROUND(SDP#*COS(RAD(ANG#*2+((CALLIDX-400)/(VSC#*2))*360))),OY%
- END
- 'Draws vector shape
- DEF DRAWVEC VTX#,LIN%,CTX%,CTY%,SCF#,COL%
- VAR LINC%=(LEN(LIN%)>>1)-1
- VAR I%
- VAR DX0%,DY0%,DX1%,DY1%
- FOR I%=0 TO LINC%
- DX0%=ROUND(VTX#[LIN%[I%,0],0]*SCF#)+CTX%
- DY0%=ROUND(-VTX#[LIN%[I%,0],1]*SCF#)+CTY%
- DX1%=ROUND(VTX#[LIN%[I%,1],0]*SCF#)+CTX%
- DY1%=ROUND(-VTX#[LIN%[I%,1],1]*SCF#)+CTY%
- GLINE DX0%,DY0%,DX1%,DY1%,COL%
- NEXT
- END
- 'Rotates vertices in array
- DEF ROTVTX VTXI#,VTXO#,RAD#
- VAR VTXC%=(LEN(LIN%)>>1)-1
- VAR I%
- VAR C#=COS(RAD#)
- VAR S#=SIN(RAD#)
- FOR I%=0 TO VTXC%
- VTXO#[I%,0]=VTXI#[I%,0]*C#-VTXI#[I%,1]*S#
- VTXO#[I%,1]=VTXI#[I%,0]*S#+VTXI#[I%,1]*C#
- NEXT
- END
- '-Text setup-
- FOR I%=0 TO 399
- SPSET I%,I%,0,1,24,0
- SPHOME I%,199-I%,11
- SPOFS I%,199,TCY%
- SPCOLOR I%,RGB(255,0,0)
- SPFUNC I%,"TEXTCALL"
- SPSHOW I%
- NEXT
- LOAD"GRP4:TEXT",0
- '-Vector setup-
- FOR I%=0 TO VSC#*2
- SPSET I%+400,VCX%-VSC#,VCY%+(400-VSC#)+I%,VSC#*2+1,1,0
- SPHOME I%+400,VSC#-1,0
- SPOFS I%+400,VCX%,VCY%-VSC#+I%
- SPFUNC I%+400,"VECTORCALL"
- SPSHOW I%+400
- NEXT
- LOAD"DAT:VECTOR",ARR#,0
- COPY VTX#,ARR#,10
- COPY LIN%,ARR#,10,10
- GCOLOR VCL%
- 'Main loop
- T%=MAINCNT
- WHILE 1
- VSYNC
- 'Text change timer
- IF MAINCNT-T%>=180 THEN
- T%=MAINCNT
- INC ST%
- IF ST%>STM% THEN ST%=0
- CHFLAG%=1
- ENDIF
- 'Update vector graphic
- ROTVTX VTX#,ROT#,RAD(ANG#)
- GPAGE 0,2
- GCLS
- DRAWVEC ROT#,LIN%,VCX%,VCY%,VSC#,VCL%
- GCIRCLE VCX%,VCY%,VSC#
- GPAGE 0,4
- GCOPY 2,VCX%-VSC#,VCY%-VSC#,VCX%+VSC#,VCY%+VSC#,VCX%-VSC#,VCY%+(400-VSC#),1
- 'Manage sprites
- CALL SPRITE
- IF CHFLAG% THEN CHFLAG%=0
- INC ANG#,2.5
- WEND
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement