Compare commits

...

4 Commits

Author SHA1 Message Date
Joe S fa3e73498d Add in log window! 2021-02-21 17:17:19 -05:00
Joe S 5fb78fece8 Move around/clean up game renderer
Also add space for log window
2021-02-21 17:15:26 -05:00
Joe S fa0c2cac9e handle a redraw! 2021-02-21 17:07:20 -05:00
Joe S eb70e4a438 Organize where the player() is initalized 2021-02-21 17:07:14 -05:00
3 changed files with 38 additions and 15 deletions

View File

@ -6,10 +6,14 @@ class QuitButton(npyscreen.ButtonPress):
def whenPressed(self):
sys.exit(0)
class SendButton(npyscreen.ButtonPress):
class Render(npyscreen.ButtonPress):
def whenPressed(self):
self.parent.artContent.value = 'Undraw!'
self.parent.artContent.display()
self.parent.parentApp.switchForm('GAME')
class GameNavigator(npyscreen.FormBaseNew):
# def afterEditing(self):
# it self.parentApp.setNextForm('GAME')
@ -43,24 +47,39 @@ class GameNavigator(npyscreen.FormBaseNew):
rely=2,
editable=False)
self.dialogueBoxOutline = self.add(npyscreen.BoxBasic,
self.logBoxOutline = self.add(npyscreen.BoxBasic,
max_width=inventory_width + art_width,
max_height=3,
max_height=9,
relx=1,
rely=top_division_height + 2,
editable=False)
self.dialogueBox = self.add(npyscreen.Textfield,
self.logBox = self.add(npyscreen.Textfield,
name='Type Here',
max_width=inventory_width + art_width - 7,
max_height=7,
relx=2,
rely=top_division_height + 3,
editable=False)
self.dialogueBoxOutline = self.add(npyscreen.BoxBasic,
max_width=inventory_width + art_width,
max_height=3,
relx=1,
rely=top_division_height + 2 + 9,
editable=False)
self.dialogueBox = self.add(npyscreen.Textfield,
name='Type Here',
max_width=inventory_width + art_width - 14,
max_height=1,
relx=2,
rely=top_division_height + 3)
rely=top_division_height + 3 + 9)
self.sendButton = self.add(SendButton,
self.sendButton = self.add(Render,
name="Send",
relx=inventory_width + art_width - 7,
rely=top_division_height + 3)
rely=top_division_height + 3 + 9)
self.quitButton = self.add(QuitButton,
name="Quit",
relx=1,

View File

@ -1,5 +1,9 @@
import npyscreen
from Player import Player
class MainMenu(npyscreen.Form):
def afterEditing(self):
# TODO: the game needs to happen after this inital main menu
@ -8,4 +12,6 @@ class MainMenu(npyscreen.Form):
def create(self):
self.add(npyscreen.FixedText, value='You cannot select a file yet! Just hit OK', editable=False)
self.playerSaveLocation = self.add(npyscreen.TitleFilenameCombo, name="Your save file:")
self.parentApp.player = Player('playerdata/defaults/default_player.yaml')
self.add(npyscreen.MultiLineEdit, value=self.parentApp.gamelib['menu']['graphics']['logo'], editable=False)

View File

@ -5,7 +5,6 @@ from os import system
from yaml_parser import parse_datafile as parse
from GameNavigator import GameNavigator
from MainMenu import MainMenu
from Player import Player
class AlphaWarning(npyscreen.Popup):
@ -24,15 +23,14 @@ class AdventureGame(npyscreen.NPSAppManaged):
# Setup some important 'global' values we'll need later
self.gamelib = parse(
'gamedata/gamelib.yaml') # parse this data first (since it includes graphics for the main menu
self.playerSaveLocation = 'playerdata/defaults/default_player.yaml' #TODO: Actually load the player data
self.player = Player(self.playerSaveLocation)
self.player = None # Intalize the player as none, the player will be created in the main menu.
# Set screen size before drawing windows
dimensions = self.gamelib['menu']['graphics']['dimensions']
system('mode con: cols={0} lines={1}'.format(
dimensions['inventory_width']+dimensions['art_width'],
30)) # TODO: Finish setting this up.
#system('mode con: cols={0} lines={1}'.format(
# dimensions['inventory_width']+dimensions['art_width'],
# 30)) # TODO: Finish setting this up.
# Draw game windows
self.addForm('GAME', GameNavigator, name='Unnamed Adventure Game') # This window should draw the actual game
@ -44,7 +42,7 @@ class AdventureGame(npyscreen.NPSAppManaged):
if __name__ == '__main__':
# Set the screen size bigger
system('mode con: cols={0} lines={1}'.format(124, 30))
system('mode con: cols={0} lines={1}'.format(124, 36))
# Make a new adventure game if not imported
adventure_game = AdventureGame()