Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' ##############################################################################
- ' # +-------+ #
- ' # DiskManager v 0.1 | # | #
- ' # | O. | #
- ' # 11.12.2011 Alexander Dahmen ] | #
- ' # +-------+ #
- ' # #
- ' ##############################################################################
- ' -- Definitionen --
- #define false 0
- #define true not(false)
- ' ---------- Screen ------------------------------------------------------------
- screen 18,32
- ' ---------- Typen -------------------------------------------------------------
- type tdot
- as integer x
- as integer y
- end type
- type tsquare
- as tdot p1
- as tdot p2
- end type
- type tdisk
- as integer x
- as integer y
- as integer visible
- as integer grab
- as string caption
- as string program(255)
- as tsquare button
- declare sub create (buffer as any ptr,disk as tdisk,number as integer)
- declare sub label (byref disk as tdisk,byval caption as string)
- ' declare sub prog (byref disk() as tdisk,byval progname() as string)
- end type
- type tmouse
- as integer x
- as integer y
- as integer wheel
- as integer key
- as tdot button
- declare sub reload(byref Mouse as tmouse)
- end type
- type tbox
- as tsquare button
- as integer result(1 to 255)
- as integer returned
- end type
- ' ---------- Deklarationen -----------------------------------------------------
- dim Mouse as tmouse
- dim Disk(1 to 255) as tdisk
- dim box as tbox
- dim disknumber as ubyte
- dim key as string*1
- dim i as integer
- declare function inside(sqare as tsquare,dot as tdot) as integer
- declare sub diskbox()
- ' ---------- Sprite-Daten ------------------------------------------------------
- const name_back="Background.bmp"
- const name_disk="DiskBig.bmp"
- const name_dbox="DiskBox.bmp"
- dim ptr_back as any ptr
- dim ptr_disk as any ptr
- dim ptr_dbox as any ptr
- ptr_back=imagecreate(640,480)
- ptr_disk=imagecreate(128,128)
- ptr_dbox=imagecreate(640,480)
- bload name_back,ptr_back
- bload name_disk,ptr_disk
- bload name_dbox,ptr_dbox
- ' ---------- HAUPTPROGRAMM -----------------------------------------------------
- disk(1).x=100
- disk(1).y=200
- disk(1).visible=true
- for i=2 to 255
- disk(i).visible=false
- next
- box.button.p1.x=516
- box.button.p1.y=378
- box.button.p2.x=631
- box.button.p2.y=477
- do
- screenlock
- put (0,0),ptr_back ' Hintergrund setzen
- disk(1).create(ptr_disk,disk(1),1) ' Disk Sprite zeigen
- key=inkey ' Tastatur abfragen
- mouse.reload(mouse) ' \
- mouse.button.x=mouse.x ' } Maus abfagen
- mouse.button.y=mouse.y ' /
- if mouse.key=1 then ' Disketten bewegen
- for i=1 to 255
- if inside(disk(i).button,mouse.button)=true and _
- disk(i).grab=false and _
- disk(i).visible=true then
- disk(i).grab=true ' Den Parameter fΓΌr Greifen einstellen
- exit for
- end if
- next i
- if inside(box.button,mouse.button) and box.returned=false then
- box.returned=true
- diskbox()
- end if
- else
- for i=1 to 255:disk(i).grab=false:next i
- box.returned=false
- end if
- for i=1 to 255
- disk(i).button.p1.x=disk(i).x
- disk(i).button.p1.y=disk(i).y
- disk(i).button.p2.x=disk(i).x+128
- disk(i).button.p2.y=disk(i).y+128
- if disk(i).grab=true then
- disk(i).x=mouse.x-64
- disk(i).y=mouse.y-64
- end if
- next i
- screenunlock
- sleep 10,1
- cls
- loop until key=chr(27)
- if ptr_disk <> 0 then imagedestroy ptr_back
- if ptr_back <> 0 then imagedestroy ptr_disk
- if ptr_dbox <> 0 then imagedestroy ptr_dbox
- end
- ' ---------- Subs --------------------------------------------------------------
- sub tmouse.reload(byref mouse as tmouse)
- with mouse
- getmouse .x,.y,.wheel,.key
- end with
- end sub
- sub tdisk.create (buffer as any ptr,disk as tdisk,number as integer)
- put (disk.x,disk.y),buffer,pset
- draw string (disk.x+65,disk.y+98),str(number),&HFF0000
- end sub
- sub label (byref disk as tdisk,byval caption as string)
- disk.caption=caption
- end sub
- function inside(square as tsquare,dot as tdot) as integer
- if (dot.x>square.p1.x and dot.x<square.p2.x) and (dot.y>square.p1.y and dot.y<square.p2.y) then return true
- end function
- sub diskbox()
- cls
- do:sleep 10:loop until inkey<>""
- ' dim page as integer
- ' dim i as integer
- ' dim chosen as integer
- '
- ' dim key as string*1
- '
- ' dim mouse as tmouse
- ' dim result as boxresult
- '
- ' do
- ' screenlock
- ' put(1,1),back,pset
- ' key=inkey
- ' screenunlock
- ' sleep 10,1
- ' cls
- ' loop until key<>""
- ' sleep
- end sub
Add Comment
Please, Sign In to add comment