Keyboard interaction with current menu-item done!
This commit is contained in:
parent
232def5197
commit
36ac144842
5 changed files with 53 additions and 24 deletions
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project xmlns="http://www.purebasic.com/namespace" version="1.0" creator="PureBasic 4.51 (Linux - x64)">
|
||||
<project xmlns="http://www.purebasic.com/namespace" version="1.0" creator="PureBasic 4.51 (MacOS X - x86)">
|
||||
<section name="config">
|
||||
<options closefiles="1" openmode="0" name="Pongr"/>
|
||||
<options closefiles="1" openmode="4" name="Pongr"/>
|
||||
<comment>
|
||||
First project from Ruben and Aaron Mueller
|
||||
</comment>
|
||||
|
@ -10,28 +10,28 @@
|
|||
<section name="data">
|
||||
<explorer view="../../../" pattern="0"/>
|
||||
<log show="1"/>
|
||||
<lastopen date="2011-01-22 03:17" user="aaron" host="deskFu"/>
|
||||
<lastopen date="2011-08-18 12:51" user="rubenmueller" host="localhost"/>
|
||||
</section>
|
||||
<section name="files">
|
||||
<file name="src/Main.pb">
|
||||
<config load="0" scan="1" panel="1" warn="1" lastopen="1"/>
|
||||
<fingerprint md5="29e4b25d47252dd54c24d6985d0e0b94"/>
|
||||
<config load="0" scan="1" panel="1" warn="1" lastopen="0"/>
|
||||
<fingerprint md5="d1f3164bb5fec7361255de01f9092ae7"/>
|
||||
</file>
|
||||
<file name="src/Structs.pbi">
|
||||
<config load="0" scan="1" panel="1" warn="1" lastopen="1"/>
|
||||
<config load="0" scan="1" panel="1" warn="1" lastopen="0"/>
|
||||
<fingerprint md5="3f6fdbb23e900f0a334f07d26355f27f"/>
|
||||
</file>
|
||||
<file name="src/Draw.pbi">
|
||||
<config load="0" scan="1" panel="1" warn="1" lastopen="1"/>
|
||||
<fingerprint md5="104d355e87b74fa0e87bef35d6f6d748"/>
|
||||
<config load="0" scan="1" panel="1" warn="1" lastopen="0"/>
|
||||
<fingerprint md5="9224465e12cc31c27a387b1e9d602a77"/>
|
||||
</file>
|
||||
<file name="src/Events.pbi">
|
||||
<config load="0" scan="1" panel="1" warn="1" lastopen="1"/>
|
||||
<fingerprint md5="938263b937dde78242133aac1b4dbb97"/>
|
||||
<config load="0" scan="1" panel="1" warn="1" lastopen="0"/>
|
||||
<fingerprint md5="9dd147e52792042f4e79268cca55cb49"/>
|
||||
</file>
|
||||
<file name="src/Globals.pbi">
|
||||
<config load="0" scan="1" panel="1" warn="1" lastopen="1"/>
|
||||
<fingerprint md5="768cb291ebd658155da6c8419e722db8"/>
|
||||
<config load="0" scan="1" panel="1" warn="1" lastopen="0"/>
|
||||
<fingerprint md5="5abb967324ded5ac249dc8b4ac43531a"/>
|
||||
</file>
|
||||
</section>
|
||||
<section name="targets">
|
||||
|
@ -39,8 +39,8 @@
|
|||
<inputfile value="src/Main.pb"/>
|
||||
<outputfile value="build/pongr"/>
|
||||
<executable value="build/pongr"/>
|
||||
<options thread="1" xpskin="1" debug="1"/>
|
||||
<compilecount enable="1" value="50"/>
|
||||
<options thread="1" xpskin="1"/>
|
||||
<compilecount enable="1" value="54"/>
|
||||
<buildcount enable="1" value="4"/>
|
||||
</target>
|
||||
</section>
|
||||
|
|
|
@ -1,15 +1,43 @@
|
|||
; In this file, we handle alle the events
|
||||
|
||||
Procedure HandleEventMenu()
|
||||
If KeyboardReleased(#PB_Key_U)
|
||||
Debug "U pressed"
|
||||
Define ActiveMenu_Index.i = ListIndex(*ActiveMenu\Entries())
|
||||
|
||||
If KeyboardReleased(#PB_Key_Up)
|
||||
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)
|
||||
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
|
||||
|
||||
If KeyboardReleased(#PB_Key_Return)
|
||||
Debug "Return!"
|
||||
EndIf
|
||||
EndProcedure
|
||||
|
||||
Procedure HandleEventRunningGame()
|
||||
EndProcedure
|
||||
; IDE Options = PureBasic 4.51 (Linux - x64)
|
||||
; CursorPosition = 2
|
||||
; IDE Options = PureBasic 4.51 (MacOS X - x86)
|
||||
; CursorPosition = 32
|
||||
; Folding = -
|
||||
; EnableUnicode
|
||||
; EnableThread
|
||||
|
|
1
pongr/src/Functions.pbi
Normal file
1
pongr/src/Functions.pbi
Normal file
|
@ -0,0 +1 @@
|
|||
; This file holds all the functions If it gets too big,
; we can split it in categories
; *****************************************************************************
; * Menu
Procedure Menu_GotoCurrent()
If *ActiveMenu\Entries()\Selected <> #True
FirstElement(*ActiveMenu\Entries());
ForEach *ActiveMenu\Entries()
If *ActiveMenu\Entries()\Selected = #True
Break
EndIf
Next
EndIf
EndProcedure
; *****************************************************************************
; IDE Options = PureBasic 4.51 (MacOS X - x86)
; CursorPosition = 13
; Folding = -
; EnableXP
|
|
@ -7,6 +7,7 @@ EnableExplicit
|
|||
XIncludeFile "Structs.pbi"
|
||||
XIncludeFile "Globals.pbi"
|
||||
XIncludeFile "Draw.pbi"
|
||||
XIncludeFile "Functions.pbi"
|
||||
XIncludeFile "Events.pbi"
|
||||
|
||||
; Initialize all the variables and stuff. I think we refactor this
|
||||
|
@ -77,7 +78,6 @@ If InitSprite() = 0 Or InitKeyboard() = 0
|
|||
End
|
||||
EndIf
|
||||
|
||||
|
||||
; Start the main loop which will create the window, wait for events and draw things
|
||||
; on the screen. To escape from this loop, press ESC or close the window.
|
||||
If OpenWindow(0, 0, 0, Screen\Width, Screen\Height, title, #PB_Window_ScreenCentered)
|
||||
|
@ -116,9 +116,9 @@ If OpenWindow(0, 0, 0, Screen\Width, Screen\Height, title, #PB_Window_ScreenCent
|
|||
Delay(1)
|
||||
Until KeyboardPushed(#PB_Key_Escape)
|
||||
EndIf
|
||||
; IDE Options = PureBasic 4.51 (Linux - x64)
|
||||
; CursorPosition = 37
|
||||
; FirstLine = 11
|
||||
; IDE Options = PureBasic 4.51 (MacOS X - x86)
|
||||
; CursorPosition = 5
|
||||
; FirstLine = 4
|
||||
; EnableXP
|
||||
; EnableCompileCount = 0
|
||||
; EnableBuildCount = 0
|
|
@ -31,8 +31,8 @@ Structure GameMenu
|
|||
Title.s
|
||||
List Entries.GameMenuItem()
|
||||
EndStructure
|
||||
; IDE Options = PureBasic 4.51 (Linux - x64)
|
||||
; CursorPosition = 12
|
||||
; IDE Options = PureBasic 4.51 (MacOS X - x86)
|
||||
; CursorPosition = 32
|
||||
; EnableUnicode
|
||||
; EnableThread
|
||||
; EnableXP
|
||||
|
|
Reference in a new issue