Digital Clock

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
Guimauve
Enthusiast
Enthusiast
Posts: 742
Joined: Wed Oct 22, 2003 2:51 am
Location: Canada

Digital Clock

Post by Guimauve »

Hello everyone.

This is a full screen digital clock. The default setting are in french but see in the InitDigitalClock() and uncomment the english setting then comment the french setting to see the date in english.

As always the programming technics is Based Object Porgramming (BOP)

Have fun

Regards
Guimauve

File:1->DigitalClock.zip
Image
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

nice, that is a pretty and instructive code.
thank you guimauve.

you forget to remove your custom RGBColor() macro or function in one of the includes. i just changed it to RGB() and it's OK.
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
User avatar
Guimauve
Enthusiast
Enthusiast
Posts: 742
Joined: Wed Oct 22, 2003 2:51 am
Location: Canada

Post by Guimauve »

:?

This is the correction. Just copy replace this procedure or edit directly.

Code: Select all

Procedure DrawStarField(*StarFieldA.StarField)
  
  StartDrawing(ScreenOutput()) ;>
    
    DrawingMode(1) 
    
    For Index = 0 To #STARFIELD_STAR_MAX - 1
      
      GetStarFieldPosZ(*StarFieldA, Index) - GetStarFieldSpeed(*StarFieldA, Index)
      
      SX = GetStarFieldPosX(*StarFieldA, Index) / GetStarFieldPosZ(*StarFieldA, Index) * 100 + GetStarFieldScreenWidth(*StarFieldA) / 2 
      SY = GetStarFieldPosY(*StarFieldA, Index) / GetStarFieldPosZ(*StarFieldA, Index) * 100 + GetStarFieldScreenHeight(*StarFieldA) / 2 
      
      If SX < 0 Or SY < 0 Or SX >= GetStarFieldScreenWidth(*StarFieldA) Or SY >= GetStarFieldScreenHeight(*StarFieldA) Or GetStarFieldPosZ(*StarFieldA, Index) < 1 
        
        RefreshStar3D(*StarFieldA, Index)
        
      Else 
        
        Couleur = Int(255 - GetStarFieldPosZ(*StarFieldA, Index) * (255/1000))
        Plot(SX, SY, RGB(Couleur,Couleur,Couleur)) ; Here change RGBColor() with RGB()
        
      EndIf 
      
    Next 
    
  StopDrawing() ;<
  
EndProcedure
Thanks Flype

Regards
Guimauve
Post Reply