home *** CD-ROM | disk | FTP | other *** search
- rem File Showcase
-
- rem Standard Setup Code for all examples
- set text font "arial" : set text size 20
- set text to bold : set text transparent
-
- rem Arra to hold data
- type pos x y endtype
- dim coord(100) as pos
-
- rem Mainloop
- coordmax=0
- do
-
- rem a pretty backdrop
- prettybackdrop()
-
- rem Title
- center text screen width()/2,20,"SIMPLE DATABASE OF CO-ORDINATES"
- center text screen width()/2,screen height()-30,"Click To Draw Lines then Press [R] to Replay"
-
- rem Show coords so far
- for n=0 to coordmax-1
- dot coord(n).x,coord(n).y
- next n
-
- rem Record or Playback
- if mouseclick()=1
- if cl=0
- coord(coordmax).x=mousex()
- coord(coordmax).y=mousey()
- inc coordmax : if coordmax>99 then coordmax=99
- cl=1
- endif
- else
- cl=0
- endif
-
- rem Playback
- if inkey$()="r"
-
- rem Save data
- if coordmax>0
- delete file "coordata.dat"
- open to write 1,"coordata.dat"
- write file 1,coordmax
- for n=0 to coordmax
- write file 1,coord(n).x
- write file 1,coord(n).y
- next n
- close file 1
- endif
-
- rem Clear data
- for n=0 to 100
- coord(n).x=0
- coord(n).y=0
- next n
-
- rem Load data
- open to read 1,"coordata.dat"
- read file 1,coordmax
- for n=0 to coordmax
- read file 1,coord(n).x
- read file 1,coord(n).y
- next n
- close file 1
-
- rem Draw data
- for n=0 to coordmax-1
- if n>0 then line nx,ny,coord(n).x,coord(n).y
- nx=coord(n).x
- ny=coord(n).y
- sleep 100
- next n
- sleep 2000
-
- rem Reset write ptr
- coordmax=0
-
- endif
-
- rem Update screen
- sync
-
- rem Endloop
- loop
-
- rem Pretty Backdrop Function
- function prettybackdrop()
- box 0,0,640,480,rgb(0,128,128),rgb(128,0,0),rgb(128,0,128),rgb(128,128,0)
- endfunction
-