Code: Select all
Import "chessclock.lib"
CreateGameClock(a,b,c)
CloseGameClock()
PressClock(player)
EndImport
OpenWindow(0,0,0,320,240,"",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
ButtonGadget(1, 30,210,80,20,"Pause")
ButtonGadget(2, 120,210,80,20,"Press White")
ButtonGadget(3, 210,210,80,20,"Press Black ")
CreateGameClock(WindowID(0),10,10)
pressclock(0)
Repeat
EventID = WaitWindowEvent()
Select EventID
Case #PB_Event_CloseWindow
If EventWindow()=0
CloseWindow(0)
EndIf
Case #PB_Event_Gadget
Select EventGadget()
Case 1
PressClock(0) ; Idle
Case 2
PressClock(1) ; White
Case 3
PressClock(2) ; Black
EndSelect
EndSelect
Until EventID=16
End
For example, a common time control would be 40 moves in 2 hours followed by 20 moves in one hour followed by all remaining moves in one hour. Or, all moves in a given number of minutes, say 10 for each side or maybe 10 for one side and 5 for the stronger player. All I'm doing right now is getting feedback and identifying bugs. If you can try it out and help with that, it's much appreciated.
Here's the library:
http://www.lloydsplace.com/chessclock.dll
http://www.lloydsplace.com/chessclock.lib
Please let me know of any bugs or issues if you find them.