home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
623a.lha
/
TurboDEX
/
ExampleSources
/
vector.dex
< prev
next >
Wrap
Text File
|
1992-03-22
|
3KB
|
113 lines
' vectordemo
PROC init()
DEF screenx=400:INT, screeny=320:INT, maxframe=49:INT, maxline=26:INT
DEF coordinates=10400:ARRAY, screenadr1:LONG, screenadr2:LONG
DEF rast1:LONG, rast2:LONG, out:LONG
VOID makedata()
VOID view(90,13)
screenadr1 := screen(screenx,screeny,2,0,' ')
rast1 := screenadr1+84
VOID setcolours(screenadr1)
screenadr2 := screen(screenx,screeny,2,0,' ')
rast2 := screenadr2+84
VOID setcolours(screenadr2)
ENDPROC screenadr1*screenadr2
PROC main()
DEF frame:INT, line:REGINT, actual=0:LONG, rast:LONG, screen:LONG
DEF x:REGINT, y:REGINT, colour:REGLONG, frameoffset:REGLONG
DEF lineoffset:REGLONG, suxxes:LONG
suxxes := init()
IF suxxes=0
WRITE 'Could not open screens!\n'
ELSE
MOUSE
FOR frame,maxframe,0,-1
rast := rast1
screen := screenadr1
IF actual=1
rast := rast2
screen := screenadr2
ENDIF
VOID SetRast(rast,0)
colour := 1
frameoffset := maxline*frame*8+coordinates
DOWN line,maxline
lineoffset := line*8+frameoffset
VOID SetAPen(rast,colour)
x := MINT(lineoffset)
y := MINT(lineoffset+2)
VOID Move(rast,x,y)
x := MINT(lineoffset+4)
y := MINT(lineoffset+6)
VOID Draw(rast,x,y)
INC 1,colour
IF colour>3
colour := 1
ENDIF
ENDDOWN
JUMPMOUSE exit
VOID ScreenToFront(screen)
DMACON := 32
actual := 1-actual
ENDFOR
ENDMOUSE
ENDIF
exit:
VOID cleanup()
ENDPROC
PROC cleanup()
IF screenadr1?0
VOID CloseScreen(screenadr1)
ENDIF
IF screenadr2?0
VOID CloseScreen(screenadr2)
ENDIF
VOID view(129,44)
ENDPROC
PROC makedata()
LOCAL adr:REGLONG, count:REGLONG, dummy:REGINT
adr := {vectordata}
dummy := 0
FOR count,0,5199
dummy := MCHAR(adr+count)
AND 255,dummy
MINT count*2+coordinates,dummy*2
ENDFOR
STRUCT vectordata
INCLUDE dex:vector/TDEX.BIN
ENDSTRUCT
ENDPROC
PROC view( x, y)
LOCAL x:INT, y:INT, viewadr:LONG
viewadr := ViewAddress()
MINT viewadr+14, x
MINT viewadr+12, y
VOID RemakeDisplay()
ENDPROC
PROC setcolours( rastport)
LOCAL rastport:LONG, viewadr:LONG
viewadr := rastport+44
VOID SetRGB4(viewadr,0,0,0,0)
VOID SetRGB4(viewadr,1,5,5,15)
VOID SetRGB4(viewadr,2,15,5,5)
VOID SetRGB4(viewadr,3,15,15,5)
ENDPROC
PROC screen( width, height, depth, mode, title)
LOCAL width[ns.4]:INT, height[ns.6]:INT, depth[ns.8]:INT, mode[ns.12]:INT
LOCAL title[ns.20]:LONG, return:REGLONG
return := OpenScreen({ns})
STRUCT ns
INT 0,0,320,256,2,$203,0,1
LONG 0,0,0,0
ENDSTRUCT
ENDPROC return