diff options
| author | troido <troido@protonmail.com> | 2018-05-23 20:36:47 +0200 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2018-05-23 20:36:47 +0200 |
| commit | ce116aeade07eb57760e42dbbeeca83ded8214ce (patch) | |
| tree | 902e0d488e4aadb6681c5fadd012dd34c38d7bf1 /asciifarm/client/display/screen.py | |
| parent | af31b7692a44666b78554464266e513dc78bf0be (diff) | |
game doesn't crash anymore when cursor can't be set
Diffstat (limited to 'asciifarm/client/display/screen.py')
| -rw-r--r-- | asciifarm/client/display/screen.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/asciifarm/client/display/screen.py b/asciifarm/client/display/screen.py index 21d7200..605eca5 100644 --- a/asciifarm/client/display/screen.py +++ b/asciifarm/client/display/screen.py @@ -9,7 +9,19 @@ class Screen: def __init__(self, display, stdscr, colours): self.display = display - curses.curs_set(0) + try: + curses.curs_set(0) + self.cursorSet = False + except curses.error: + # Not all terminals support this functionality. + # When the error is ignored the screen will look a little uglier, + # A cursor will move around, but that's not terrible + # So in order to keep the game as accesible as possible to everyone, it should be safe to ignore the error. + self.cursorSet = True + # It is probably possible to make sure the cursor is only in a corner of the screen + # but I can't figure out how. + # it seems to ignore all my move commands unless I press a key + # I give up self.stdscr = stdscr self.colours = colours self.setWins() @@ -67,7 +79,6 @@ class Screen: self.display.forceUpdate() def update(self): - curses.doupdate() def getWidth(self): @@ -76,3 +87,4 @@ class Screen: def getHeight(self): return self.height + |
