screens.rpy 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515
  1. ################################################################################
  2. ## Initialization
  3. ################################################################################
  4. init offset = -1
  5. ################################################################################
  6. ## Styles
  7. ################################################################################
  8. style default:
  9. properties gui.text_properties()
  10. language gui.language
  11. style input:
  12. properties gui.text_properties("input", accent=True)
  13. adjust_spacing False
  14. style hyperlink_text:
  15. properties gui.text_properties("hyperlink", accent=True)
  16. hover_underline True
  17. style gui_text:
  18. properties gui.text_properties("interface")
  19. style button:
  20. properties gui.button_properties("button")
  21. style button_text is gui_text:
  22. properties gui.text_properties("button")
  23. yalign 0.5
  24. style label_text is gui_text:
  25. properties gui.text_properties("label", accent=True)
  26. style prompt_text is gui_text:
  27. properties gui.text_properties("prompt")
  28. style bar:
  29. ysize gui.bar_size
  30. left_bar Frame("gui/bar/left.png", gui.bar_borders, tile=gui.bar_tile)
  31. right_bar Frame("gui/bar/right.png", gui.bar_borders, tile=gui.bar_tile)
  32. style vbar:
  33. xsize gui.bar_size
  34. top_bar Frame("gui/bar/top.png", gui.vbar_borders, tile=gui.bar_tile)
  35. bottom_bar Frame("gui/bar/bottom.png", gui.vbar_borders, tile=gui.bar_tile)
  36. style scrollbar:
  37. ysize gui.scrollbar_size
  38. base_bar Frame("gui/scrollbar/horizontal_[prefix_]bar.png", gui.scrollbar_borders, tile=gui.scrollbar_tile)
  39. thumb Frame("gui/scrollbar/horizontal_[prefix_]thumb.png", gui.scrollbar_borders, tile=gui.scrollbar_tile)
  40. style vscrollbar:
  41. xsize gui.scrollbar_size
  42. base_bar Frame("gui/scrollbar/vertical_[prefix_]bar.png", gui.vscrollbar_borders, tile=gui.scrollbar_tile)
  43. thumb Frame("gui/scrollbar/vertical_[prefix_]thumb.png", gui.vscrollbar_borders, tile=gui.scrollbar_tile)
  44. style slider:
  45. ysize gui.slider_size
  46. base_bar Frame("gui/slider/horizontal_[prefix_]bar.png", gui.slider_borders, tile=gui.slider_tile)
  47. thumb "gui/slider/horizontal_[prefix_]thumb.png"
  48. style vslider:
  49. xsize gui.slider_size
  50. base_bar Frame("gui/slider/vertical_[prefix_]bar.png", gui.vslider_borders, tile=gui.slider_tile)
  51. thumb "gui/slider/vertical_[prefix_]thumb.png"
  52. style frame:
  53. padding gui.frame_borders.padding
  54. background Frame("gui/frame.png", gui.frame_borders, tile=gui.frame_tile)
  55. ################################################################################
  56. ## In-game screens
  57. ################################################################################
  58. ## Say screen ##################################################################
  59. ##
  60. ## The say screen is used to display dialogue to the player. It takes two
  61. ## parameters, who and what, which are the name of the speaking character and
  62. ## the text to be displayed, respectively. (The who parameter can be None if no
  63. ## name is given.)
  64. ##
  65. ## This screen must create a text displayable with id "what", as Ren'Py uses
  66. ## this to manage text display. It can also create displayables with id "who"
  67. ## and id "window" to apply style properties.
  68. ##
  69. ## https://www.renpy.org/doc/html/screen_special.html#say
  70. screen say(who, what):
  71. style_prefix "say"
  72. window:
  73. id "window"
  74. if who is not None:
  75. window:
  76. id "namebox"
  77. style "namebox"
  78. text who id "who"
  79. text what id "what"
  80. ## If there's a side image, display it above the text. Do not display on the
  81. ## phone variant - there's no room.
  82. if not renpy.variant("small"):
  83. add SideImage() xalign 0.0 yalign 1.0
  84. ## Make the namebox available for styling through the Character object.
  85. init python:
  86. config.character_id_prefixes.append('namebox')
  87. style window is default
  88. style say_label is default
  89. style say_dialogue is default
  90. style say_thought is say_dialogue
  91. style namebox is default
  92. style namebox_label is say_label
  93. style window:
  94. xalign 0.5
  95. xfill True
  96. yalign gui.textbox_yalign
  97. ysize gui.textbox_height
  98. background Image("gui/textbox.png", xalign=0.5, yalign=1.0)
  99. style namebox:
  100. xpos gui.name_xpos
  101. xanchor gui.name_xalign
  102. xsize gui.namebox_width
  103. ypos gui.name_ypos
  104. ysize gui.namebox_height
  105. background Frame("gui/namebox.png", gui.namebox_borders, tile=gui.namebox_tile, xalign=gui.name_xalign)
  106. padding gui.namebox_borders.padding
  107. style say_label:
  108. properties gui.text_properties("name", accent=True)
  109. xalign gui.name_xalign
  110. yalign 0.5
  111. style say_dialogue:
  112. properties gui.text_properties("dialogue")
  113. xpos gui.dialogue_xpos
  114. xsize gui.dialogue_width
  115. ypos gui.dialogue_ypos
  116. ## Input screen ################################################################
  117. ##
  118. ## This screen is used to display renpy.input. The prompt parameter is used to
  119. ## pass a text prompt in.
  120. ##
  121. ## This screen must create an input displayable with id "input" to accept the
  122. ## various input parameters.
  123. ##
  124. ## https://www.renpy.org/doc/html/screen_special.html#input
  125. screen input(prompt):
  126. style_prefix "input"
  127. window:
  128. vbox:
  129. xalign gui.dialogue_text_xalign
  130. xpos gui.dialogue_xpos
  131. xsize gui.dialogue_width
  132. ypos gui.dialogue_ypos
  133. text prompt style "input_prompt"
  134. input id "input"
  135. style input_prompt is default
  136. style input_prompt:
  137. xalign gui.dialogue_text_xalign
  138. properties gui.text_properties("input_prompt")
  139. style input:
  140. xalign gui.dialogue_text_xalign
  141. xmaximum gui.dialogue_width
  142. ## Choice screen ###############################################################
  143. ##
  144. ## This screen is used to display the in-game choices presented by the menu
  145. ## statement. The one parameter, items, is a list of objects, each with caption
  146. ## and action fields.
  147. ##
  148. ## https://www.renpy.org/doc/html/screen_special.html#choice
  149. screen choice(items):
  150. style_prefix "choice"
  151. vbox:
  152. for i in items:
  153. textbutton i.caption action i.action
  154. ## When this is true, menu captions will be spoken by the narrator. When false,
  155. ## menu captions will be displayed as empty buttons.
  156. define config.narrator_menu = True
  157. style choice_vbox is vbox
  158. style choice_button is button
  159. style choice_button_text is button_text
  160. style choice_vbox:
  161. xalign 0.5
  162. ypos 270
  163. yanchor 0.5
  164. spacing gui.choice_spacing
  165. style choice_button is default:
  166. properties gui.button_properties("choice_button")
  167. style choice_button_text is default:
  168. properties gui.button_text_properties("choice_button")
  169. ## Quick Menu screen ###########################################################
  170. ##
  171. ## The quick menu is displayed in-game to provide easy access to the out-of-game
  172. ## menus.
  173. screen quick_menu():
  174. ## Ensure this appears on top of other screens.
  175. zorder 100
  176. if quick_menu:
  177. hbox:
  178. style_prefix "quick"
  179. xalign 0.5
  180. yalign 1.0
  181. textbutton _("Back") action Rollback()
  182. textbutton _("History") action ShowMenu('history')
  183. textbutton _("Skip") action Skip() alternate Skip(fast=True, confirm=True)
  184. textbutton _("Auto") action Preference("auto-forward", "toggle")
  185. textbutton _("Save") action ShowMenu('save')
  186. textbutton _("Q.Save") action QuickSave()
  187. textbutton _("Q.Load") action QuickLoad()
  188. textbutton _("Prefs") action ShowMenu('preferences')
  189. ## This code ensures that the quick_menu screen is displayed in-game, whenever
  190. ## the player has not explicitly hidden the interface.
  191. init python:
  192. config.overlay_screens.append("quick_menu")
  193. default quick_menu = True
  194. style quick_button is default
  195. style quick_button_text is button_text
  196. style quick_button:
  197. properties gui.button_properties("quick_button")
  198. style quick_button_text:
  199. properties gui.button_text_properties("quick_button")
  200. ################################################################################
  201. ## Main and Game Menu Screens
  202. ################################################################################
  203. ## Navigation screen ###########################################################
  204. ##
  205. ## This screen is included in the main and game menus, and provides navigation
  206. ## to other menus, and to start the game.
  207. screen navigation():
  208. vbox:
  209. style_prefix "navigation"
  210. xpos gui.navigation_xpos
  211. yalign 0.5
  212. spacing gui.navigation_spacing
  213. if main_menu:
  214. textbutton _("Start") action Start()
  215. else:
  216. textbutton _("History") action ShowMenu("history")
  217. textbutton _("Save") action ShowMenu("save")
  218. textbutton _("Load") action ShowMenu("load")
  219. textbutton _("Preferences") action ShowMenu("preferences")
  220. if _in_replay:
  221. textbutton _("End Replay") action EndReplay(confirm=True)
  222. elif not main_menu:
  223. textbutton _("Main Menu") action MainMenu()
  224. textbutton _("About") action ShowMenu("about")
  225. if renpy.variant("pc") or (renpy.variant("web") and not renpy.variant("mobile")):
  226. ## Help isn't necessary or relevant to mobile devices.
  227. textbutton _("Help") action ShowMenu("help")
  228. if renpy.variant("pc"):
  229. ## The quit button is banned on iOS and unnecessary on Android and
  230. ## Web.
  231. textbutton _("Quit") action Quit(confirm=not main_menu)
  232. style navigation_button is gui_button
  233. style navigation_button_text is gui_button_text
  234. style navigation_button:
  235. size_group "navigation"
  236. properties gui.button_properties("navigation_button")
  237. style navigation_button_text:
  238. properties gui.button_text_properties("navigation_button")
  239. ## Main Menu screen ############################################################
  240. ##
  241. ## Used to display the main menu when Ren'Py starts.
  242. ##
  243. ## https://www.renpy.org/doc/html/screen_special.html#main-menu
  244. screen main_menu():
  245. ## This ensures that any other menu screen is replaced.
  246. tag menu
  247. add gui.main_menu_background
  248. ## This empty frame darkens the main menu.
  249. frame:
  250. style "main_menu_frame"
  251. ## The use statement includes another screen inside this one. The actual
  252. ## contents of the main menu are in the navigation screen.
  253. use navigation
  254. if gui.show_name:
  255. vbox:
  256. style "main_menu_vbox"
  257. text "[config.name!t]":
  258. style "main_menu_title"
  259. text "[config.version]":
  260. style "main_menu_version"
  261. style main_menu_frame is empty
  262. style main_menu_vbox is vbox
  263. style main_menu_text is gui_text
  264. style main_menu_title is main_menu_text
  265. style main_menu_version is main_menu_text
  266. style main_menu_frame:
  267. xsize 280
  268. yfill True
  269. background "gui/overlay/main_menu.png"
  270. style main_menu_vbox:
  271. xalign 1.0
  272. xoffset -20
  273. xmaximum 800
  274. yalign 1.0
  275. yoffset -20
  276. style main_menu_text:
  277. properties gui.text_properties("main_menu", accent=True)
  278. style main_menu_title:
  279. properties gui.text_properties("title")
  280. style main_menu_version:
  281. properties gui.text_properties("version")
  282. ## Game Menu screen ############################################################
  283. ##
  284. ## This lays out the basic common structure of a game menu screen. It's called
  285. ## with the screen title, and displays the background, title, and navigation.
  286. ##
  287. ## The scroll parameter can be None, or one of "viewport" or "vpgrid". When
  288. ## this screen is intended to be used with one or more children, which are
  289. ## transcluded (placed) inside it.
  290. screen game_menu(title, scroll=None, yinitial=0.0):
  291. style_prefix "game_menu"
  292. if main_menu:
  293. add gui.main_menu_background
  294. else:
  295. add gui.game_menu_background
  296. frame:
  297. style "game_menu_outer_frame"
  298. hbox:
  299. ## Reserve space for the navigation section.
  300. frame:
  301. style "game_menu_navigation_frame"
  302. frame:
  303. style "game_menu_content_frame"
  304. if scroll == "viewport":
  305. viewport:
  306. yinitial yinitial
  307. scrollbars "vertical"
  308. mousewheel True
  309. draggable True
  310. pagekeys True
  311. side_yfill True
  312. vbox:
  313. transclude
  314. elif scroll == "vpgrid":
  315. vpgrid:
  316. cols 1
  317. yinitial yinitial
  318. scrollbars "vertical"
  319. mousewheel True
  320. draggable True
  321. pagekeys True
  322. side_yfill True
  323. transclude
  324. else:
  325. transclude
  326. use navigation
  327. textbutton _("Return"):
  328. style "return_button"
  329. action Return()
  330. label title
  331. if main_menu:
  332. key "game_menu" action ShowMenu("main_menu")
  333. style game_menu_outer_frame is empty
  334. style game_menu_navigation_frame is empty
  335. style game_menu_content_frame is empty
  336. style game_menu_viewport is gui_viewport
  337. style game_menu_side is gui_side
  338. style game_menu_scrollbar is gui_vscrollbar
  339. style game_menu_label is gui_label
  340. style game_menu_label_text is gui_label_text
  341. style return_button is navigation_button
  342. style return_button_text is navigation_button_text
  343. style game_menu_outer_frame:
  344. bottom_padding 30
  345. top_padding 120
  346. background "gui/overlay/game_menu.png"
  347. style game_menu_navigation_frame:
  348. xsize 280
  349. yfill True
  350. style game_menu_content_frame:
  351. left_margin 40
  352. right_margin 20
  353. top_margin 10
  354. style game_menu_viewport:
  355. xsize 920
  356. style game_menu_vscrollbar:
  357. unscrollable gui.unscrollable
  358. style game_menu_side:
  359. spacing 10
  360. style game_menu_label:
  361. xpos 50
  362. ysize 120
  363. style game_menu_label_text:
  364. size gui.title_text_size
  365. color gui.accent_color
  366. yalign 0.5
  367. style return_button:
  368. xpos gui.navigation_xpos
  369. yalign 1.0
  370. yoffset -30
  371. ## About screen ################################################################
  372. ##
  373. ## This screen gives credit and copyright information about the game and Ren'Py.
  374. ##
  375. ## There's nothing special about this screen, and hence it also serves as an
  376. ## example of how to make a custom screen.
  377. screen about():
  378. tag menu
  379. ## This use statement includes the game_menu screen inside this one. The
  380. ## vbox child is then included inside the viewport inside the game_menu
  381. ## screen.
  382. use game_menu(_("About"), scroll="viewport"):
  383. style_prefix "about"
  384. vbox:
  385. label "[config.name!t]"
  386. text _("Version [config.version!t]\n")
  387. ## gui.about is usually set in options.rpy.
  388. if gui.about:
  389. text "[gui.about!t]\n"
  390. text _("Made with {a=https://www.renpy.org/}Ren'Py{/a} [renpy.version_only].\n\n[renpy.license!t]")
  391. style about_label is gui_label
  392. style about_label_text is gui_label_text
  393. style about_text is gui_text
  394. style about_label_text:
  395. size gui.label_text_size
  396. ## Load and Save screens #######################################################
  397. ##
  398. ## These screens are responsible for letting the player save the game and load
  399. ## it again. Since they share nearly everything in common, both are implemented
  400. ## in terms of a third screen, file_slots.
  401. ##
  402. ## https://www.renpy.org/doc/html/screen_special.html#save https://
  403. ## www.renpy.org/doc/html/screen_special.html#load
  404. screen save():
  405. tag menu
  406. use file_slots(_("Save"))
  407. screen load():
  408. tag menu
  409. use file_slots(_("Load"))
  410. screen file_slots(title):
  411. default page_name_value = FilePageNameInputValue(pattern=_("Page {}"), auto=_("Automatic saves"), quick=_("Quick saves"))
  412. use game_menu(title):
  413. fixed:
  414. ## This ensures the input will get the enter event before any of the
  415. ## buttons do.
  416. order_reverse True
  417. ## The page name, which can be edited by clicking on a button.
  418. button:
  419. style "page_label"
  420. key_events True
  421. xalign 0.5
  422. action page_name_value.Toggle()
  423. input:
  424. style "page_label_text"
  425. value page_name_value
  426. ## The grid of file slots.
  427. grid gui.file_slot_cols gui.file_slot_rows:
  428. style_prefix "slot"
  429. xalign 0.5
  430. yalign 0.5
  431. spacing gui.slot_spacing
  432. for i in range(gui.file_slot_cols * gui.file_slot_rows):
  433. $ slot = i + 1
  434. button:
  435. action FileAction(slot)
  436. has vbox
  437. add FileScreenshot(slot) xalign 0.5
  438. text FileTime(slot, format=_("{#file_time}%A, %B %d %Y, %H:%M"), empty=_("empty slot")):
  439. style "slot_time_text"
  440. text FileSaveName(slot):
  441. style "slot_name_text"
  442. key "save_delete" action FileDelete(slot)
  443. ## Buttons to access other pages.
  444. hbox:
  445. style_prefix "page"
  446. xalign 0.5
  447. yalign 1.0
  448. spacing gui.page_spacing
  449. textbutton _("<") action FilePagePrevious()
  450. if config.has_autosave:
  451. textbutton _("{#auto_page}A") action FilePage("auto")
  452. if config.has_quicksave:
  453. textbutton _("{#quick_page}Q") action FilePage("quick")
  454. ## range(1, 10) gives the numbers from 1 to 9.
  455. for page in range(1, 10):
  456. textbutton "[page]" action FilePage(page)
  457. textbutton _(">") action FilePageNext()
  458. style page_label is gui_label
  459. style page_label_text is gui_label_text
  460. style page_button is gui_button
  461. style page_button_text is gui_button_text
  462. style slot_button is gui_button
  463. style slot_button_text is gui_button_text
  464. style slot_time_text is slot_button_text
  465. style slot_name_text is slot_button_text
  466. style page_label:
  467. xpadding 50
  468. ypadding 3
  469. style page_label_text:
  470. text_align 0.5
  471. layout "subtitle"
  472. hover_color gui.hover_color
  473. style page_button:
  474. properties gui.button_properties("page_button")
  475. style page_button_text:
  476. properties gui.button_text_properties("page_button")
  477. style slot_button:
  478. properties gui.button_properties("slot_button")
  479. style slot_button_text:
  480. properties gui.button_text_properties("slot_button")
  481. ## Preferences screen ##########################################################
  482. ##
  483. ## The preferences screen allows the player to configure the game to better suit
  484. ## themselves.
  485. ##
  486. ## https://www.renpy.org/doc/html/screen_special.html#preferences
  487. screen preferences():
  488. tag menu
  489. use game_menu(_("Preferences"), scroll="viewport"):
  490. vbox:
  491. hbox:
  492. box_wrap True
  493. if renpy.variant("pc") or renpy.variant("web"):
  494. vbox:
  495. style_prefix "radio"
  496. label _("Display")
  497. textbutton _("Window") action Preference("display", "window")
  498. textbutton _("Fullscreen") action Preference("display", "fullscreen")
  499. vbox:
  500. style_prefix "radio"
  501. label _("Rollback Side")
  502. textbutton _("Disable") action Preference("rollback side", "disable")
  503. textbutton _("Left") action Preference("rollback side", "left")
  504. textbutton _("Right") action Preference("rollback side", "right")
  505. vbox:
  506. style_prefix "check"
  507. label _("Skip")
  508. textbutton _("Unseen Text") action Preference("skip", "toggle")
  509. textbutton _("After Choices") action Preference("after choices", "toggle")
  510. textbutton _("Transitions") action InvertSelected(Preference("transitions", "toggle"))
  511. ## Additional vboxes of type "radio_pref" or "check_pref" can be
  512. ## added here, to add additional creator-defined preferences.
  513. null height (4 * gui.pref_spacing)
  514. hbox:
  515. style_prefix "slider"
  516. box_wrap True
  517. vbox:
  518. label _("Text Speed")
  519. bar value Preference("text speed")
  520. label _("Auto-Forward Time")
  521. bar value Preference("auto-forward time")
  522. vbox:
  523. if config.has_music:
  524. label _("Music Volume")
  525. hbox:
  526. bar value Preference("music volume")
  527. if config.has_sound:
  528. label _("Sound Volume")
  529. hbox:
  530. bar value Preference("sound volume")
  531. if config.sample_sound:
  532. textbutton _("Test") action Play("sound", config.sample_sound)
  533. if config.has_voice:
  534. label _("Voice Volume")
  535. hbox:
  536. bar value Preference("voice volume")
  537. if config.sample_voice:
  538. textbutton _("Test") action Play("voice", config.sample_voice)
  539. if config.has_music or config.has_sound or config.has_voice:
  540. null height gui.pref_spacing
  541. textbutton _("Mute All"):
  542. action Preference("all mute", "toggle")
  543. style "mute_all_button"
  544. style pref_label is gui_label
  545. style pref_label_text is gui_label_text
  546. style pref_vbox is vbox
  547. style radio_label is pref_label
  548. style radio_label_text is pref_label_text
  549. style radio_button is gui_button
  550. style radio_button_text is gui_button_text
  551. style radio_vbox is pref_vbox
  552. style check_label is pref_label
  553. style check_label_text is pref_label_text
  554. style check_button is gui_button
  555. style check_button_text is gui_button_text
  556. style check_vbox is pref_vbox
  557. style slider_label is pref_label
  558. style slider_label_text is pref_label_text
  559. style slider_slider is gui_slider
  560. style slider_button is gui_button
  561. style slider_button_text is gui_button_text
  562. style slider_pref_vbox is pref_vbox
  563. style mute_all_button is check_button
  564. style mute_all_button_text is check_button_text
  565. style pref_label:
  566. top_margin gui.pref_spacing
  567. bottom_margin 2
  568. style pref_label_text:
  569. yalign 1.0
  570. style pref_vbox:
  571. xsize 225
  572. style radio_vbox:
  573. spacing gui.pref_button_spacing
  574. style radio_button:
  575. properties gui.button_properties("radio_button")
  576. foreground "gui/button/radio_[prefix_]foreground.png"
  577. style radio_button_text:
  578. properties gui.button_text_properties("radio_button")
  579. style check_vbox:
  580. spacing gui.pref_button_spacing
  581. style check_button:
  582. properties gui.button_properties("check_button")
  583. foreground "gui/button/check_[prefix_]foreground.png"
  584. style check_button_text:
  585. properties gui.button_text_properties("check_button")
  586. style slider_slider:
  587. xsize 350
  588. style slider_button:
  589. properties gui.button_properties("slider_button")
  590. yalign 0.5
  591. left_margin 10
  592. style slider_button_text:
  593. properties gui.button_text_properties("slider_button")
  594. style slider_vbox:
  595. xsize 450
  596. ## History screen ##############################################################
  597. ##
  598. ## This is a screen that displays the dialogue history to the player. While
  599. ## there isn't anything special about this screen, it does have to access the
  600. ## dialogue history stored in _history_list.
  601. ##
  602. ## https://www.renpy.org/doc/html/history.html
  603. screen history():
  604. tag menu
  605. ## Avoid predicting this screen, as it can be very large.
  606. predict False
  607. use game_menu(_("History"), scroll=("vpgrid" if gui.history_height else "viewport"), yinitial=1.0):
  608. style_prefix "history"
  609. for h in _history_list:
  610. window:
  611. ## This lays things out properly if history_height is None.
  612. has fixed:
  613. yfit True
  614. if h.who:
  615. label h.who:
  616. style "history_name"
  617. substitute False
  618. ## Take the color of the who text from the Character, if
  619. ## set.
  620. if "color" in h.who_args:
  621. text_color h.who_args["color"]
  622. $ what = renpy.filter_text_tags(h.what, allow=gui.history_allow_tags)
  623. text what:
  624. substitute False
  625. if not _history_list:
  626. label _("The dialogue history is empty.")
  627. ## This determines what tags are allowed to be displayed on the history screen.
  628. define gui.history_allow_tags = { "alt", "noalt" }
  629. style history_window is empty
  630. style history_name is gui_label
  631. style history_name_text is gui_label_text
  632. style history_text is gui_text
  633. style history_text is gui_text
  634. style history_label is gui_label
  635. style history_label_text is gui_label_text
  636. style history_window:
  637. xfill True
  638. ysize gui.history_height
  639. style history_name:
  640. xpos gui.history_name_xpos
  641. xanchor gui.history_name_xalign
  642. ypos gui.history_name_ypos
  643. xsize gui.history_name_width
  644. style history_name_text:
  645. min_width gui.history_name_width
  646. text_align gui.history_name_xalign
  647. style history_text:
  648. xpos gui.history_text_xpos
  649. ypos gui.history_text_ypos
  650. xanchor gui.history_text_xalign
  651. xsize gui.history_text_width
  652. min_width gui.history_text_width
  653. text_align gui.history_text_xalign
  654. layout ("subtitle" if gui.history_text_xalign else "tex")
  655. style history_label:
  656. xfill True
  657. style history_label_text:
  658. xalign 0.5
  659. ## Help screen #################################################################
  660. ##
  661. ## A screen that gives information about key and mouse bindings. It uses other
  662. ## screens (keyboard_help, mouse_help, and gamepad_help) to display the actual
  663. ## help.
  664. screen help():
  665. tag menu
  666. default device = "keyboard"
  667. use game_menu(_("Help"), scroll="viewport"):
  668. style_prefix "help"
  669. vbox:
  670. spacing 15
  671. hbox:
  672. textbutton _("Keyboard") action SetScreenVariable("device", "keyboard")
  673. textbutton _("Mouse") action SetScreenVariable("device", "mouse")
  674. if GamepadExists():
  675. textbutton _("Gamepad") action SetScreenVariable("device", "gamepad")
  676. if device == "keyboard":
  677. use keyboard_help
  678. elif device == "mouse":
  679. use mouse_help
  680. elif device == "gamepad":
  681. use gamepad_help
  682. screen keyboard_help():
  683. hbox:
  684. label _("Enter")
  685. text _("Advances dialogue and activates the interface.")
  686. hbox:
  687. label _("Space")
  688. text _("Advances dialogue without selecting choices.")
  689. hbox:
  690. label _("Arrow Keys")
  691. text _("Navigate the interface.")
  692. hbox:
  693. label _("Escape")
  694. text _("Accesses the game menu.")
  695. hbox:
  696. label _("Ctrl")
  697. text _("Skips dialogue while held down.")
  698. hbox:
  699. label _("Tab")
  700. text _("Toggles dialogue skipping.")
  701. hbox:
  702. label _("Page Up")
  703. text _("Rolls back to earlier dialogue.")
  704. hbox:
  705. label _("Page Down")
  706. text _("Rolls forward to later dialogue.")
  707. hbox:
  708. label "H"
  709. text _("Hides the user interface.")
  710. hbox:
  711. label "S"
  712. text _("Takes a screenshot.")
  713. hbox:
  714. label "V"
  715. text _("Toggles assistive {a=https://www.renpy.org/l/voicing}self-voicing{/a}.")
  716. screen mouse_help():
  717. hbox:
  718. label _("Left Click")
  719. text _("Advances dialogue and activates the interface.")
  720. hbox:
  721. label _("Middle Click")
  722. text _("Hides the user interface.")
  723. hbox:
  724. label _("Right Click")
  725. text _("Accesses the game menu.")
  726. hbox:
  727. label _("Mouse Wheel Up\nClick Rollback Side")
  728. text _("Rolls back to earlier dialogue.")
  729. hbox:
  730. label _("Mouse Wheel Down")
  731. text _("Rolls forward to later dialogue.")
  732. screen gamepad_help():
  733. hbox:
  734. label _("Right Trigger\nA/Bottom Button")
  735. text _("Advances dialogue and activates the interface.")
  736. hbox:
  737. label _("Left Trigger\nLeft Shoulder")
  738. text _("Rolls back to earlier dialogue.")
  739. hbox:
  740. label _("Right Shoulder")
  741. text _("Rolls forward to later dialogue.")
  742. hbox:
  743. label _("D-Pad, Sticks")
  744. text _("Navigate the interface.")
  745. hbox:
  746. label _("Start, Guide")
  747. text _("Accesses the game menu.")
  748. hbox:
  749. label _("Y/Top Button")
  750. text _("Hides the user interface.")
  751. textbutton _("Calibrate") action GamepadCalibrate()
  752. style help_button is gui_button
  753. style help_button_text is gui_button_text
  754. style help_label is gui_label
  755. style help_label_text is gui_label_text
  756. style help_text is gui_text
  757. style help_button:
  758. properties gui.button_properties("help_button")
  759. xmargin 8
  760. style help_button_text:
  761. properties gui.button_text_properties("help_button")
  762. style help_label:
  763. xsize 250
  764. right_padding 20
  765. style help_label_text:
  766. size gui.text_size
  767. xalign 1.0
  768. text_align 1.0
  769. ################################################################################
  770. ## Additional screens
  771. ################################################################################
  772. ## Confirm screen ##############################################################
  773. ##
  774. ## The confirm screen is called when Ren'Py wants to ask the player a yes or no
  775. ## question.
  776. ##
  777. ## https://www.renpy.org/doc/html/screen_special.html#confirm
  778. screen confirm(message, yes_action, no_action):
  779. ## Ensure other screens do not get input while this screen is displayed.
  780. modal True
  781. zorder 200
  782. style_prefix "confirm"
  783. add "gui/overlay/confirm.png"
  784. frame:
  785. vbox:
  786. xalign .5
  787. yalign .5
  788. spacing 30
  789. label _(message):
  790. style "confirm_prompt"
  791. xalign 0.5
  792. hbox:
  793. xalign 0.5
  794. spacing 100
  795. textbutton _("Yes") action yes_action
  796. textbutton _("No") action no_action
  797. ## Right-click and escape answer "no".
  798. key "game_menu" action no_action
  799. style confirm_frame is gui_frame
  800. style confirm_prompt is gui_prompt
  801. style confirm_prompt_text is gui_prompt_text
  802. style confirm_button is gui_medium_button
  803. style confirm_button_text is gui_medium_button_text
  804. style confirm_frame:
  805. background Frame([ "gui/confirm_frame.png", "gui/frame.png"], gui.confirm_frame_borders, tile=gui.frame_tile)
  806. padding gui.confirm_frame_borders.padding
  807. xalign .5
  808. yalign .5
  809. style confirm_prompt_text:
  810. text_align 0.5
  811. layout "subtitle"
  812. style confirm_button:
  813. properties gui.button_properties("confirm_button")
  814. style confirm_button_text:
  815. properties gui.button_text_properties("confirm_button")
  816. ## Skip indicator screen #######################################################
  817. ##
  818. ## The skip_indicator screen is displayed to indicate that skipping is in
  819. ## progress.
  820. ##
  821. ## https://www.renpy.org/doc/html/screen_special.html#skip-indicator
  822. screen skip_indicator():
  823. zorder 100
  824. style_prefix "skip"
  825. frame:
  826. hbox:
  827. spacing 6
  828. text _("Skipping")
  829. text "▸" at delayed_blink(0.0, 1.0) style "skip_triangle"
  830. text "▸" at delayed_blink(0.2, 1.0) style "skip_triangle"
  831. text "▸" at delayed_blink(0.4, 1.0) style "skip_triangle"
  832. ## This transform is used to blink the arrows one after another.
  833. transform delayed_blink(delay, cycle):
  834. alpha .5
  835. pause delay
  836. block:
  837. linear .2 alpha 1.0
  838. pause .2
  839. linear .2 alpha 0.5
  840. pause (cycle - .4)
  841. repeat
  842. style skip_frame is empty
  843. style skip_text is gui_text
  844. style skip_triangle is skip_text
  845. style skip_frame:
  846. ypos gui.skip_ypos
  847. background Frame("gui/skip.png", gui.skip_frame_borders, tile=gui.frame_tile)
  848. padding gui.skip_frame_borders.padding
  849. style skip_text:
  850. size gui.notify_text_size
  851. style skip_triangle:
  852. ## We have to use a font that has the BLACK RIGHT-POINTING SMALL TRIANGLE
  853. ## glyph in it.
  854. font "DejaVuSans.ttf"
  855. ## Notify screen ###############################################################
  856. ##
  857. ## The notify screen is used to show the player a message. (For example, when
  858. ## the game is quicksaved or a screenshot has been taken.)
  859. ##
  860. ## https://www.renpy.org/doc/html/screen_special.html#notify-screen
  861. screen notify(message):
  862. zorder 100
  863. style_prefix "notify"
  864. frame at notify_appear:
  865. text "[message!tq]"
  866. timer 3.25 action Hide('notify')
  867. transform notify_appear:
  868. on show:
  869. alpha 0
  870. linear .25 alpha 1.0
  871. on hide:
  872. linear .5 alpha 0.0
  873. style notify_frame is empty
  874. style notify_text is gui_text
  875. style notify_frame:
  876. ypos gui.notify_ypos
  877. background Frame("gui/notify.png", gui.notify_frame_borders, tile=gui.frame_tile)
  878. padding gui.notify_frame_borders.padding
  879. style notify_text:
  880. properties gui.text_properties("notify")
  881. ## NVL screen ##################################################################
  882. ##
  883. ## This screen is used for NVL-mode dialogue and menus.
  884. ##
  885. ## https://www.renpy.org/doc/html/screen_special.html#nvl
  886. screen nvl(dialogue, items=None):
  887. window:
  888. style "nvl_window"
  889. has vbox:
  890. spacing gui.nvl_spacing
  891. ## Displays dialogue in either a vpgrid or the vbox.
  892. if gui.nvl_height:
  893. vpgrid:
  894. cols 1
  895. yinitial 1.0
  896. use nvl_dialogue(dialogue)
  897. else:
  898. use nvl_dialogue(dialogue)
  899. ## Displays the menu, if given. The menu may be displayed incorrectly if
  900. ## config.narrator_menu is set to True, as it is above.
  901. for i in items:
  902. textbutton i.caption:
  903. action i.action
  904. style "nvl_button"
  905. add SideImage() xalign 0.0 yalign 1.0
  906. screen nvl_dialogue(dialogue):
  907. for d in dialogue:
  908. window:
  909. id d.window_id
  910. fixed:
  911. yfit gui.nvl_height is None
  912. if d.who is not None:
  913. text d.who:
  914. id d.who_id
  915. text d.what:
  916. id d.what_id
  917. ## This controls the maximum number of NVL-mode entries that can be displayed at
  918. ## once.
  919. define config.nvl_list_length = gui.nvl_list_length
  920. style nvl_window is default
  921. style nvl_entry is default
  922. style nvl_label is say_label
  923. style nvl_dialogue is say_dialogue
  924. style nvl_button is button
  925. style nvl_button_text is button_text
  926. style nvl_window:
  927. xfill True
  928. yfill True
  929. background "gui/nvl.png"
  930. padding gui.nvl_borders.padding
  931. style nvl_entry:
  932. xfill True
  933. ysize gui.nvl_height
  934. style nvl_label:
  935. xpos gui.nvl_name_xpos
  936. xanchor gui.nvl_name_xalign
  937. ypos gui.nvl_name_ypos
  938. yanchor 0.0
  939. xsize gui.nvl_name_width
  940. min_width gui.nvl_name_width
  941. text_align gui.nvl_name_xalign
  942. style nvl_dialogue:
  943. xpos gui.nvl_text_xpos
  944. xanchor gui.nvl_text_xalign
  945. ypos gui.nvl_text_ypos
  946. xsize gui.nvl_text_width
  947. min_width gui.nvl_text_width
  948. text_align gui.nvl_text_xalign
  949. layout ("subtitle" if gui.nvl_text_xalign else "tex")
  950. style nvl_thought:
  951. xpos gui.nvl_thought_xpos
  952. xanchor gui.nvl_thought_xalign
  953. ypos gui.nvl_thought_ypos
  954. xsize gui.nvl_thought_width
  955. min_width gui.nvl_thought_width
  956. text_align gui.nvl_thought_xalign
  957. layout ("subtitle" if gui.nvl_text_xalign else "tex")
  958. style nvl_button:
  959. properties gui.button_properties("nvl_button")
  960. xpos gui.nvl_button_xpos
  961. xanchor gui.nvl_button_xalign
  962. style nvl_button_text:
  963. properties gui.button_text_properties("nvl_button")
  964. ################################################################################
  965. ## Mobile Variants
  966. ################################################################################
  967. style pref_vbox:
  968. variant "medium"
  969. xsize 450
  970. ## Since a mouse may not be present, we replace the quick menu with a version
  971. ## that uses fewer and bigger buttons that are easier to touch.
  972. screen quick_menu():
  973. variant "touch"
  974. zorder 100
  975. if quick_menu:
  976. hbox:
  977. style_prefix "quick"
  978. xalign 0.5
  979. yalign 1.0
  980. textbutton _("Back") action Rollback()
  981. textbutton _("Skip") action Skip() alternate Skip(fast=True, confirm=True)
  982. textbutton _("Auto") action Preference("auto-forward", "toggle")
  983. textbutton _("Menu") action ShowMenu()
  984. style window:
  985. variant "small"
  986. background "gui/phone/textbox.png"
  987. style radio_button:
  988. variant "small"
  989. foreground "gui/phone/button/radio_[prefix_]foreground.png"
  990. style check_button:
  991. variant "small"
  992. foreground "gui/phone/button/check_[prefix_]foreground.png"
  993. style nvl_window:
  994. variant "small"
  995. background "gui/phone/nvl.png"
  996. style main_menu_frame:
  997. variant "small"
  998. background "gui/phone/overlay/main_menu.png"
  999. style game_menu_outer_frame:
  1000. variant "small"
  1001. background "gui/phone/overlay/game_menu.png"
  1002. style game_menu_navigation_frame:
  1003. variant "small"
  1004. xsize 340
  1005. style game_menu_content_frame:
  1006. variant "small"
  1007. top_margin 0
  1008. style pref_vbox:
  1009. variant "small"
  1010. xsize 400
  1011. style bar:
  1012. variant "small"
  1013. ysize gui.bar_size
  1014. left_bar Frame("gui/phone/bar/left.png", gui.bar_borders, tile=gui.bar_tile)
  1015. right_bar Frame("gui/phone/bar/right.png", gui.bar_borders, tile=gui.bar_tile)
  1016. style vbar:
  1017. variant "small"
  1018. xsize gui.bar_size
  1019. top_bar Frame("gui/phone/bar/top.png", gui.vbar_borders, tile=gui.bar_tile)
  1020. bottom_bar Frame("gui/phone/bar/bottom.png", gui.vbar_borders, tile=gui.bar_tile)
  1021. style scrollbar:
  1022. variant "small"
  1023. ysize gui.scrollbar_size
  1024. base_bar Frame("gui/phone/scrollbar/horizontal_[prefix_]bar.png", gui.scrollbar_borders, tile=gui.scrollbar_tile)
  1025. thumb Frame("gui/phone/scrollbar/horizontal_[prefix_]thumb.png", gui.scrollbar_borders, tile=gui.scrollbar_tile)
  1026. style vscrollbar:
  1027. variant "small"
  1028. xsize gui.scrollbar_size
  1029. base_bar Frame("gui/phone/scrollbar/vertical_[prefix_]bar.png", gui.vscrollbar_borders, tile=gui.scrollbar_tile)
  1030. thumb Frame("gui/phone/scrollbar/vertical_[prefix_]thumb.png", gui.vscrollbar_borders, tile=gui.scrollbar_tile)
  1031. style slider:
  1032. variant "small"
  1033. ysize gui.slider_size
  1034. base_bar Frame("gui/phone/slider/horizontal_[prefix_]bar.png", gui.slider_borders, tile=gui.slider_tile)
  1035. thumb "gui/phone/slider/horizontal_[prefix_]thumb.png"
  1036. style vslider:
  1037. variant "small"
  1038. xsize gui.slider_size
  1039. base_bar Frame("gui/phone/slider/vertical_[prefix_]bar.png", gui.vslider_borders, tile=gui.slider_tile)
  1040. thumb "gui/phone/slider/vertical_[prefix_]thumb.png"
  1041. style slider_vbox:
  1042. variant "small"
  1043. xsize None
  1044. style slider_slider:
  1045. variant "small"
  1046. xsize 600