48 lines
No EOL
1.2 KiB
Text
48 lines
No EOL
1.2 KiB
Text
; In this file, we handle alle the events
|
|
|
|
Procedure HandleEventMenu()
|
|
If KeyboardReleased(#PB_Key_Up)
|
|
PlaySound(0, #PB_Sound_MultiChannel)
|
|
Menu_GotoCurrent()
|
|
*ActiveMenu\Entries()\Selected = #False
|
|
|
|
If ListIndex(*ActiveMenu\Entries()) = 0
|
|
LastElement(*ActiveMenu\Entries())
|
|
Else
|
|
PreviousElement(*ActiveMenu\Entries())
|
|
EndIf
|
|
|
|
*ActiveMenu\Entries()\Selected = #True
|
|
EndIf
|
|
|
|
If KeyboardReleased(#PB_Key_Down)
|
|
PlaySound(0, #PB_Sound_MultiChannel)
|
|
Menu_GotoCurrent()
|
|
*ActiveMenu\Entries()\Selected = #False
|
|
|
|
If ListIndex(*ActiveMenu\Entries()) = (ListSize(*ActiveMenu\Entries())-1)
|
|
FirstElement(*ActiveMenu\Entries())
|
|
Else
|
|
NextElement(*ActiveMenu\Entries())
|
|
EndIf
|
|
|
|
*ActiveMenu\Entries()\Selected = #True
|
|
EndIf
|
|
|
|
; We go to the target game state
|
|
If KeyboardReleased(#PB_Key_Return)
|
|
PlaySound(1, #PB_Sound_MultiChannel)
|
|
Menu_GotoCurrent()
|
|
CurrentState = *ActiveMenu\Entries()\TargetState
|
|
*ActiveMenu.GameMenu = Menus(CurrentState)
|
|
EndIf
|
|
|
|
|
|
EndProcedure
|
|
|
|
Procedure HandleEventRunningGame()
|
|
If KeyboardReleased(#PB_Key_Q)
|
|
CurrentState = "MAIN_MENU"
|
|
*ActiveMenu.GameMenu = Menus(CurrentState)
|
|
EndIf
|
|
EndProcedure |