Add the PCRE license and start implementing the menu DSL.
This commit is contained in:
parent
c8b07c8979
commit
232def5197
4 changed files with 122 additions and 16 deletions
|
@ -1,13 +1,13 @@
|
||||||
MAIN_MENU "Pongr"
|
MAIN_MENU {Pongr}
|
||||||
BUTTON: "Run game" -> RUNNING_GAME
|
BUTTON: {Run game} -> RUNNING_GAME
|
||||||
BUTTON: "Options" -> OPTION_MENU
|
BUTTON: {Options} -> OPTION_MENU
|
||||||
BUTTON: "QUIT" -> RLY_QUIT
|
BUTTON: {QUIT} -> RLY_QUIT
|
||||||
|
|
||||||
OPTION_MENU "Options"
|
OPTION_MENU {Options}
|
||||||
OPTION: "Fullscreen", "Window Mode"
|
OPTION: {Fullscreen}, {Window Mode}
|
||||||
BUTTON: "Back" -> MAIN_MENU
|
BUTTON: {Back} -> MAIN_MENU
|
||||||
|
|
||||||
RLY_QUIT "You want to go?"
|
RLY_QUIT {You want to go?}
|
||||||
BUTTON: "Yes" -> EXIT
|
BUTTON: {Yes} -> EXIT
|
||||||
BUTTON: "No" -> MAIN_MENU
|
BUTTON: {No} -> MAIN_MENU
|
||||||
|
|
||||||
|
|
69
pongr/doc/LICENSE.pcre.txt
Normal file
69
pongr/doc/LICENSE.pcre.txt
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
PCRE LICENCE
|
||||||
|
------------
|
||||||
|
|
||||||
|
PCRE is a library of functions to support regular expressions whose syntax
|
||||||
|
and semantics are as close as possible to those of the Perl 5 language.
|
||||||
|
|
||||||
|
Release 7 of PCRE is distributed under the terms of the "BSD" licence, as
|
||||||
|
specified below. The documentation for PCRE, supplied in the "doc"
|
||||||
|
directory, is distributed under the same terms as the software itself.
|
||||||
|
|
||||||
|
The basic library functions are written in C and are freestanding. Also
|
||||||
|
included in the distribution is a set of C++ wrapper functions.
|
||||||
|
|
||||||
|
|
||||||
|
THE BASIC LIBRARY FUNCTIONS
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
Written by: Philip Hazel
|
||||||
|
Email local part: ph10
|
||||||
|
Email domain: cam.ac.uk
|
||||||
|
|
||||||
|
University of Cambridge Computing Service,
|
||||||
|
Cambridge, England.
|
||||||
|
|
||||||
|
Copyright (c) 1997-2007 University of Cambridge
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
|
||||||
|
THE C++ WRAPPER FUNCTIONS
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
Contributed by: Google Inc.
|
||||||
|
|
||||||
|
Copyright (c) 2007, Google Inc.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
|
||||||
|
THE "BSD" LICENCE
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
* Neither the name of the University of Cambridge nor the name of Google
|
||||||
|
Inc. nor the names of their contributors may be used to endorse or
|
||||||
|
promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
End
|
||||||
|
|
|
@ -1,16 +1,36 @@
|
||||||
; Here we draw stuff on screen. These are the dispatch
|
; Here we draw stuff on screen. These are the dispatch
|
||||||
; functions which wil lbe calles from the state dispatch
|
; functions which will be called from the state dispatch
|
||||||
; process.
|
; process.
|
||||||
|
|
||||||
|
|
||||||
|
; Draw the current activated menu. This will be set from
|
||||||
|
; the dispatcher. The events are controlled by the
|
||||||
|
; HandleEventMenu() function.
|
||||||
Procedure DrawMenu()
|
Procedure DrawMenu()
|
||||||
DrawText(50, 50, *ActiveMenu\Title, RGB(255, 255, 255), RGB(0, 0, 0))
|
Define Black = RGB(0, 0, 0)
|
||||||
|
Define White = RGB(255, 255, 255)
|
||||||
|
Define ActiveMenuItemColor = RGB(255, 0, 0)
|
||||||
|
|
||||||
|
DrawText(50, 50, *ActiveMenu\Title, white, black)
|
||||||
|
Define Offset = 0
|
||||||
|
Define FontColor = White
|
||||||
|
ForEach *ActiveMenu\Entries()
|
||||||
|
If *ActiveMenu\Entries()\Selected
|
||||||
|
FontColor = ActiveMenuItemColor
|
||||||
|
Else
|
||||||
|
FontColor = White
|
||||||
|
EndIf
|
||||||
|
DrawText(50, 300+(Offset*50), *ActiveMenu\Entries()\Label, FontColor, Black)
|
||||||
|
Offset = Offset+1
|
||||||
|
Next
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
|
|
||||||
Procedure DrawRunningGame()
|
Procedure DrawRunningGame()
|
||||||
Box(0, 0, 200, 200, RGB(0, 255, 0))
|
Box(0, 0, 200, 200, RGB(0, 255, 0))
|
||||||
EndProcedure
|
EndProcedure
|
||||||
; IDE Options = PureBasic 4.51 (Linux - x64)
|
; IDE Options = PureBasic 4.51 (Linux - x64)
|
||||||
; CursorPosition = 3
|
; CursorPosition = 17
|
||||||
; Folding = -
|
; Folding = -
|
||||||
; EnableUnicode
|
; EnableUnicode
|
||||||
; EnableThread
|
; EnableThread
|
||||||
|
|
|
@ -23,9 +23,26 @@ GameStates("RUNNING_GAME")\HandleEventFun = @HandleEventRunningGame()
|
||||||
; Read the complete game menus from the data/menu.data file.
|
; Read the complete game menus from the data/menu.data file.
|
||||||
; TODO: IncludeBinary looks interesting!
|
; TODO: IncludeBinary looks interesting!
|
||||||
If ReadFile(0, "../data/menu.data")
|
If ReadFile(0, "../data/menu.data")
|
||||||
|
CreateRegularExpression(0, "^([A-Z_-]+) {(.*)}") ; Menu title
|
||||||
|
CreateRegularExpression(1, "^ BUTTON: {(.+)} -> (.+)") ; A button
|
||||||
|
CreateRegularExpression(2, "^ OPTION: (.*)") ; A option field (TODO: Thats not exactly right)
|
||||||
|
|
||||||
While Eof(0) = 0
|
While Eof(0) = 0
|
||||||
Debug ReadString(0)
|
Dim Matches$(0)
|
||||||
|
Define Line.s = ReadString(0)
|
||||||
|
|
||||||
|
; We found a new menu
|
||||||
|
If MatchRegularExpression(0, Line)
|
||||||
|
Define i
|
||||||
|
For i=0 To ExtractRegularExpression(0, Line, Matches$())-1
|
||||||
|
Debug Matches$(i) ; FIXME: Thats not what we want ...
|
||||||
|
Next
|
||||||
|
EndIf
|
||||||
Wend
|
Wend
|
||||||
|
|
||||||
|
FreeRegularExpression(0)
|
||||||
|
FreeRegularExpression(1)
|
||||||
|
FreeRegularExpression(2)
|
||||||
CloseFile(0)
|
CloseFile(0)
|
||||||
EndIf
|
EndIf
|
||||||
|
|
||||||
|
@ -100,8 +117,8 @@ If OpenWindow(0, 0, 0, Screen\Width, Screen\Height, title, #PB_Window_ScreenCent
|
||||||
Until KeyboardPushed(#PB_Key_Escape)
|
Until KeyboardPushed(#PB_Key_Escape)
|
||||||
EndIf
|
EndIf
|
||||||
; IDE Options = PureBasic 4.51 (Linux - x64)
|
; IDE Options = PureBasic 4.51 (Linux - x64)
|
||||||
; CursorPosition = 71
|
; CursorPosition = 37
|
||||||
; FirstLine = 52
|
; FirstLine = 11
|
||||||
; EnableXP
|
; EnableXP
|
||||||
; EnableCompileCount = 0
|
; EnableCompileCount = 0
|
||||||
; EnableBuildCount = 0
|
; EnableBuildCount = 0
|
Reference in a new issue