-
Notifications
You must be signed in to change notification settings - Fork 18
/
console.rpy
84 lines (74 loc) · 2.68 KB
/
console.rpy
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
83
84
image console_bg:
"#333"
topleft
alpha 0.75 size (480,180)
style console_text:
font "gui/font/F25_Bank_Printer.ttf"
color "#fff"
size 18
outlines []
#slow_cps 20
style console_text_console is console_text:
slow_cps 30
default consolehistory = []
image console_text = ParameterizedText(style="console_text_console", anchor=(0,0), xpos=30, ypos=10)
image console_history = ParameterizedText(style="console_text", anchor=(0,0), xpos=30, ypos=50)
image console_caret = Text(">", style="console_text", anchor=(0,0), xpos=5, ypos=10)
label updateconsole(text="", history=""):
show console_bg zorder 100
show console_caret zorder 100
show console_text "_" as ctext zorder 100
show console_text "[text]" as ctext zorder 100
$ pause(len(text) / 30.0 + 0.5)
hide ctext
show console_text "_" as ctext zorder 100
call updateconsolehistory(history) from _call_updateconsolehistory
pause 0.5
return
label updateconsole_clearall(text="", history=""):
$ pause(len(text) / 30.0 + 0.5)
pause 0.5
return
label updateconsole_old(text="", history=""):
$ starttime = datetime.datetime.now()
$ textlength = len(text)
$ textcount = 0
show console_bg zorder 100
show console_caret zorder 100
show console_text "_" as ctext zorder 100
label updateconsole_loop:
$ currenttext = text[:textcount]
call drawconsole(drawtext=currenttext) from _call_drawconsole
$ pause_duration = 0.08 - (datetime.datetime.now() - starttime).microseconds / 1000.0 / 1000.0
$ starttime = datetime.datetime.now()
if pause_duration > 0:
$ renpy.pause(pause_duration / 2)
$ textcount += 1
if textcount <= textlength:
jump updateconsole_loop
pause 0.5
hide ctext
show console_text "_" as ctext zorder 100
call updateconsolehistory(history) from _call_updateconsolehistory_1
pause 0.5
return
label drawconsole(drawtext=""):
#$ cursortext = "_".rjust(len(drawtext) + 1)
show console_text "[drawtext]_" as ctext zorder 100
#show console_text cursortext as ccursor zorder 100
return
label updateconsolehistory(text=""):
if text:
python:
consolehistory.insert(0, text)
if len(consolehistory) > 5:
del consolehistory[5:]
consolehistorydisplay = '\n'.join(map(str, consolehistory))
show console_history "[consolehistorydisplay]" as chistory zorder 100
return
label hideconsole:
hide console_bg
hide console_caret
#hide ccursor
hide ctext
hide chistory