;*****************************************************************************************************
; Progam name : Init.pb
; Version     : 1.00a
; Build       : 0001
; PB Version  : 5.62
; Auther      : B.J.Fernhout.
; Copyright   : None
; Date        : 2018
; Discription : Initialization of all variables and loading graphics and sound
;             :
;             :
;*****************************************************************************************************
EnableExplicit

;[Block] Global settings
; your normal Black And white
Global Black         = RGB(0,0,0)
Global White         = RGB(255,255,255)

; These are all normal colours at there brightest
Global _black         = RGB(0,0,0)
Global _red           = RGB(255,0,0)
Global _green         = RGB(0,255,0)
Global _blue          = RGB(0,0,255)
Global _yellow        = RGB(255,255,0)
Global _cyan          = RGB(0,255,255)
Global _magenta       = RGB(255,0,255)

; these are all the colours With there values cut by half
Global dark_red       =RGB(128,0,0)
Global dark_green     =RGB(0,128,0)
Global dark_blue      =RGB(0,0,128)
Global dark_yellow    =RGB(128,128,0)
Global dark_cyan      =RGB(0,128,128)
Global dark_magenta   =RGB(128,0,128)

; all the other colours
Global light_yellow   =RGB(255,255,120)
Global silver         =RGB(176,176,176)
Global _grey          =RGB(130,130,130)
Global dark_grey      =RGB(100,100,100)
Global pale_green     =RGB(152,251,152)
Global light_sky_blue =RGB(135,206,250)
Global orange         =RGB(255,165,0)
Global brown          =RGB(200,150,100)
Global pale_pink      =RGB(255,200,200)
Global light_grey     =RGB(170,170,170)
Global mid_red        =RGB(255,63,63)
Global light_red      =RGB(255,127,127)
Global pink           =RGB(255,191,191)

; set the text line For bitmap fonts.
Global SmallLetters$    = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-!@#$%^&*()<>,.\/?=+[]` "
Global BigLetters$      = "#0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-._ "
Global Active_Case      = 1
Global Score_Player     = 0
Global Level_Player     = 1
Global Stone_Player     = 0
Global Togo_Player      = 30
Global Tim_ShowLevel    = ElapsedMilliseconds()
Global KeyDelay         = ElapsedMilliseconds()
Global CycleTime_Start  = ElapsedMilliseconds()
Global CycleTime_End    = ElapsedMilliseconds()
Global CycleTime_Verschil
Global x1               = 320
Global y1.f             =-9.0
Global s1.f             = 0.30
Global LocX             ;Location in the grid of the game
Global LocY
Global difficulty1      = 5 ;Numbers of jewels
Global DropDown         = #False
Global GameOver         = #False
Global Explosion_Found  = #False
Global Found_Some       = #False
Global Key_Space_Down   = #False
Global ShowUpLevel      = #False
Global MoveTopScore.f   = 0.05
Global MoveGetReady.f   = 0.19
Global MoveTet.f        = 0.02
Global FireWorkMove.f   = 0.015
Global WaveDepth.f      = 20.0
Global LevelMultiplyer  = 0.03
Global Tim_NextFrame    = ElapsedMilliseconds()
Global Angle.f          = 0
Global Set_VolumeMusic  = 50
Global Set_VolumeSound  = 75
;Sparkels of color blocks
Global TotalSparkels    = 0
;Backup step
Global Old_Step
Global DropX.f          = 320.0
Global DropY.f          = -9.0
Global WaitExplosion
Global Explosion_On     = #False
Global HighScoreIn      = #False
Global Name$
Global LevelUp          =0 ; display time of level up
Global Terminate_Game   = #False
;Global SystemFailure     = #False
Global ExplodeSequence  = 0
;Global game variable
Global JoyStick = 0
Global Delays = ElapsedMilliseconds()
;[EndBlock]
;[Block] Collection for array
Global Dim Mounths$(12)
Mounths$(1) = "JAN"
Mounths$(2) = "FEB"
Mounths$(3) = "MAR"
Mounths$(4) = "APR"
Mounths$(5) = "MAY"
Mounths$(6) = "JUN"
Mounths$(7) = "JUL"
Mounths$(8) = "AUG"
Mounths$(9) = "SEP"
Mounths$(10) = "OCT"
Mounths$(11) = "NOV"
Mounths$(12) = "DEC"
;movement
Global Dim Jewel(60)
Global Dim Speed.f(60)
Global Dim Side.f(60)
Global Dim Jump(60)
Global Dim velocity.f(60)
Global Dim acceleration.f(60)
Global Dim x_pos.f(60)
Global Dim speed.f(60)
Global Dim y_pos.f(60)
Global Dim d(60)
;playfield variables
Global Dim Grid (5,12)
Global Dim Colors(5,12)
Global Dim Explode(5,12)
Global Dim Markers(5,12)
Global Dim Drops(2)
Global Dim Awaits(2)
;Animation sequence
Global Dim JewColors(6)
Global Dim Explosions(10)
Global Dim Fonts(50)
Global Dim SmalFonts(60)
;temp variables
Global temp = 0
Global Event
;[EndBlock]
;create Highscore type
Structure ScoreTable_S
  Name$
  Score.i
  date$
  Level.i
EndStructure

Structure Firework_S
  JewelPoint.i
  DirectionX.f
  DirectionY.f
  PosX.f
  PosY.f
  Speed.f
EndStructure

; Now create a List of types
Global Dim HighScore.ScoreTable_S(10)
Global Dim FireWork.Firework_S(60)

;=====================================================================================================
; Initialize the graphics and Sound
;=====================================================================================================




; IDE Options = PureBasic 5.62 (Windows - x64)
; CursorPosition = 133
; FirstLine = 97
; Folding = z
; EnableXP
; CompileSourceDirectory
; EnableCompileCount = 0
; EnableBuildCount = 0
; EnableExeConstant