Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include once "fbgfx.bi"
- #include once "string.bi"
- type stopwatch_struct
- as double staTime
- as double stoTime
- as integer curHr
- as integer curMn
- as integer curSc
- as integer FinHr
- as integer FinMn
- as integer FinSc
- as string strHr
- as string strMn
- as string strSc
- declare sub start()
- declare function lap() as string
- declare function update() as string
- end type
- sub stopwatch_struct.start()
- staTime = timer
- end sub
- function stopwatch_struct.lap() as string
- static as string thisTime
- dim as double tTime = (timer-staTime)
- dim as integer decPos = instr( str(tTime), "." )
- finHr = int(tTime/3600)
- finMn = int(tTime/60) mod 60
- finSc = int(tTime) mod 60
- dim as string curTime = str(tTime)
- dim as string fracTime = str(mid( curTime, decPos+1, 4))
- return format(curHr, "00") + ":" + format(curMn, "00") + ":" + format(curSc, "00") + ":" + fracTime
- end function
- function stopwatch_struct.update() as string
- static as string thisTime
- dim as double tTime = (timer-staTime)
- dim as integer decPos = instr( str(tTime), "." )
- curHr = int(tTime/3600)
- curMn = int(tTime/60) mod 60
- curSc = int(tTime) mod 60
- dim as string curTime = str(tTime)
- dim as string fracTime = str(mid( curTime, decPos+1, 4))
- return format(curHr, "00") + ":" + format(curMn, "00") + ":" + format(curSc, "00") + ":" + fracTime
- end function
- dim as stopwatch_struct stopwatch
- stopwatch.start()
- screenres 640, 480, 32
- dim as string outTime
- do
- if multikey(fb.sc_space) then
- outTime = stopwatch.lap()
- stopwatch.start()
- do
- screencontrol (FB.POLL_EVENTS)
- loop while multikey(fb.sc_space)
- end if
- screenlock
- cls
- print "Press space for lap..."
- print outTime
- print stopwatch.update()
- screenunlock
- sleep 3,1
- loop until multikey(fb.sc_escape)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement