Timer

Share your advanced PureBasic knowledge/code with the community.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4954
Joined: Sun Apr 12, 2009 6:27 am

Timer

Post by RASHAD »

PB gets better more each round
Thanks team

Code: Select all

Procedure TimeCB(parameter)
  LoadFont(0,"Tahoma",10)
  t = ElapsedMilliseconds()
  Color = RGBA(Random($FF,$80),Random($FF,$80),Random($FF,$80),255)
Repeat
    cir=sec*6
  StartVectorDrawing(CanvasVectorOutput(0))
    ;If sec = 0
     AddPathCircle(50, 50, 23,0,360)
     VectorSourceColor($FFBDF2FE)
     StrokePath(46)
    ;EndIf
     AddPathBox(24, 42, 52,14)
     VectorSourceColor($FF29D5FC)
     StrokePath(14)
     VectorFont(FontID(0), 24)           
     VectorSourceColor($FFFF0000)
     MovePathCursor(20,35,#PB_Path_Default)
     DrawVectorText(RSet(Str(min),2,"0"))
     MovePathCursor(54,35,#PB_Path_Default)
     DrawVectorText(RSet(Str(sec),2,"0"))
     AddPathCircle(50, 50, 40,cir,cir+2)
     VectorSourceColor(Color)
     StrokePath(40)       
  StopVectorDrawing()
  sec = (ElapsedMilliseconds()-t)*60/1000
  If sec > 60
     Color = RGBA(Random($FF,$80),Random($FF,$80),Random($FF,$80),255)
     t = ElapsedMilliseconds()
     sec = 0
     min + 1
  ElseIf min = 60
     sec = 0
  EndIf
Until min > 60
EndProcedure
   
If OpenWindow(0, 0, 0, 300, 250, "One Min Timer", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  SetWindowColor(0,$FFFFFF)
  CanvasGadget(0, 100, 75, 100, 100)
  thread = CreateThread(@TimeCB(),10)
Repeat
  Select WaitWindowEvent()
     Case #PB_Event_CloseWindow
        If IsThread(thread)
           KillThread(thread)
        EndIf
        Quit = 1
  EndSelect
Until Quit = 1
EndIf
Edit : Modified
Last edited by RASHAD on Sun Jan 10, 2016 12:31 pm, edited 1 time in total.
Egypt my love
User avatar
BasicallyPure
Enthusiast
Enthusiast
Posts: 539
Joined: Thu Mar 24, 2011 12:40 am
Location: Iowa, USA

Re: Timer

Post by BasicallyPure »

Nice demo. :)
I really haven't taken the time to play with any of the new vector drawing commands yet.
BasicallyPure
Until you know everything you know nothing, all you have is what you believe.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4954
Joined: Sun Apr 12, 2009 6:27 am

Re: Timer

Post by RASHAD »

Thanks BP :D
Time to relax some how
Egypt my love
User avatar
RSBasic
Moderator
Moderator
Posts: 1228
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: Timer

Post by RSBasic »

Nice :)
Image
Image
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4954
Joined: Sun Apr 12, 2009 6:27 am

Re: Timer

Post by RASHAD »

Thanks RSBasic
Previous post updated
Egypt my love
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Timer

Post by Kwai chang caine »

Yeeeess !!! you good begining the years...
Works great, one moment, i have believe it's create in JAVA :lol:
Thankls a lot for sharing 8)
ImageThe happiness is a road...
Not a destination
Post Reply