Restored from previous forum. Originally posted by Danilo.
Question:
How do i use the commands from the Timer-Library ??
Answer:
---------------
Code: Select all
;EXAMPLE USAGE NOTE:
;this example requires the use of the PBOSL_Timer library from
;the PureBasic OpenSource Libraries (PBOSL) set, which can be
;downloaded from http://pbosl.purearea.net/index.php?site=Libs
;and should be copied to the \PureLibraries\UserLibraries folder
#ScreenBits = 32
#ScreenWidth = 640
#ScreenHeight = 480
Define y, size, flag, color
Procedure Timer()
Shared y, size, flag, color
y + #ScreenHeight / 200
If y > #ScreenHeight
y = 0
EndIf
color = (size << 3) - 1
If size < 32 And flag = 0
size + 1
Else
flag = 1
size - 1
If size = 0
flag = 0
EndIf
EndIf
EndProcedure
If InitSprite() And InitKeyboard()
If OpenScreen(#ScreenWidth, #ScreenHeight, #ScreenBits, "Timer Test")
StartTimer(0, 15, @Timer()) ;function of PBOSL_Timer library
Repeat
ExamineKeyboard()
FlipBuffers()
ClearScreen(RGB(0, 0, 0))
StartDrawing(ScreenOutput())
FrontColor(RGB(color, color, 0))
Box((#ScreenWidth / 2) - size, y, size, size)
StopDrawing()
Until KeyboardPushed(#PB_Key_Escape)
EndTimer(0)
Else
MessageRequester("ERROR", "Can't initialize DirectX 7 or later.", 0)
EndIf
Else
MessageRequester("ERROR", "Can't open DirectX screen.", 0)
EndIf
cya,
...Danilo
(registered PureBasic user)
Edited by - Danilo on 16 April 2002 08:17:07