diff --git a/src/tools/ceguidemo/ceguidemo.project b/src/tools/ceguidemo/ceguidemo.project index 034ea383f..8305d0112 100644 --- a/src/tools/ceguidemo/ceguidemo.project +++ b/src/tools/ceguidemo/ceguidemo.project @@ -1,22 +1,24 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tools/ceguidemo/datafiles/imagesets/ceguidemolook.imageset b/src/tools/ceguidemo/datafiles/imagesets/ceguidemolook.imageset index 88eb4bc43..8f134ac21 100644 --- a/src/tools/ceguidemo/datafiles/imagesets/ceguidemolook.imageset +++ b/src/tools/ceguidemo/datafiles/imagesets/ceguidemolook.imageset @@ -18,12 +18,12 @@ - - - - - - + + + + + + diff --git a/src/tools/ceguidemo/datafiles/imagesets/ceguidemolook.png b/src/tools/ceguidemo/datafiles/imagesets/ceguidemolook.png index 223f4acba..09055374b 100644 Binary files a/src/tools/ceguidemo/datafiles/imagesets/ceguidemolook.png and b/src/tools/ceguidemo/datafiles/imagesets/ceguidemolook.png differ diff --git a/src/tools/ceguidemo/datafiles/imagesets/splash-carselect.imageset b/src/tools/ceguidemo/datafiles/imagesets/splash-carselect.imageset new file mode 100644 index 000000000..423c1a412 --- /dev/null +++ b/src/tools/ceguidemo/datafiles/imagesets/splash-carselect.imageset @@ -0,0 +1,4 @@ + + + + diff --git a/src/tools/ceguidemo/datafiles/imagesets/splash-carselect.jpg b/src/tools/ceguidemo/datafiles/imagesets/splash-carselect.jpg new file mode 100644 index 000000000..77c107ea8 Binary files /dev/null and b/src/tools/ceguidemo/datafiles/imagesets/splash-carselect.jpg differ diff --git a/src/tools/ceguidemo/datafiles/imagesets/splash-race.imageset b/src/tools/ceguidemo/datafiles/imagesets/splash-race.imageset deleted file mode 100644 index 2ee3fa04f..000000000 --- a/src/tools/ceguidemo/datafiles/imagesets/splash-race.imageset +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/tools/ceguidemo/datafiles/imagesets/splash-trackselect.imageset b/src/tools/ceguidemo/datafiles/imagesets/splash-trackselect.imageset new file mode 100644 index 000000000..b7c18d781 --- /dev/null +++ b/src/tools/ceguidemo/datafiles/imagesets/splash-trackselect.imageset @@ -0,0 +1,4 @@ + + + + diff --git a/src/tools/ceguidemo/datafiles/imagesets/splash-race.jpg b/src/tools/ceguidemo/datafiles/imagesets/splash-trackselect.jpg similarity index 100% rename from src/tools/ceguidemo/datafiles/imagesets/splash-race.jpg rename to src/tools/ceguidemo/datafiles/imagesets/splash-trackselect.jpg diff --git a/src/tools/ceguidemo/datafiles/layouts/menuoptions.layout b/src/tools/ceguidemo/datafiles/layouts/menuoptions.layout index 0c4c5261d..56db450be 100644 --- a/src/tools/ceguidemo/datafiles/layouts/menuoptions.layout +++ b/src/tools/ceguidemo/datafiles/layouts/menuoptions.layout @@ -163,18 +163,18 @@ - + - + - + @@ -217,11 +217,17 @@ - - + + - - + + + + + + + + - \ No newline at end of file + diff --git a/src/tools/ceguidemo/datafiles/layouts/menurace.layout b/src/tools/ceguidemo/datafiles/layouts/menutrackselect.layout similarity index 56% rename from src/tools/ceguidemo/datafiles/layouts/menurace.layout rename to src/tools/ceguidemo/datafiles/layouts/menutrackselect.layout index 8b266df9e..34d28cae6 100644 --- a/src/tools/ceguidemo/datafiles/layouts/menurace.layout +++ b/src/tools/ceguidemo/datafiles/layouts/menutrackselect.layout @@ -1,21 +1,21 @@ - + - + - + - + - + @@ -44,7 +44,7 @@ - + @@ -80,41 +80,102 @@ - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + diff --git a/src/tools/ceguidemo/datafiles/schemes/ceguidemo.scheme b/src/tools/ceguidemo/datafiles/schemes/ceguidemo.scheme index f04317937..03558da9f 100644 --- a/src/tools/ceguidemo/datafiles/schemes/ceguidemo.scheme +++ b/src/tools/ceguidemo/datafiles/schemes/ceguidemo.scheme @@ -3,7 +3,8 @@ - + + diff --git a/src/tools/ceguidemo/menucarselect.py b/src/tools/ceguidemo/menucarselect.py new file mode 100644 index 000000000..f9d4550d1 --- /dev/null +++ b/src/tools/ceguidemo/menucarselect.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + + +"""Car selection menu. + + +""" + +# Import: std +import sys + +# Import: PyCEGUI +import PyCEGUI + +# Import: Configuration +from configuration import TheConfig + +# Import: Menu +from menustandard import MenuStandard +from menucredits import MenuCredits +from menuoptions import MenuOptions + +# Car selection menu +class MenuCarSelect(MenuStandard): + + def __init__(self): + + MenuStandard.__init__(self, MenuCredits, MenuOptions) #, MenuProfiles, ) + + # Initialize + def initialize(self): + + name = "MenuCarSelect" + + # No code written for this menu : use mandatory layout. + window = MenuStandard.initialize(self, name=name, title="Select a car", layout="menucarselect") + + # Retrieve the window descendants created here. + self.btnBack = window.getChild(name + "/BtnBack") + self.btnStart = window.getChild(name + "/BtnStart") + + # Complete widget initialization. + # TODO. + + return window + + # connectHandlers + # - Wrapper method to define the subscription/listener relationships. + # - If there are a lot, it may behoove the coder to encapsulate them in methods, then call those methods here. + def connectHandlers(self): + + # Inherited connections. + MenuStandard.connectHandlers(self) + + # Specific connections. + self.btnBack.subscribeEvent(PyCEGUI.PushButton.EventClicked, self, "onBackButtonClicked") + self.btnStart.subscribeEvent(PyCEGUI.PushButton.EventClicked, self, "onStartButtonClicked") + + # Handler: buttonClicked + def onStartButtonClicked(self, args): + + print("onStartButtonClicked") + + def onBackButtonClicked(self, args): + + print("onBackButtonClicked") + self.back() diff --git a/src/tools/ceguidemo/menumain.py b/src/tools/ceguidemo/menumain.py index f27709f85..b2c34e51a 100644 --- a/src/tools/ceguidemo/menumain.py +++ b/src/tools/ceguidemo/menumain.py @@ -20,7 +20,7 @@ from configuration import TheConfig from menustandard import MenuStandard from menucredits import MenuCredits from menuoptions import MenuOptions -from menurace import MenuRace +from menutrackselect import MenuTrackSelect # Main menu class MenuMain(MenuStandard): @@ -29,7 +29,7 @@ class MenuMain(MenuStandard): MenuStandard.__init__(self, MenuCredits, MenuOptions) #, MenuProfiles, ) - self.menuRace = None + self.menuTrackSelect = None # Initialize def initialize(self): @@ -128,24 +128,24 @@ class MenuMain(MenuStandard): def onPracticeButtonClicked(self, args): print("onPracticeButtonClicked") - self.activateRaceMenu() + self.activateTrackSelectMenu() def onQuickRaceButtonClicked(self, args): print("onQuickRaceButtonClicked") - self.activateRaceMenu() + self.activateTrackSelectMenu() def onSingleEventButtonClicked(self, args): print("onSingleEventButtonClicked") - self.activateRaceMenu() + self.activateTrackSelectMenu() - def activateRaceMenu(self): + def activateTrackSelectMenu(self): - if not self.menuRace: - self.menuRace = MenuRace() - self.menuRace.initialize() - self.menuRace.setup() + if not self.menuTrackSelect: + self.menuTrackSelect = MenuTrackSelect() + self.menuTrackSelect.initialize() + self.menuTrackSelect.setup() - self.menuRace.activate(previous=self) + self.menuTrackSelect.activate(previous=self) diff --git a/src/tools/ceguidemo/menuoptions.py b/src/tools/ceguidemo/menuoptions.py index ef6c111ed..d93d27e54 100644 --- a/src/tools/ceguidemo/menuoptions.py +++ b/src/tools/ceguidemo/menuoptions.py @@ -30,35 +30,27 @@ class MenuOptions(Menu): def initialize(self): name = "MenuOptions" - - # Use layout if specified. - if TheConfig.useLayouts: - - window = Menu.initialize(self, name=name, title="Options", layout="menuoptions") - - else: - - # If no layout specified, go on building up the menu through code. - window = Menu.initialize(self, name=name, title="Options", background="SplashOptions") - - # Specific to this menu. - winMgr = PyCEGUI.WindowManager.getSingleton() - - btnBack = PyCEGUI.WindowManager.getSingleton().createWindow("CEGUIDemo/Button", name + "/BtnBack") - btnBack.setText("Back") - btnBack.setTooltipText("Back to the main menu") - btnBack.setXPosition(PyCEGUI.UDim(0.43, 0.0)) - btnBack.setYPosition(PyCEGUI.UDim(0.9, 0.0)) - btnBack.setWidth(PyCEGUI.UDim(0.15, 0.0)) - btnBack.setHeight(PyCEGUI.UDim(0.05, 0.0)) - btnBack.setProperty("Font", "MenuMedium") - - window.addChildWindow(btnBack) + + # No code written for this menu : use mandatory layout. + window = Menu.initialize(self, name=name, title="Options", layout="menuoptions") # Retrieve window descendants created here. - self.btnBack = window.getChild(name + "/BtnBack") + self.btnAccept = window.getChild(name + "/BtnAccept") + self.btnCancel = window.getChild(name + "/BtnCancel") + self.cbxWinSize = window.getChild(name + "/CbxWindowSize") - # Complete widget initialization (whatever creation mode : code or .layout). + # Complete widget initialization. + self.cbxWinSizeItems = [] + cbxItem = PyCEGUI.ListboxTextItem(" 800 x 512") + self.cbxWinSize.addItem(cbxItem) + self.cbxWinSizeItems.append(cbxItem) + cbxItem = PyCEGUI.ListboxTextItem("1280 x 800") + self.cbxWinSize.addItem(cbxItem) + self.cbxWinSizeItems.append(cbxItem) + cbxItem = PyCEGUI.ListboxTextItem("1680 x 1050") + self.cbxWinSize.addItem(cbxItem) + self.cbxWinSizeItems.append(cbxItem) + # TODO. return window @@ -72,10 +64,16 @@ class MenuOptions(Menu): Menu.connectHandlers(self) # Specific connections. - self.btnBack.subscribeEvent(PyCEGUI.PushButton.EventClicked, self, "onBackButtonClicked") + self.btnCancel.subscribeEvent(PyCEGUI.PushButton.EventClicked, self, "onCancelButtonClicked") + self.btnAccept.subscribeEvent(PyCEGUI.PushButton.EventClicked, self, "onAcceptButtonClicked") - def onBackButtonClicked(self, args): + def onCancelButtonClicked(self, args): - print("onBackButtonClicked") + print("onCancelButtonClicked") + self.back() + + def onAcceptButtonClicked(self, args): + + print("onAcceptButtonClicked") self.back() diff --git a/src/tools/ceguidemo/menurace.py b/src/tools/ceguidemo/menurace.py deleted file mode 100644 index b589123f3..000000000 --- a/src/tools/ceguidemo/menurace.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - - -"""Race menu. - - -""" - -# Import: std -import sys - -# Import: PyCEGUI -import PyCEGUI - -# Import: Configuration -from configuration import TheConfig - -# Import: Menu -from menustandard import MenuStandard -from menucredits import MenuCredits -from menuoptions import MenuOptions - -# Race menu -class MenuRace(MenuStandard): - - def __init__(self): - - MenuStandard.__init__(self, MenuCredits, MenuOptions) #, MenuProfiles, ) - - # Initialize - def initialize(self): - - name = "MenuRace" - - # Use layout if specified. - if TheConfig.useLayouts: - - window = MenuStandard.initialize(self, name=name, title="Race", layout="menurace") - - else: - - # If no layout specified, go on building up the menu through code. - window = MenuStandard.initialize(self, name=name, title="Race", background="SplashRace") - - # Specific to this menu. - btnStart = PyCEGUI.WindowManager.getSingleton().createWindow("CEGUIDemo/Button", name + "/BtnStart") - btnStart.setText("Start") - btnStart.setTooltipText("Start to the main menu") - btnStart.setXPosition(PyCEGUI.UDim(0.75, 0.0)) - btnStart.setYPosition(PyCEGUI.UDim(0.9, 0.0)) - btnStart.setWidth(PyCEGUI.UDim(0.15, 0.0)) - btnStart.setHeight(PyCEGUI.UDim(0.05, 0.0)) - btnStart.setProperty("Font", "MenuMedium") - - window.addChildWindow(btnStart) - - btnBack = PyCEGUI.WindowManager.getSingleton().createWindow("CEGUIDemo/Button", name + "/BtnBack") - btnBack.setText("Back") - btnBack.setTooltipText("Back to the main menu") - btnBack.setXPosition(PyCEGUI.UDim(0.1, 0.0)) - btnBack.setYPosition(PyCEGUI.UDim(0.9, 0.0)) - btnBack.setWidth(PyCEGUI.UDim(0.15, 0.0)) - btnBack.setHeight(PyCEGUI.UDim(0.05, 0.0)) - btnBack.setProperty("Font", "MenuMedium") - - window.addChildWindow(btnBack) - - # Retrieve the window descendants created here. - self.btnBack = window.getChild(name + "/BtnBack") - self.btnStart = window.getChild(name + "/BtnStart") - - # Complete widget initialization (whatever creation mode : code or .layout). - - return window - - # connectHandlers - # - Wrapper method to define the subscription/listener relationships. - # - If there are a lot, it may behoove the coder to encapsulate them in methods, then call those methods here. - def connectHandlers(self): - - # Inherited connections. - MenuStandard.connectHandlers(self) - - # Specific connections. - self.btnBack.subscribeEvent(PyCEGUI.PushButton.EventClicked, self, "onBackButtonClicked") - self.btnStart.subscribeEvent(PyCEGUI.PushButton.EventClicked, self, "onStartButtonClicked") - - # Handler: buttonClicked - def onStartButtonClicked(self, args): - - print("onStartButtonClicked") - - def onBackButtonClicked(self, args): - - print("onBackButtonClicked") - self.back() diff --git a/src/tools/ceguidemo/menutrackselect.py b/src/tools/ceguidemo/menutrackselect.py new file mode 100644 index 000000000..d65e77c75 --- /dev/null +++ b/src/tools/ceguidemo/menutrackselect.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + + +"""Track selection menu. + + +""" + +# Import: std +import sys + +# Import: PyCEGUI +import PyCEGUI + +# Import: Configuration +from configuration import TheConfig + +# Import: Menu +from menustandard import MenuStandard +from menucredits import MenuCredits +from menuoptions import MenuOptions +from menucarselect import MenuCarSelect + +# Track selection menu +class MenuTrackSelect(MenuStandard): + + def __init__(self): + + MenuStandard.__init__(self, MenuCredits, MenuOptions) #, MenuProfiles, ) + + self.menuCarSelect = None + + # Initialize + def initialize(self): + + name = "MenuTrackSelect" + + # No code written for this menu : use mandatory layout. + window = MenuStandard.initialize(self, name=name, title="Select a track", layout="menutrackselect") + + # Retrieve the window descendants created here. + self.btnBack = window.getChild(name + "/BtnBack") + self.btnNext = window.getChild(name + "/BtnNext") + self.cbxCat = window.getChild(name + "/CbxCategory") + + # Complete widget initialization. + self.cbxCatItems = [] + cbxItem = PyCEGUI.ListboxTextItem("Grand Prix") + self.cbxCat.addItem(cbxItem) + self.cbxCatItems.append(cbxItem) + cbxItem = PyCEGUI.ListboxTextItem("Road") + self.cbxCat.addItem(cbxItem) + self.cbxCatItems.append(cbxItem) + cbxItem = PyCEGUI.ListboxTextItem("Dirt") + self.cbxCat.addItem(cbxItem) + self.cbxCatItems.append(cbxItem) + + # TODO. + + return window + + # connectHandlers + # - Wrapper method to define the subscription/listener relationships. + # - If there are a lot, it may behoove the coder to encapsulate them in methods, then call those methods here. + def connectHandlers(self): + + # Inherited connections. + MenuStandard.connectHandlers(self) + + # Specific connections. + self.btnBack.subscribeEvent(PyCEGUI.PushButton.EventClicked, self, "onBackButtonClicked") + self.btnNext.subscribeEvent(PyCEGUI.PushButton.EventClicked, self, "onNextButtonClicked") + + # Handler: buttonClicked + def onNextButtonClicked(self, args): + + if not self.menuCarSelect: + self.menuCarSelect = MenuCarSelect() + self.menuCarSelect.initialize() + self.menuCarSelect.setup() + + self.menuCarSelect.activate(previous=self) + + def onBackButtonClicked(self, args): + + self.back()