Game Clock DLL
Posted: Sun Jun 02, 2013 11:30 pm
This is an oldschool analog chess clock, usable in any game that times the players.
There's no time controls programmed into it at this point. Game in five minutes is what it sets itself to. There will be an infinite number of possibilities in setting it, with primary, secondary and tertiary time controls all selectable with your choice of moves for each time period.
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.
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.