screens.rpy 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519
  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. hbox:
  717. label "Shift+A"
  718. text _("Opens the accessibility menu.")
  719. screen mouse_help():
  720. hbox:
  721. label _("Left Click")
  722. text _("Advances dialogue and activates the interface.")
  723. hbox:
  724. label _("Middle Click")
  725. text _("Hides the user interface.")
  726. hbox:
  727. label _("Right Click")
  728. text _("Accesses the game menu.")
  729. hbox:
  730. label _("Mouse Wheel Up\nClick Rollback Side")
  731. text _("Rolls back to earlier dialogue.")
  732. hbox:
  733. label _("Mouse Wheel Down")
  734. text _("Rolls forward to later dialogue.")
  735. screen gamepad_help():
  736. hbox:
  737. label _("Right Trigger\nA/Bottom Button")
  738. text _("Advances dialogue and activates the interface.")
  739. hbox:
  740. label _("Left Trigger\nLeft Shoulder")
  741. text _("Rolls back to earlier dialogue.")
  742. hbox:
  743. label _("Right Shoulder")
  744. text _("Rolls forward to later dialogue.")
  745. hbox:
  746. label _("D-Pad, Sticks")
  747. text _("Navigate the interface.")
  748. hbox:
  749. label _("Start, Guide")
  750. text _("Accesses the game menu.")
  751. hbox:
  752. label _("Y/Top Button")
  753. text _("Hides the user interface.")
  754. textbutton _("Calibrate") action GamepadCalibrate()
  755. style help_button is gui_button
  756. style help_button_text is gui_button_text
  757. style help_label is gui_label
  758. style help_label_text is gui_label_text
  759. style help_text is gui_text
  760. style help_button:
  761. properties gui.button_properties("help_button")
  762. xmargin 8
  763. style help_button_text:
  764. properties gui.button_text_properties("help_button")
  765. style help_label:
  766. xsize 250
  767. right_padding 20
  768. style help_label_text:
  769. size gui.text_size
  770. xalign 1.0
  771. text_align 1.0
  772. ################################################################################
  773. ## Additional screens
  774. ################################################################################
  775. ## Confirm screen ##############################################################
  776. ##
  777. ## The confirm screen is called when Ren'Py wants to ask the player a yes or no
  778. ## question.
  779. ##
  780. ## https://www.renpy.org/doc/html/screen_special.html#confirm
  781. screen confirm(message, yes_action, no_action):
  782. ## Ensure other screens do not get input while this screen is displayed.
  783. modal True
  784. zorder 200
  785. style_prefix "confirm"
  786. add "gui/overlay/confirm.png"
  787. frame:
  788. vbox:
  789. xalign .5
  790. yalign .5
  791. spacing 30
  792. label _(message):
  793. style "confirm_prompt"
  794. xalign 0.5
  795. hbox:
  796. xalign 0.5
  797. spacing 100
  798. textbutton _("Yes") action yes_action
  799. textbutton _("No") action no_action
  800. ## Right-click and escape answer "no".
  801. key "game_menu" action no_action
  802. style confirm_frame is gui_frame
  803. style confirm_prompt is gui_prompt
  804. style confirm_prompt_text is gui_prompt_text
  805. style confirm_button is gui_medium_button
  806. style confirm_button_text is gui_medium_button_text
  807. style confirm_frame:
  808. background Frame([ "gui/confirm_frame.png", "gui/frame.png"], gui.confirm_frame_borders, tile=gui.frame_tile)
  809. padding gui.confirm_frame_borders.padding
  810. xalign .5
  811. yalign .5
  812. style confirm_prompt_text:
  813. text_align 0.5
  814. layout "subtitle"
  815. style confirm_button:
  816. properties gui.button_properties("confirm_button")
  817. style confirm_button_text:
  818. properties gui.button_text_properties("confirm_button")
  819. ## Skip indicator screen #######################################################
  820. ##
  821. ## The skip_indicator screen is displayed to indicate that skipping is in
  822. ## progress.
  823. ##
  824. ## https://www.renpy.org/doc/html/screen_special.html#skip-indicator
  825. screen skip_indicator():
  826. zorder 100
  827. style_prefix "skip"
  828. frame:
  829. hbox:
  830. spacing 6
  831. text _("Skipping")
  832. text "▸" at delayed_blink(0.0, 1.0) style "skip_triangle"
  833. text "▸" at delayed_blink(0.2, 1.0) style "skip_triangle"
  834. text "▸" at delayed_blink(0.4, 1.0) style "skip_triangle"
  835. ## This transform is used to blink the arrows one after another.
  836. transform delayed_blink(delay, cycle):
  837. alpha .5
  838. pause delay
  839. block:
  840. linear .2 alpha 1.0
  841. pause .2
  842. linear .2 alpha 0.5
  843. pause (cycle - .4)
  844. repeat
  845. style skip_frame is empty
  846. style skip_text is gui_text
  847. style skip_triangle is skip_text
  848. style skip_frame:
  849. ypos gui.skip_ypos
  850. background Frame("gui/skip.png", gui.skip_frame_borders, tile=gui.frame_tile)
  851. padding gui.skip_frame_borders.padding
  852. style skip_text:
  853. size gui.notify_text_size
  854. style skip_triangle:
  855. ## We have to use a font that has the BLACK RIGHT-POINTING SMALL TRIANGLE
  856. ## glyph in it.
  857. font "DejaVuSans.ttf"
  858. ## Notify screen ###############################################################
  859. ##
  860. ## The notify screen is used to show the player a message. (For example, when
  861. ## the game is quicksaved or a screenshot has been taken.)
  862. ##
  863. ## https://www.renpy.org/doc/html/screen_special.html#notify-screen
  864. screen notify(message):
  865. zorder 100
  866. style_prefix "notify"
  867. frame at notify_appear:
  868. text "[message!tq]"
  869. timer 3.25 action Hide('notify')
  870. transform notify_appear:
  871. on show:
  872. alpha 0
  873. linear .25 alpha 1.0
  874. on hide:
  875. linear .5 alpha 0.0
  876. style notify_frame is empty
  877. style notify_text is gui_text
  878. style notify_frame:
  879. ypos gui.notify_ypos
  880. background Frame("gui/notify.png", gui.notify_frame_borders, tile=gui.frame_tile)
  881. padding gui.notify_frame_borders.padding
  882. style notify_text:
  883. properties gui.text_properties("notify")
  884. ## NVL screen ##################################################################
  885. ##
  886. ## This screen is used for NVL-mode dialogue and menus.
  887. ##
  888. ## https://www.renpy.org/doc/html/screen_special.html#nvl
  889. screen nvl(dialogue, items=None):
  890. window:
  891. style "nvl_window"
  892. has vbox:
  893. spacing gui.nvl_spacing
  894. ## Displays dialogue in either a vpgrid or the vbox.
  895. if gui.nvl_height:
  896. vpgrid:
  897. cols 1
  898. yinitial 1.0
  899. use nvl_dialogue(dialogue)
  900. else:
  901. use nvl_dialogue(dialogue)
  902. ## Displays the menu, if given. The menu may be displayed incorrectly if
  903. ## config.narrator_menu is set to True, as it is above.
  904. for i in items:
  905. textbutton i.caption:
  906. action i.action
  907. style "nvl_button"
  908. add SideImage() xalign 0.0 yalign 1.0
  909. screen nvl_dialogue(dialogue):
  910. for d in dialogue:
  911. window:
  912. id d.window_id
  913. fixed:
  914. yfit gui.nvl_height is None
  915. if d.who is not None:
  916. text d.who:
  917. id d.who_id
  918. text d.what:
  919. id d.what_id
  920. ## This controls the maximum number of NVL-mode entries that can be displayed at
  921. ## once.
  922. define config.nvl_list_length = gui.nvl_list_length
  923. style nvl_window is default
  924. style nvl_entry is default
  925. style nvl_label is say_label
  926. style nvl_dialogue is say_dialogue
  927. style nvl_button is button
  928. style nvl_button_text is button_text
  929. style nvl_window:
  930. xfill True
  931. yfill True
  932. background "gui/nvl.png"
  933. padding gui.nvl_borders.padding
  934. style nvl_entry:
  935. xfill True
  936. ysize gui.nvl_height
  937. style nvl_label:
  938. xpos gui.nvl_name_xpos
  939. xanchor gui.nvl_name_xalign
  940. ypos gui.nvl_name_ypos
  941. yanchor 0.0
  942. xsize gui.nvl_name_width
  943. min_width gui.nvl_name_width
  944. text_align gui.nvl_name_xalign
  945. style nvl_dialogue:
  946. xpos gui.nvl_text_xpos
  947. xanchor gui.nvl_text_xalign
  948. ypos gui.nvl_text_ypos
  949. xsize gui.nvl_text_width
  950. min_width gui.nvl_text_width
  951. text_align gui.nvl_text_xalign
  952. layout ("subtitle" if gui.nvl_text_xalign else "tex")
  953. style nvl_thought:
  954. xpos gui.nvl_thought_xpos
  955. xanchor gui.nvl_thought_xalign
  956. ypos gui.nvl_thought_ypos
  957. xsize gui.nvl_thought_width
  958. min_width gui.nvl_thought_width
  959. text_align gui.nvl_thought_xalign
  960. layout ("subtitle" if gui.nvl_text_xalign else "tex")
  961. style nvl_button:
  962. properties gui.button_properties("nvl_button")
  963. xpos gui.nvl_button_xpos
  964. xanchor gui.nvl_button_xalign
  965. style nvl_button_text:
  966. properties gui.button_text_properties("nvl_button")
  967. ################################################################################
  968. ## Mobile Variants
  969. ################################################################################
  970. style pref_vbox:
  971. variant "medium"
  972. xsize 450
  973. ## Since a mouse may not be present, we replace the quick menu with a version
  974. ## that uses fewer and bigger buttons that are easier to touch.
  975. screen quick_menu():
  976. variant "touch"
  977. zorder 100
  978. if quick_menu:
  979. hbox:
  980. style_prefix "quick"
  981. xalign 0.5
  982. yalign 1.0
  983. textbutton _("Back") action Rollback()
  984. textbutton _("Skip") action Skip() alternate Skip(fast=True, confirm=True)
  985. textbutton _("Auto") action Preference("auto-forward", "toggle")
  986. textbutton _("Menu") action ShowMenu()
  987. style window:
  988. variant "small"
  989. background "gui/phone/textbox.png"
  990. style radio_button:
  991. variant "small"
  992. foreground "gui/phone/button/radio_[prefix_]foreground.png"
  993. style check_button:
  994. variant "small"
  995. foreground "gui/phone/button/check_[prefix_]foreground.png"
  996. style nvl_window:
  997. variant "small"
  998. background "gui/phone/nvl.png"
  999. style main_menu_frame:
  1000. variant "small"
  1001. background "gui/phone/overlay/main_menu.png"
  1002. style game_menu_outer_frame:
  1003. variant "small"
  1004. background "gui/phone/overlay/game_menu.png"
  1005. style game_menu_navigation_frame:
  1006. variant "small"
  1007. xsize 340
  1008. style game_menu_content_frame:
  1009. variant "small"
  1010. top_margin 0
  1011. style pref_vbox:
  1012. variant "small"
  1013. xsize 400
  1014. style bar:
  1015. variant "small"
  1016. ysize gui.bar_size
  1017. left_bar Frame("gui/phone/bar/left.png", gui.bar_borders, tile=gui.bar_tile)
  1018. right_bar Frame("gui/phone/bar/right.png", gui.bar_borders, tile=gui.bar_tile)
  1019. style vbar:
  1020. variant "small"
  1021. xsize gui.bar_size
  1022. top_bar Frame("gui/phone/bar/top.png", gui.vbar_borders, tile=gui.bar_tile)
  1023. bottom_bar Frame("gui/phone/bar/bottom.png", gui.vbar_borders, tile=gui.bar_tile)
  1024. style scrollbar:
  1025. variant "small"
  1026. ysize gui.scrollbar_size
  1027. base_bar Frame("gui/phone/scrollbar/horizontal_[prefix_]bar.png", gui.scrollbar_borders, tile=gui.scrollbar_tile)
  1028. thumb Frame("gui/phone/scrollbar/horizontal_[prefix_]thumb.png", gui.scrollbar_borders, tile=gui.scrollbar_tile)
  1029. style vscrollbar:
  1030. variant "small"
  1031. xsize gui.scrollbar_size
  1032. base_bar Frame("gui/phone/scrollbar/vertical_[prefix_]bar.png", gui.vscrollbar_borders, tile=gui.scrollbar_tile)
  1033. thumb Frame("gui/phone/scrollbar/vertical_[prefix_]thumb.png", gui.vscrollbar_borders, tile=gui.scrollbar_tile)
  1034. style slider:
  1035. variant "small"
  1036. ysize gui.slider_size
  1037. base_bar Frame("gui/phone/slider/horizontal_[prefix_]bar.png", gui.slider_borders, tile=gui.slider_tile)
  1038. thumb "gui/phone/slider/horizontal_[prefix_]thumb.png"
  1039. style vslider:
  1040. variant "small"
  1041. xsize gui.slider_size
  1042. base_bar Frame("gui/phone/slider/vertical_[prefix_]bar.png", gui.vslider_borders, tile=gui.slider_tile)
  1043. thumb "gui/phone/slider/vertical_[prefix_]thumb.png"
  1044. style slider_vbox:
  1045. variant "small"
  1046. xsize None
  1047. style slider_slider:
  1048. variant "small"
  1049. xsize 600