Compare commits

..

3 Commits

Author SHA1 Message Date
Joe S 45801c53b0 TODO
Weird bug where this crashes the game if the first char is not something other than space
2021-02-16 20:25:36 -05:00
Joe S 1999e8b8ec Added in yaml
This works, but has a few minor bugs. it lays the foundation though for more stuff to be added
2021-02-16 20:23:26 -05:00
Joe S db78cca216 If we add the multiline edit above playersavelocation then it crashes, fix? 2021-02-16 20:17:37 -05:00
4 changed files with 31 additions and 2 deletions

View File

@ -0,0 +1,13 @@
menu:
graphics:
logo: |
. __ __ __ ___ __ __
/ / / /___ ____ ____ _____ ___ ___ ____/ / / | ____/ / _____ ____ / /___ __________
/ / / / __ \/ __ \/ __ `/ __ `__ \/ _ \/ __ / / /| |/ __ / | / / _ \/ __ \/ __/ / / / ___/ _ \
/ /_/ / / / / / / / /_/ / / / / / / __/ /_/ / / ___ / /_/ /| |/ / __/ / / / /_/ /_/ / / / __/
\____/_/ /_/_/ /_/\__,_/_/ /_/ /_/\___/\__,_/ /_/ |_\__,_/ |___/\___/_/ /_/\__/\__,_/_/ \___/
_________ __ _________
/ ____/ | / |/ / ____/
/ / __/ /| | / /|_/ / __/
/ /_/ / ___ |/ / / / /___
\____/_/ |_/_/ /_/_____/

View File

@ -1,4 +1,5 @@
import npyscreen import npyscreen
from yaml_parser import parse_datafile as parse
class GameNavigator(npyscreen.Form): class GameNavigator(npyscreen.Form):
@ -19,8 +20,8 @@ class MainMenu(npyscreen.Form):
self.parentApp.setNextForm('GAME') self.parentApp.setNextForm('GAME')
def create(self): def create(self):
self.add(npyscreen.MultiLineEdit, value='Test', editable=False)
self.playerSaveLocation = self.add(npyscreen.TitleFilenameCombo, name="Filename:") self.playerSaveLocation = self.add(npyscreen.TitleFilenameCombo, name="Filename:")
self.add(npyscreen.MultiLineEdit, value=self.parentApp.gamelib['menu']['graphics']['logo'], editable=False)
class AlphaWarning(npyscreen.Popup): class AlphaWarning(npyscreen.Popup):
@ -37,6 +38,8 @@ class AlphaWarning(npyscreen.Popup):
class AdventureGame(npyscreen.NPSAppManaged): class AdventureGame(npyscreen.NPSAppManaged):
# Do on creation # Do on creation
def onStart(self): def onStart(self):
self.gamelib = parse('gamedata/gamelib.yaml')
# Intalize a game renderer for most game windows # Intalize a game renderer for most game windows
self.addForm('GAME', GameNavigator, name='Unnamed Adventure Game') self.addForm('GAME', GameNavigator, name='Unnamed Adventure Game')

View File

@ -0,0 +1,12 @@
import yaml
def parse_datafile(file):
# With the file open
with open(file, 'r') as stream:
# Try to read it and return it
try:
content = yaml.safe_load(stream)
return content
except yaml.YAMLError as exc:
return exc

View File

@ -1 +1,2 @@
npyscreen~=4.10.5 npyscreen~=4.10.5
PyYAML~=5.1.2