-
Notifications
You must be signed in to change notification settings - Fork 0
/
splash.py
84 lines (58 loc) · 2.36 KB
/
splash.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import os
import curses
import message
import curseconf
def draw_main_title(stdscr):
# Initialization
stdscr.clear()
height, width = stdscr.getmaxyx()
title = "Curse"[:width-1]
subtitle = "Press <space> to enter ..."[:width-1]
if os.path.exists(curseconf.SAVE_FILE) and os.path.isfile(curseconf.SAVE_FILE) :
subtitle = "<l> load previous game <n> new game ..."[:width-1]
start_x_title = int((width // 2) - (len(title) // 2) - len(title) % 2)
start_x_subtitle = int((width // 2) - (len(subtitle) // 2) - len(subtitle) % 2)
start_y = int((height // 2) - 2)
# Turning on attributes for title
stdscr.attron(curses.color_pair(2))
stdscr.attron(curses.A_BOLD)
# Rendering title
stdscr.addstr(start_y, start_x_title, title)
# Turning off attributes for title
stdscr.attroff(curses.color_pair(2))
stdscr.attroff(curses.A_BOLD)
stdscr.addstr(height - (height/3), start_x_subtitle, subtitle)
def draw_exit_screen(stdscr):
# Initialization
stdscr.clear()
height, width = stdscr.getmaxyx()
title = "Ar you sure you want to quit?"[:width-1]
subtitle = "y = quit, n = resume, m = main menu"[:width-1]
start_x_title = int((width // 2) - (len(title) // 2) - len(title) % 2)
start_x_subtitle = int((width // 2) - (len(subtitle) // 2) - len(subtitle) % 2)
start_y = int((height // 2) - 2)
# Turning on attributes for title
stdscr.attron(curses.color_pair(2))
stdscr.attron(curses.A_BOLD)
# Rendering title
stdscr.addstr(start_y, start_x_title, title)
# Turning off attributes for title
stdscr.attroff(curses.color_pair(2))
stdscr.attroff(curses.A_BOLD)
stdscr.addstr(height - (height/3), start_x_subtitle, subtitle)
def draw_intro_sequence(stdscr):
# Initialization
stdscr.clear()
height, width = stdscr.getmaxyx()
first_message = \
"""\
This story takes place a long time ago. Like, a really long time ago.
Or perhaps not so long in fact. I always seem to forget.
In any case, our hero's name is bip.
Sat hello to bip
"""
subtitle = "Press <SPACE> to Continue ..."[:width-1]
scroll = message.create_scroll(first_message)
message.animate_scroll(stdscr, scroll)
start_x_subtitle = int((width // 2) - (len(subtitle) // 2) - len(subtitle) % 2)
stdscr.addstr(height - (height/3), start_x_subtitle, subtitle)