Compare commits
710 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 693cf9f8c9 | |||
| 35c2ec5a83 | |||
| 3b60efd744 | |||
| daac5d8ebf | |||
| 1fab6d8707 | |||
| aaff11668a | |||
| 536341a819 | |||
| b9c468e446 | |||
| 03edec9785 | |||
| da70a85d75 | |||
| 4ba170b8d8 | |||
| 72ae15c635 | |||
| 1179066dda | |||
| 62d0093bee | |||
| 55c0d3b4a7 | |||
| 92014eafdd | |||
| b1be4c8ed4 | |||
| 06f36dd8d1 | |||
| 3a15f5c717 | |||
| 031f3338b1 | |||
| 66125b2e10 | |||
| e6becffc4c | |||
| d281e57879 | |||
| 5196a970a0 | |||
| efcbc92e7a | |||
| 142fa33548 | |||
| 4b6e871ac6 | |||
| 1fbbad053a | |||
| 61aa933d97 | |||
| 70c3ea773e | |||
| a16de04682 | |||
| 0280a12589 | |||
| 4dc8fef9c1 | |||
| 2c02645ec7 | |||
| 40bad327fe | |||
| f5653d3c4d | |||
| 4026d7818b | |||
| a0fda2f058 | |||
| 93546e2d5c | |||
| 85a562713a | |||
| 4e9beb1a5d | |||
| 522333e0f5 | |||
| b4c4d0264c | |||
| 21c3187fa3 | |||
| b377cfcdef | |||
| 5d384e531d | |||
| 2b00c64973 | |||
| 7c777dea22 | |||
| 9d0c77917d | |||
| 6d40ced435 | |||
| 0675ee7f79 | |||
| 0aec15a848 | |||
| 2ff01a99ac | |||
| 0596ed7739 | |||
| d8beb99964 | |||
| 648dfd8d75 | |||
| 279a7a3fc8 | |||
| a62aede62f | |||
| b07bbbc1c9 | |||
| 547ce87eaa | |||
| c206456d00 | |||
| 590dd13f8f | |||
| afd0e70479 | |||
| b9166b35b3 | |||
| 333fa51862 | |||
| ec6d256707 | |||
| 86764d92a6 | |||
| cf1c9b3e5e | |||
| b15d7179b6 | |||
| 72312f1249 | |||
| 373198f628 | |||
| e96d8c774b | |||
| 8e221e183d | |||
| 2249c49303 | |||
| 388362d318 | |||
| a554ea8e8b | |||
| 090719deee | |||
| e29a162a85 | |||
| e17fa9edc2 | |||
| e57529257e | |||
| 866f9228ef | |||
| 3a38a8b89b | |||
| 0509a23881 | |||
| cbb0741ab9 | |||
| 716bb0fac1 | |||
| acb193bd7b | |||
| 0a09beb731 | |||
| 93dca3df73 | |||
| 008143a3da | |||
| 30a4db432e | |||
| 65546baf01 | |||
| 8be5069490 | |||
| 802410644b | |||
| e74b172372 | |||
| 23ac59588e | |||
| 7f6e9de5e5 | |||
| 143906ae9d | |||
| b003371456 | |||
| 1e6fa37a10 | |||
| 935786a161 | |||
| 23c4d07432 | |||
| 77107ef1eb | |||
| cac4238b12 | |||
| 8c402c2dc3 | |||
| 9bff95826a | |||
| fc0f7cecc4 | |||
| 0b5c5ce17e | |||
| 9aa61532ff | |||
| 3271557f8a | |||
| 9587342129 | |||
| 9b4821308d | |||
| 663978906a | |||
| 60f3308b8b | |||
| a305d6e725 | |||
| 1feff344b8 | |||
| 4fa4ffae54 | |||
| 4ecd72de6e | |||
| 3ec495c3fc | |||
| 5efc437384 | |||
| a777f4d3b1 | |||
| ff139808ff | |||
| 07136f9be8 | |||
| 35fc2295e9 | |||
| 2b262ccca3 | |||
| d42aab3dff | |||
| 612c347498 | |||
| 3c4540131a | |||
| 43317f6e02 | |||
| 523742d8de | |||
| 9516ee910e | |||
| 3ea31a3862 | |||
| 649411a4ef | |||
| a0e60e5453 | |||
| e3f1f40a78 | |||
| d0177f4c52 | |||
| 84a3a55a03 | |||
| 048075b47a | |||
| fab097c92a | |||
| 9d26bd8c04 | |||
| 664d243c23 | |||
| 9a0906655d | |||
| 13d60f2741 | |||
| 7d4de64d0b | |||
| 9ada2d9884 | |||
| a5f1951cfb | |||
| 98850e4c5c | |||
| 709e1f925d | |||
| b11ae331a5 | |||
| 3ba4b26b99 | |||
| b864077017 | |||
| d411dff1c0 | |||
| 7fc7453450 | |||
| 1799971885 | |||
| b999911292 | |||
| 29e0f9ad21 | |||
| d821b7eb8b | |||
| 272a214304 | |||
| 7f15b351ee | |||
| 5a6a12a14a | |||
| 01493c7063 | |||
| 244055fcb7 | |||
| 0415af5f31 | |||
| f73372c924 | |||
| 65cdc24e37 | |||
| 1b2d439651 | |||
| b383942c69 | |||
| 73bd109abb | |||
| 33ffd5dedb | |||
| 7422fe43b8 | |||
| 879c45a5b3 | |||
| db0d205374 | |||
| f20594a2b5 | |||
| ee017f4bc6 | |||
| 4d089f9a0e | |||
| e7f9c5c2ac | |||
| 2df8d38c2f | |||
| 17ac44d610 | |||
| 3c52c2ae3f | |||
| 5a5115e29f | |||
| 5c7ff1c97b | |||
| cc820a3595 | |||
| 48fff48d28 | |||
| 1684243e57 | |||
| 45e14781eb | |||
| 5ceea7b4a5 | |||
| 17e716b4c3 | |||
| adfdbf3246 | |||
| 03b757d60e | |||
| 12c6d77990 | |||
| 8a7373f412 | |||
| df28ff5bdc | |||
| 2afc2beb5d | |||
| 3896bf3aad | |||
| 744ace5ab6 | |||
| 4bf0b74b6c | |||
| 5c6e624ff7 | |||
| 6c0d5a7a10 | |||
| b34cb21f0c | |||
| b77eb7ed0b | |||
| 34193c510e | |||
| 55f1eaf5da | |||
| 9b74b5a367 | |||
| 008922edc6 | |||
| 82edca785f | |||
| b271baecd5 | |||
| 9b48cd2a35 | |||
| 183f6ace88 | |||
| b5987cd6ea | |||
| 6e153a5070 | |||
| 56e59d91dd | |||
| fd91c6811f | |||
| 9914f4e145 | |||
| 458db1095a | |||
| 93c4f964ca | |||
| 743c459789 | |||
| 4f4c424a67 | |||
| df40e340e9 | |||
| f08828f130 | |||
| d28b6ab04f | |||
| 9cf8802c28 | |||
| 5e5d8b441a | |||
| 2e7240c29d | |||
| 3aed142859 | |||
| b087b29a22 | |||
| 5687f6fbaf | |||
| 57bfebe0b1 | |||
| 9dce927cd0 | |||
| 3c1df298c7 | |||
| 68d11f0a7b | |||
| e55bc7be71 | |||
| 031f82cf63 | |||
| 99aa549b6b | |||
| 7f1ec73a34 | |||
| ef81a0bddc | |||
| 86d90aa924 | |||
| 704440287d | |||
| ae09666322 | |||
| 3facb92ca5 | |||
| b2dd429f84 | |||
| 3d5058ee90 | |||
| 44ed2c1f91 | |||
| ffd5971ea6 | |||
| eda2d64dfe | |||
| 4ebc96723b | |||
| 2ce8ba3406 | |||
| 96fc7b5aba | |||
| 08a37b90a4 | |||
| 1d4ff67612 | |||
| 23dd507913 | |||
| e6e3d3e546 | |||
| 62273459d8 | |||
| d5f6741bd9 | |||
| 634cc46258 | |||
| 7f2e09af55 | |||
| 47b2ca163a | |||
| adb4b3eb5c | |||
| 6fddc3449e | |||
| ae897681cc | |||
| 1bb7c0cd36 | |||
| e42d877d11 | |||
| 7b0e376f4d | |||
| e405d91cdf | |||
| 2f0b429e76 | |||
| 7480d416bd | |||
| 052ed133ba | |||
| b5bc5f6b10 | |||
| 9c5b4484e6 | |||
| fb729c4737 | |||
| 3c82bee409 | |||
| 957eec0bdf | |||
| 72ce387755 | |||
| 9e7ab9b6f8 | |||
| c0181755c5 | |||
| 4faef86e87 | |||
| f65d84e09f | |||
| e24e54c56d | |||
| e2ed4afb71 | |||
| 4872c10e9b | |||
| e070c4430c | |||
| 8f6a9eaeb6 | |||
| c7d2e71726 | |||
| 8af19f82a3 | |||
| 89feaa0e0a | |||
| 8a82882378 | |||
| aaeb862ef1 | |||
| 66f256f55c | |||
| 0274db18fe | |||
| 460cdf5db8 | |||
| dbf5087ccf | |||
| 17b027d88a | |||
| d0282c4d5a | |||
| 4051d4e299 | |||
| 23bf80608e | |||
| 33fe3a1003 | |||
| f7cc77a28c | |||
| 13aadab31f | |||
| 115849f760 | |||
| f4a973582e | |||
| 138afbd3c3 | |||
| 4b87b8ec9c | |||
| caab16c759 | |||
| 000558e5dd | |||
| e7ce0841c5 | |||
| 0e4632cc25 | |||
| 520add49f4 | |||
| a9802ea04c | |||
| 1cbfcce551 | |||
| bb94aa0ac9 | |||
| 2132a3d6ea | |||
| 239de0df80 | |||
| 9e9799f1d1 | |||
| baa6f88291 | |||
| 02cdfefd27 | |||
| d46a1a01f4 | |||
| f04fdf39ee | |||
| f9d1011e17 | |||
| 32294e2f22 | |||
| c536eeddd5 | |||
| 5d139d5f7d | |||
| 7163f1e889 | |||
| d12d9579d2 | |||
| 7db3c21013 | |||
| 80cffcf388 | |||
| fd6bd9c9a6 | |||
| 81024ef270 | |||
| 0048dc5483 | |||
| 14c85742cb | |||
| b069b168aa | |||
| 962805f1f8 | |||
| 6f5e094691 | |||
| 6f73c95e75 | |||
| 1c410ff232 | |||
| 939152830f | |||
| 9316f1507e | |||
| 316ff71542 | |||
| 2b782faab6 | |||
| 901d0e609e | |||
| 4eda972567 | |||
| b93006a810 | |||
| f51d46eb4d | |||
| 611ad5e7bc | |||
| 008add67e5 | |||
| 57524bd1b6 | |||
| 6959786848 | |||
| ec29567b77 | |||
| 13739dce3b | |||
| 74f5810334 | |||
| 6f0a83c348 | |||
| 121586c8e2 | |||
| 718d5c2375 | |||
| 8bc8a47be7 | |||
| e6a9cdc4b1 | |||
| 8e4fae7d73 | |||
| 7ac8192492 | |||
| 9fd63e0e8f | |||
| 2cf47dfb6e | |||
| e35e3a7743 | |||
| 8d94763fca | |||
| 5c371723ce | |||
| 69666d9cd8 | |||
| 6cda72b9a6 | |||
| f2fe68a5a6 | |||
| 11652eaf33 | |||
| 3160502be4 | |||
| f1bebbe89b | |||
| 55f258474c | |||
| 7ff0f7e390 | |||
| 979230078f | |||
| 944777cdf4 | |||
| d5560db0ce | |||
| 07aeb76971 | |||
| 9b36f7da03 | |||
| 9e2b936e9f | |||
| 7a2ebea2dd | |||
| 6ed860e314 | |||
| 0977253227 | |||
| c8ea5ef55c | |||
| a138844faf | |||
| 23b520c773 | |||
| 937c2b167a | |||
| 4e78cee1d8 | |||
| 8aca0c9d4f | |||
| 839e7e2569 | |||
| 0c57985968 | |||
| 8313ab8ad6 | |||
| 4fb0edcbfe | |||
| 09f5d23aa5 | |||
| 26dc030a4d | |||
| ef10644285 | |||
| affeece1f3 | |||
| caa1b6c261 | |||
| 46b2934867 | |||
| 448ca5f0a8 | |||
| 9fc21619ad | |||
| e08b6e4a16 | |||
| 1252d7af95 | |||
| 1b731fe48d | |||
| 99b252fb53 | |||
| 5049dd2ea0 | |||
| c8daf0df77 | |||
| 97673f7f48 | |||
| 3efb0d562e | |||
| 0d341dfe62 | |||
| 69d7576d28 | |||
| 2e37647bd4 | |||
| 37bbe802ea | |||
| 5c7d844c6c | |||
| 1211d223b2 | |||
| 46ed470dba | |||
| a50b8c81f8 | |||
| 9400f65550 | |||
| 8f76c07757 | |||
| 8ab6342a3b | |||
| f6b3a1e72b | |||
| 22897cad88 | |||
| ad38cd75d7 | |||
| afe820df47 | |||
| c300147785 | |||
| 4dc589e254 | |||
| afc351550b | |||
| fd41cfd159 | |||
| 43f767f311 | |||
| 781b779fb1 | |||
| 9a6f2234de | |||
| e646aaefa7 | |||
| a4d1a60f22 | |||
| 905146012f | |||
| 8e96e83e8e | |||
| 5f8b866592 | |||
| 367ae0b7b0 | |||
| 04ba009ff0 | |||
| 4b82958e7b | |||
| 2cfde4ba75 | |||
| 50cea93c5c | |||
| 72dcb7304d | |||
| 44296c7a4d | |||
| 10d7a57a6a | |||
| c82821fdd6 | |||
| 1914df46b4 | |||
| 3e2ca9e289 | |||
| fb4bd94074 | |||
| d0ea38c849 | |||
| 579cce34ab | |||
| 5c814cc5e1 | |||
| 2669834fea | |||
| c7713a655b | |||
| aeb3e804dd | |||
| db3bc691aa | |||
| 3c7253ca33 | |||
| 65e855cbe4 | |||
| b3ecf203f0 | |||
| 7e83dc7489 | |||
| 5a97d433a7 | |||
| 8cd8e3e44d | |||
| 131e28b852 | |||
| 166d29b7e1 | |||
| 1096fabb32 | |||
| 4057ef583a | |||
| 6ddd7aa60f | |||
| f3faf25c68 | |||
| 7c1ed208ad | |||
| d6322ba74d | |||
| 8de38e73c7 | |||
| b925f24003 | |||
| c438d17a3d | |||
| 3b18d46a8b | |||
| 3e25a4b8b8 | |||
| eb5aaa46ae | |||
| ddd84b207e | |||
| 4e61ebeaf7 | |||
| 91b1556b8a | |||
| 7e0257e167 | |||
| f21d70e9fa | |||
| ea41bb9cd0 | |||
| 14c28b927a | |||
| 5b9b176f66 | |||
| 0348445dec | |||
| c41fc41e90 | |||
| fa37e2e556 | |||
| 5bcee73df4 | |||
| ddfd44915f | |||
| 9b03c8e8c2 | |||
| c0badd8de8 | |||
| 4d5c2713c2 | |||
| d3a8d0e2d6 | |||
| 1da77b7856 | |||
| d2bc6ca31f | |||
| 8fd9fe41f8 | |||
| 032c9a1b10 | |||
| 91ba41bc88 | |||
| 931e6df719 | |||
| e2814a71cd | |||
| 6f10cbac14 | |||
| c0d923b928 | |||
| fed151ff01 | |||
| b6fde297fa | |||
| 075ae8d282 | |||
| affb926ff3 | |||
| 3c7e27c9cf | |||
| bb18aed24c | |||
| ed3c0d3f0d | |||
| 6727ee4511 | |||
| afbd8af715 | |||
| 672b12a2cd | |||
| 306f591e4b | |||
| 9a9d8db41d | |||
| bdaf3c0ed4 | |||
| bcaf88f8a3 | |||
| 0be97c3f2c | |||
| db0576a125 | |||
| f9e36e8854 | |||
| 79f669d409 | |||
| bbbb05868e | |||
| b9ebbd8014 | |||
| 0db2e1c9a2 | |||
| 29254c2f93 | |||
| 113c335adb | |||
| 2647c57cd7 | |||
| 4dc6d3b3f8 | |||
| 87111417a8 | |||
| 2fdf4264b2 | |||
| 55763227a8 | |||
| 262ef1045b | |||
| f44de50bf6 | |||
| af57916916 | |||
| 5e5aa4c96a | |||
| d2400eda05 | |||
| 67fc45b0e0 | |||
| 8e058e9ffb | |||
| c01294b5a1 | |||
| 79eea14456 | |||
| 061a12c273 | |||
| 5a628e16fd | |||
| fd1bc58f3e | |||
| 4e60aa72d1 | |||
| 41d0b7ca95 | |||
| 57347e7032 | |||
| 483f05edba | |||
| d1e1b65647 | |||
| e99267fdca | |||
| 63179fc49a | |||
| cf9376d453 | |||
| 02ae2fcaaf | |||
| 2fdf3b2565 | |||
| badf120507 | |||
| ac6351b801 | |||
| 16115db8fe | |||
| 16c7ccfe26 | |||
| 9a68d0501f | |||
| 8c4741f91c | |||
| f9778ca346 | |||
| 5513c10593 | |||
| d21d756764 | |||
| 985e66eedc | |||
| a28b88067f | |||
| 6f0e0b4982 | |||
| e13cf875bb | |||
| 18b4acd852 | |||
| bfd380f028 | |||
| 7b7a93954d | |||
| 23412f847a | |||
| e06d275fb0 | |||
| cb046b7387 | |||
| 46e0c3bd7a | |||
| 4958185439 | |||
| 6a33d26c41 | |||
| ea48335834 | |||
| c18a2e2689 | |||
| e29003763b | |||
| cb62a2b962 | |||
| 29ec48d023 | |||
| 6b77899000 | |||
| 3da2ff55a6 | |||
| af5ea04ec5 | |||
| 11ac2a5a8d | |||
| ed1a8cbabc | |||
| c61f0ff965 | |||
| b21a6449d0 | |||
| 793fd1238a | |||
| ff653f0fd9 | |||
| 4d47ba7a42 | |||
| 6406307317 | |||
| cc8cdf059f | |||
| d6d64bd115 | |||
| 6081783a9d | |||
| 5080052728 | |||
| 90da02fa68 | |||
| dd67724968 | |||
| a163c4fc00 | |||
| 8504a7b80c | |||
| a1472a9dcc | |||
| 2c08690d59 | |||
| b041d707fb | |||
| 760b1ae30c | |||
| ce7bd1f915 | |||
| 19e5260a89 | |||
| 5846f6ba4c | |||
| 54662088de | |||
| 30f05caf42 | |||
| 0657723374 | |||
| 55edf3e373 | |||
| c36fadbbe2 | |||
| 6882c6a74e | |||
| 25f29aacf6 | |||
| 735332ef86 | |||
| 75ba12c5aa | |||
| 5fd4ed6238 | |||
| c9bc47c35e | |||
| 6ad478f61b | |||
| 520129321d | |||
| ba032fe806 | |||
| 5423af98d5 | |||
| 65030ada99 | |||
| 875d7b4410 | |||
| ba58ec003a | |||
| fd28ad3600 | |||
| 9a07dce963 | |||
| 83f3f04c4d | |||
| 73e0cbea16 | |||
| 1b13951ee0 | |||
| f6659b3873 | |||
| 6a0748e3bf | |||
| f66e2a0649 | |||
| 4564820e3c | |||
| 06e4e8c21c | |||
| 6ebfce1b1a | |||
| f67a398eda | |||
| 7f3251d15a | |||
| bfbc271801 | |||
| ee629cb316 | |||
| 5cfdb1d6a6 | |||
| d5396466d8 | |||
| 8a591c38df | |||
| db4fcb1397 | |||
| b2ca030729 | |||
| 38f4ad4168 | |||
| b33308d3a1 | |||
| 314311c7e8 | |||
| b2d3107035 | |||
| fe7ecc8221 | |||
| d265c93bcc | |||
| e6ea26ad93 | |||
| ba61ef1f1f | |||
| 69f51ed383 | |||
| d242595213 | |||
| 678581f165 | |||
| 3db637bbcf | |||
| e328ca32d9 | |||
| 4533f541c4 | |||
| a23bbff40d | |||
| e96f87763a | |||
| 27725bd81e | |||
| 3f8560ed0e | |||
| 89ea7c7f9b | |||
| 5f02f63aa6 | |||
| 05d696ef45 | |||
| 7e3d7ac0e1 | |||
| 52925ba42f | |||
| e0da35a499 | |||
| 9f965f3e32 | |||
| df1db159ae | |||
| fa46038dcc | |||
| 38150544c0 | |||
| e097848384 | |||
| eb35a4c75f | |||
| b3c0fd0f4f | |||
| 509313f7a0 | |||
| eaebc28c62 | |||
| 866924087e | |||
| 059b7287a1 | |||
| 32e9a2cd1d | |||
| 59b90471a0 | |||
| 097ab320ca | |||
| e170e453d2 | |||
| 11ee50cd3a | |||
| 163f12a7e2 | |||
| c546662c2a | |||
| be213d0ed0 | |||
| 301203cd88 | |||
| 44067c771a | |||
| fc805a2231 | |||
| fb7bb99486 | |||
| 732311fccc | |||
| 21ab52c33b | |||
| d513eca182 | |||
| c0773533e3 | |||
| bd1ef6d3e3 | |||
| 7805095b96 | |||
| 8cf2533d51 | |||
| 8d72e223b7 | |||
| 63bdd908bd | |||
| c2e4e655c6 | |||
| 5a0fcb1c1a | |||
| 07a032fa7c | |||
| 61b21817a8 | |||
| eba101519f | |||
| f38aeb3872 | |||
| c2ac268e7d | |||
| ca3c6f8bc1 | |||
| 6989233cbc | |||
| 056bed0fc2 | |||
| 7b946a2369 | |||
| f41aec238e | |||
| 77423980a2 | |||
| 47606637de | |||
| 3eacc751ce | |||
| 4fdae44700 | |||
| 06119fbcd2 | |||
| 282bdb5164 | |||
| 64d7e55027 |
@@ -0,0 +1,56 @@
|
||||
build
|
||||
dist
|
||||
dists
|
||||
renpy.app
|
||||
**/*.rpyc
|
||||
**/*.rpyb
|
||||
**/*.rpymc
|
||||
_renpy.c
|
||||
nativemidi.c
|
||||
sound.c
|
||||
winmixer.c
|
||||
jedit
|
||||
lint.txt
|
||||
renpy.code
|
||||
traceback.txt
|
||||
doc/common.css
|
||||
doc/images
|
||||
doc/index.html
|
||||
doc/monobook.css
|
||||
doc/monobook2.css
|
||||
doc/reference
|
||||
doc/shared.css
|
||||
doc/tutorials
|
||||
doc/www.renpy.org
|
||||
testing
|
||||
translations.rpy
|
||||
launchertrans.rpy
|
||||
jcc
|
||||
scite/scite.zip
|
||||
screenshot*
|
||||
.ropeproject
|
||||
release_cardgame.sh
|
||||
cardgame
|
||||
dse.split
|
||||
empty
|
||||
empty-linux-x86.tar.bz2
|
||||
empty-mac.zip
|
||||
empty.zip
|
||||
errors.txt
|
||||
icons
|
||||
iliad-icon.png
|
||||
iliad-work
|
||||
kuroi
|
||||
lsprofcalltree.py
|
||||
manifest.xml
|
||||
mediatest
|
||||
musicroom
|
||||
nobmtest
|
||||
renpy-iliad.sh
|
||||
renpy.kcg
|
||||
renpy.stats
|
||||
renpygame-1.2.zip
|
||||
speedtest
|
||||
styles.txt
|
||||
renpygame-demo/game/saves
|
||||
./lib
|
||||
@@ -1,4 +1,5 @@
|
||||
Copyright 2004-2005 PyTom <pytom@bishoujo.us>
|
||||
Ren'Py itself is covered by the terms of the following (MIT) license:
|
||||
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
@@ -20,33 +21,739 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
Please see each individual source file for a list of copyright
|
||||
holders. The pictures of Eileen in the demo are Copyright 2006
|
||||
Piroshki, under the same terms.
|
||||
|
||||
Please note that the above license only applies to Ren'Py
|
||||
proper. A binary distribution of Ren'Py contains a number of other
|
||||
packages, each with their own licenses, which you may be bound to
|
||||
comply with when distributing a Ren'Py game.
|
||||
The Ren'Py module, the Ren'Py windows binaries, and the various Ren'Py
|
||||
launchers may contain code taken from the following projects:
|
||||
|
||||
These packages may include:
|
||||
* Python (Python License)
|
||||
* Pygame (LGPL)
|
||||
* SDL (LGPL)
|
||||
* SDL_image (LGPL)
|
||||
* SDL_ttf (LGPL)
|
||||
* SDL_mixer (LGPL)
|
||||
* Freetype (LGPL)
|
||||
* FFmpeg (LGPL)
|
||||
* jpeg (JPEG License)
|
||||
* libpng (PNG license)
|
||||
* zlib (Zlib License)
|
||||
* bzip2 (Bzip2 License)
|
||||
* pyobjc (MIT License)
|
||||
|
||||
Python (Python License)
|
||||
http://www.python.org
|
||||
The Linux build may also include code from:
|
||||
|
||||
Pygame (GNU LGPL)
|
||||
http://www.pygame.org
|
||||
* directfb (LGPL)
|
||||
* svgalib (LGPL)
|
||||
|
||||
SDL (GNU LGPL)
|
||||
http://www.libsdl.org
|
||||
For the purpose of LGPL compliance, the source code to all LGPL
|
||||
software we depend on is either in the Ren'Py package (available from
|
||||
http://www.renpy.org/), or in the renpy-deps package
|
||||
(http://www.renpy.org/dl/lgpl/). We believe compliance can be achieved
|
||||
by including a copy of this license with every copy of Ren'Py you
|
||||
distribute, and referring to it in your project's README file.
|
||||
|
||||
SDL_mixer (GNU LGPL)
|
||||
http://www.libsdl.org/projects/SDL_mixer
|
||||
|
||||
SDL_ttf (GNU LGPL)
|
||||
http://www.libsdl.org/projects/SDL_ttf
|
||||
|
||||
ctypes (MIT)
|
||||
http://starship.python.net/crew/theller/ctypes/
|
||||
The default Ren'Py build distributes Ren'Py alongside jEdit, which is
|
||||
licensed under the GNU GPL. The source code to jEdit is distributed as
|
||||
part of the renpy-deps package (http://www.renpy.org/dl/lgpl/).
|
||||
|
||||
|
||||
The character images in the demo game (game/9a_*.png) are under their
|
||||
own copyright. I allow them to be used as part of the demo game, but
|
||||
not as part of other games.
|
||||
GNU Lesser General Public License
|
||||
=================================
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations
|
||||
below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it
|
||||
becomes a de-facto standard. To achieve this, non-free programs must
|
||||
be allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control
|
||||
compilation and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at least
|
||||
three years, to give the same user the materials specified in
|
||||
Subsection 6a, above, for a charge no more than the cost of
|
||||
performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply, and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License
|
||||
may add an explicit geographical distribution limitation excluding those
|
||||
countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms
|
||||
of the ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library.
|
||||
It is safest to attach them to the start of each source file to most
|
||||
effectively convey the exclusion of warranty; and each file should
|
||||
have at least the "copyright" line and a pointer to where the full
|
||||
notice is found.
|
||||
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or
|
||||
your school, if any, to sign a "copyright disclaimer" for the library,
|
||||
if necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James
|
||||
Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
Python License
|
||||
==============
|
||||
|
||||
1. This LICENSE AGREEMENT is between the Python Software Foundation
|
||||
("PSF"), and the Individual or Organization ("Licensee") accessing and
|
||||
otherwise using Python 2.3 software in source or binary form and its
|
||||
associated documentation.
|
||||
|
||||
2. Subject to the terms and conditions of this License Agreement, PSF
|
||||
hereby grants Licensee a nonexclusive, royalty-free, world-wide
|
||||
license to reproduce, analyze, test, perform and/or display publicly,
|
||||
prepare derivative works, distribute, and otherwise use Python 2.3
|
||||
alone or in any derivative version, provided, however, that PSF's
|
||||
License Agreement and PSF's notice of copyright, i.e., "Copyright (c)
|
||||
2001, 2002 Python Software Foundation; All Rights Reserved" are
|
||||
retained in Python 2.3 alone or in any derivative version prepared by
|
||||
Licensee.
|
||||
|
||||
3. In the event Licensee prepares a derivative work that is based on
|
||||
or incorporates Python 2.3 or any part thereof, and wants to make
|
||||
the derivative work available to others as provided herein, then
|
||||
Licensee hereby agrees to include in any such work a brief summary of
|
||||
the changes made to Python 2.3.
|
||||
|
||||
4. PSF is making Python 2.3 available to Licensee on an "AS IS"
|
||||
basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
||||
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
|
||||
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
||||
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 2.3 WILL NOT
|
||||
INFRINGE ANY THIRD PARTY RIGHTS.
|
||||
|
||||
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
|
||||
2.3 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
|
||||
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 2.3,
|
||||
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
||||
|
||||
6. This License Agreement will automatically terminate upon a material
|
||||
breach of its terms and conditions.
|
||||
|
||||
7. Nothing in this License Agreement shall be deemed to create any
|
||||
relationship of agency, partnership, or joint venture between PSF and
|
||||
Licensee. This License Agreement does not grant permission to use PSF
|
||||
trademarks or trade name in a trademark sense to endorse or promote
|
||||
products or services of Licensee, or any third party.
|
||||
|
||||
8. By copying, installing or otherwise using Python 2.3, Licensee
|
||||
agrees to be bound by the terms and conditions of this License
|
||||
Agreement.
|
||||
|
||||
|
||||
Jpeg License
|
||||
============
|
||||
|
||||
In plain English:
|
||||
|
||||
1. We don't promise that this software works. (But if you find any bugs,
|
||||
please let us know!)
|
||||
2. You can use this software for whatever you want. You don't have to pay us.
|
||||
3. You may not pretend that you wrote this software. If you use it in a
|
||||
program, you must acknowledge somewhere in your documentation that
|
||||
you've used the IJG code.
|
||||
|
||||
In legalese:
|
||||
|
||||
The authors make NO WARRANTY or representation, either express or implied,
|
||||
with respect to this software, its quality, accuracy, merchantability, or
|
||||
fitness for a particular purpose. This software is provided "AS IS", and you,
|
||||
its user, assume the entire risk as to its quality and accuracy.
|
||||
|
||||
This software is copyright (C) 1991-1998, Thomas G. Lane.
|
||||
All Rights Reserved except as specified below.
|
||||
|
||||
Permission is hereby granted to use, copy, modify, and distribute this
|
||||
software (or portions thereof) for any purpose, without fee, subject to these
|
||||
conditions:
|
||||
(1) If any part of the source code for this software is distributed, then this
|
||||
README file must be included, with this copyright and no-warranty notice
|
||||
unaltered; and any additions, deletions, or changes to the original files
|
||||
must be clearly indicated in accompanying documentation.
|
||||
(2) If only executable code is distributed, then the accompanying
|
||||
documentation must state that "this software is based in part on the work of
|
||||
the Independent JPEG Group".
|
||||
(3) Permission for use of this software is granted only if the user accepts
|
||||
full responsibility for any undesirable consequences; the authors accept
|
||||
NO LIABILITY for damages of any kind.
|
||||
|
||||
These conditions apply to any software derived from or based on the IJG code,
|
||||
not just to the unmodified library. If you use our work, you ought to
|
||||
acknowledge us.
|
||||
|
||||
Permission is NOT granted for the use of any IJG author's name or company name
|
||||
in advertising or publicity relating to this software or products derived from
|
||||
it. This software may be referred to only as "the Independent JPEG Group's
|
||||
software".
|
||||
|
||||
We specifically permit and encourage the use of this software as the basis of
|
||||
commercial products, provided that all warranty or liability claims are
|
||||
assumed by the product vendor.
|
||||
|
||||
|
||||
PNG License
|
||||
===========
|
||||
|
||||
The PNG Reference Library is supplied "AS IS". The Contributing Authors
|
||||
and Group 42, Inc. disclaim all warranties, expressed or implied,
|
||||
including, without limitation, the warranties of merchantability and of
|
||||
fitness for any purpose. The Contributing Authors and Group 42, Inc.
|
||||
assume no liability for direct, indirect, incidental, special, exemplary,
|
||||
or consequential damages, which may result from the use of the PNG
|
||||
Reference Library, even if advised of the possibility of such damage.
|
||||
|
||||
Permission is hereby granted to use, copy, modify, and distribute this
|
||||
source code, or portions hereof, for any purpose, without fee, subject
|
||||
to the following restrictions:
|
||||
|
||||
1. The origin of this source code must not be misrepresented.
|
||||
|
||||
2. Altered versions must be plainly marked as such and must not
|
||||
be misrepresented as being the original source.
|
||||
|
||||
3. This Copyright notice may not be removed or altered from any
|
||||
source or altered source distribution.
|
||||
|
||||
The Contributing Authors and Group 42, Inc. specifically permit, without
|
||||
fee, and encourage the use of this source code as a component to
|
||||
supporting the PNG file format in commercial products. If you use this
|
||||
source code in a product, acknowledgment is not required but would be
|
||||
appreciated.
|
||||
|
||||
Zlib License
|
||||
============
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
|
||||
Bzip2 License
|
||||
=============
|
||||
|
||||
This program, "bzip2", the associated library "libbzip2", and all
|
||||
documentation, are copyright (C) 1996-2005 Julian R Seward. All
|
||||
rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
3. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
|
||||
4. The name of the author may not be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
This file contains boilerplate information about running Ren'Py that
|
||||
can be included into the README for your game. It may be necessary to
|
||||
change some of the filenames in this document, to make it specific to
|
||||
your game.
|
||||
|
||||
Feel free to use this in your projects.
|
||||
|
||||
|
||||
|
||||
Running the Game
|
||||
================
|
||||
|
||||
(Windows)
|
||||
|
||||
If this game was installed on Windows using an installer, then you can
|
||||
run it by choosing the shortcut left by the installer. If this game
|
||||
was installed on Windows using the cross-platform zip file, then it
|
||||
can be run by executing the run_game.exe file.
|
||||
|
||||
(Macintosh)
|
||||
|
||||
For information about running Ren'Py games on Mac OS 10.3 or higher,
|
||||
please go to http://www.bishoujo.us/renpy/mac.html .
|
||||
|
||||
(Linux/Unix)
|
||||
|
||||
For information about running Ren'Py games under Linux and Unix,
|
||||
please go to http://www.bishoujo.us/renpy/linux.html . At the very
|
||||
least, you will need to compile the _renpy module. Read
|
||||
module/README.txt for details.
|
||||
|
||||
|
||||
Playing the Game
|
||||
================
|
||||
|
||||
By default, the game starts running in full screen mode. On some
|
||||
computers, especially some virtual machines, this can lead to mouse
|
||||
problems. To fix this, press 'f'.
|
||||
|
||||
Some of the more interesting game actions can be performed as follows:
|
||||
|
||||
- The left mouse button is used to advance to the next line of
|
||||
dialogue, or to pick menu options.
|
||||
|
||||
- The right mouse button brings you into a menu screen where you can
|
||||
save the game, load the game, change preferences, return to the main
|
||||
menu, or quit entirely.
|
||||
|
||||
- Scrolling the mouse wheel up or pushing page up returns you to the
|
||||
previous screen.
|
||||
|
||||
- Holding down the CTRL key skips dialogue. By default, it only
|
||||
skips read dialogue, but this can be changed by a preference. Tab
|
||||
toggles skip mode.
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
Have a new form of imagemap that uses a color image to distinguish
|
||||
hotspots.
|
||||
|
||||
Keyd compiles.
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "x$1" = "x" ]; then
|
||||
echo need version
|
||||
exit
|
||||
fi
|
||||
|
||||
mkdir ~/ab/website/renpy/dl/$1
|
||||
cp dists/renpy-$1-* ~/ab/website/renpy/dl/$1
|
||||
cp CHANGELOG.txt ~/ab/website/renpy/dl/$1
|
||||
|
||||
cd ~/ab/website
|
||||
./upload.sh
|
||||
@@ -1,3 +0,0 @@
|
||||
cd game
|
||||
..\archiver.exe images *.png *.jpg
|
||||
pause
|
||||
@@ -1,96 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# The Ren'Py archiver. This builds a Ren'Py archive file, and the
|
||||
# associated index file. These files are really easy to reverse-engineer,
|
||||
# but are probably better than nothing.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import encodings.zlib_codec
|
||||
import random
|
||||
import glob
|
||||
|
||||
from cPickle import loads, dumps, HIGHEST_PROTOCOL
|
||||
|
||||
# The most we will go without inserting some padding. 10k.
|
||||
padding_every = 10240
|
||||
|
||||
# The amount of padding we will add.
|
||||
padding_max = 32
|
||||
|
||||
def randpadding():
|
||||
|
||||
plen = random.randint(1, padding_max)
|
||||
|
||||
rv = ""
|
||||
|
||||
for i in range(0, plen):
|
||||
rv += chr(random.randint(1, 255))
|
||||
|
||||
return rv
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 3:
|
||||
print "Usage: %s <file-prefix> <files ...>" % sys.argv[0]
|
||||
return
|
||||
|
||||
prefix = sys.argv[1]
|
||||
|
||||
# Archive file.
|
||||
archivef = file(prefix + ".rpa", "wb")
|
||||
|
||||
# Index file.
|
||||
indexf = file(prefix + ".rpi", "wb")
|
||||
|
||||
index = { }
|
||||
|
||||
random.seed()
|
||||
|
||||
offset = 0
|
||||
|
||||
# Needed because windows sucks. It doesn't do globbing on the
|
||||
# command line.
|
||||
files = [ ]
|
||||
for i in sys.argv[2:]:
|
||||
files.extend(glob.glob(i))
|
||||
|
||||
for fn in files:
|
||||
index[fn] = [ ]
|
||||
|
||||
print "Adding %s..." % fn
|
||||
|
||||
datafile = file(fn, "rb")
|
||||
|
||||
while True:
|
||||
|
||||
# Pad with junk.
|
||||
padding = randpadding()
|
||||
archivef.write(padding)
|
||||
offset += len(padding)
|
||||
|
||||
# Pick a random block size.
|
||||
block = random.randint(1, padding_every)
|
||||
|
||||
data = datafile.read(block)
|
||||
|
||||
if not data:
|
||||
break
|
||||
|
||||
dlen = len(data)
|
||||
|
||||
archivef.write(data)
|
||||
|
||||
index[fn].append((offset, dlen))
|
||||
offset += dlen
|
||||
|
||||
datafile.close()
|
||||
|
||||
archivef.close()
|
||||
|
||||
indexf.write(dumps(index, HIGHEST_PROTOCOL).encode("zlib"))
|
||||
indexf.close()
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1 +0,0 @@
|
||||
build_exe.py run_game
|
||||
@@ -3,29 +3,78 @@
|
||||
from distutils.core import setup
|
||||
import py2exe
|
||||
import sys
|
||||
import zipfile
|
||||
import traceback
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print "Usage: build_exe.py <prefix>"
|
||||
print ""
|
||||
print "Builds <prefix>.exe."
|
||||
print "Expects icons in <prefix>.ico."
|
||||
# The pythonpath on my system.
|
||||
sys.path.insert(0, 'c:\\msys\\1.0\\newbuild25\\install\\bin')
|
||||
sys.path.insert(0, 'c:\\msys\\1.0\\newbuild25\\install\\python')
|
||||
|
||||
sys.exit(-1)
|
||||
def main():
|
||||
|
||||
def program(name):
|
||||
return dict(script="run_game.py",
|
||||
icon_resources=[ (0, name + ".ico"),
|
||||
],
|
||||
dest_base=name)
|
||||
sys.argv[1:] = [ 'py2exe', '--bundle', '2', '-a', '--dll-excludes', 'w9xpopen.exe', ]
|
||||
# sys.argv[1:] = [ 'py2exe', '-a', '--dll-excludes', 'w9xpopen.exe', ]
|
||||
|
||||
programs = [
|
||||
program(sys.argv[1]),
|
||||
]
|
||||
setup(name="RenPy",
|
||||
windows=[ dict(script="renpy.py",
|
||||
dest_base="renpy",
|
||||
icon_resources=[ (1, "newicon.ico") ],
|
||||
),
|
||||
],
|
||||
|
||||
sys.argv[1:] = [ 'py2exe' ]
|
||||
console=[ dict(script="renpy.py", dest_base="console") ],
|
||||
|
||||
setup(name="RenPy",
|
||||
windows=programs,
|
||||
console=[ "archiver.py", "add_from.py", "console.py", "dump_text.py", "run_dse.py" ],
|
||||
zipfile='lib/renpy.zip',
|
||||
)
|
||||
zipfile='renpy.code',
|
||||
|
||||
options={ 'py2exe' : { 'excludes' : [ 'doctest',
|
||||
'pygame.macosx',
|
||||
'pygame.surfarray',
|
||||
'pygame.mixer',
|
||||
'pygame.mixer_music',
|
||||
'pygame.font',
|
||||
'_ssl',
|
||||
'_hashlib',
|
||||
'win32con',
|
||||
'win32api',
|
||||
'Numeric',
|
||||
'locale',
|
||||
'gettext',
|
||||
'os2emxpath',
|
||||
'macpath',
|
||||
'posixpath',
|
||||
],
|
||||
'optimize' : 2,
|
||||
} },
|
||||
)
|
||||
|
||||
|
||||
zfold = zipfile.ZipFile("dist/renpy.code")
|
||||
zfnew = zipfile.ZipFile("renpy.code", "w", zipfile.ZIP_STORED)
|
||||
|
||||
seen = { }
|
||||
|
||||
for fn in zfold.namelist():
|
||||
if fn.startswith("renpy/"):
|
||||
continue
|
||||
|
||||
if fn in seen:
|
||||
continue
|
||||
|
||||
if fn == "SDL_mixer.dll":
|
||||
continue
|
||||
|
||||
seen[fn] = True
|
||||
|
||||
zfnew.writestr(fn, zfold.read(fn))
|
||||
|
||||
zfold.close()
|
||||
zfnew.close()
|
||||
|
||||
try:
|
||||
main()
|
||||
except:
|
||||
traceback.print_exc()
|
||||
|
||||
print
|
||||
print "Press return to quit."
|
||||
raw_input()
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
1#!/usr/bin/env python
|
||||
|
||||
import glob
|
||||
import re
|
||||
from sets import Set as set
|
||||
import sys
|
||||
|
||||
seen_files = set()
|
||||
seen_strings = set()
|
||||
|
||||
def tl(fn, s):
|
||||
|
||||
s = eval(s)
|
||||
|
||||
if len(s) < 3:
|
||||
return
|
||||
|
||||
if s in seen_strings:
|
||||
return
|
||||
|
||||
if fn not in seen_files:
|
||||
print >>out
|
||||
print >>out, " # Translatable strings found in", fn
|
||||
print >>out
|
||||
seen_files.add(fn)
|
||||
|
||||
print >>out, " config.translations[%r] = %r" % (s, s)
|
||||
seen_strings.add(s)
|
||||
|
||||
def process(fn):
|
||||
|
||||
data = file(fn).read()
|
||||
|
||||
for m in re.finditer(r'\bu\"(\\"|[^"])+\"', data):
|
||||
tl(fn, m.group(0))
|
||||
|
||||
for m in re.finditer(r"\bu\'(\\'|[^'])+\'", data):
|
||||
tl(fn, m.group(0))
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# out = file("extras/translations.rpy", "w")
|
||||
out = sys.stdout
|
||||
|
||||
print >>out, "# This file contains a list of all of the phrases you can translate"
|
||||
print >>out, "# from the Ren'Py launcher."
|
||||
print >>out, ""
|
||||
print >>out, "init python:"
|
||||
|
||||
for fn in glob.glob("launcher/*.rpy"):
|
||||
process(fn)
|
||||
@@ -0,0 +1,48 @@
|
||||
1#!/usr/bin/env python
|
||||
|
||||
import glob
|
||||
import re
|
||||
from sets import Set as set
|
||||
import sys
|
||||
|
||||
seen_files = set()
|
||||
seen_strings = set()
|
||||
|
||||
def tl(fn, s):
|
||||
|
||||
s = eval(s)
|
||||
|
||||
if s in seen_strings:
|
||||
return
|
||||
|
||||
if fn not in seen_files:
|
||||
print >>out
|
||||
print >>out, " # Translatable strings found in", fn
|
||||
print >>out
|
||||
seen_files.add(fn)
|
||||
|
||||
print >>out, " config.translations[%r] = %r" % (s, s)
|
||||
seen_strings.add(s)
|
||||
|
||||
def process(fn):
|
||||
|
||||
data = file(fn).read()
|
||||
|
||||
for m in re.finditer(r'\bu\"(\\"|[^"])+\"', data):
|
||||
tl(fn, m.group(0))
|
||||
|
||||
for m in re.finditer(r"\bu\'(\\'|[^'])+\'", data):
|
||||
tl(fn, m.group(0))
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# out = file("extras/translations.rpy", "w")
|
||||
out = sys.stdout
|
||||
|
||||
print >>out, "# This file contains a list of all of the phrases you can translate"
|
||||
print >>out, "# from the Ren'Py common code."
|
||||
print >>out, ""
|
||||
print >>out, "init python:"
|
||||
|
||||
for fn in glob.glob("common/*.rpy") + glob.glob("common/_layout/*.rpym") + glob.glob("common/_compat/*.rpym"):
|
||||
process(fn)
|
||||
@@ -0,0 +1,70 @@
|
||||
init -1210 python:
|
||||
|
||||
# This is called when script_version is set, to immediately
|
||||
# run code in response to a script_version change.
|
||||
def _set_script_version(version):
|
||||
|
||||
if version is None:
|
||||
return
|
||||
|
||||
if version <= (5, 6, 0):
|
||||
config.check_properties = False
|
||||
|
||||
if version <= (6, 5, 0):
|
||||
layout.compat()
|
||||
|
||||
if version <= (6, 9, 1):
|
||||
store.library = store.config
|
||||
|
||||
init 1210 python hide::
|
||||
|
||||
# This returns true if the script_version is <= the
|
||||
# script_version supplied. Give it the last script version
|
||||
# where an old version was used.
|
||||
def compat(x, y, z):
|
||||
return config.script_version and config.script_version <= (x, y, z)
|
||||
|
||||
# Compat for changes to with-callback.
|
||||
if compat(5, 4, 5):
|
||||
if config.with_callback:
|
||||
def compat_with_function(trans, paired, old=config.with_callback):
|
||||
old(trans)
|
||||
return trans
|
||||
|
||||
config.with_callback = compat_with_function
|
||||
|
||||
if not config.sound:
|
||||
config.has_sound = False
|
||||
config.has_music = False
|
||||
config.has_voice = False
|
||||
|
||||
# Compat for SFont recoloring.
|
||||
if compat(5, 1, 1):
|
||||
config.recolor_sfonts = False
|
||||
|
||||
if compat(5, 5, 4):
|
||||
config.implicit_with_none = False
|
||||
|
||||
# Compat for changes to button look.
|
||||
if compat(5, 5, 4):
|
||||
style.button.setdefault(xpos=0.5, xanchor=0.5)
|
||||
style.menu_button.clear()
|
||||
style.menu_button_text.clear()
|
||||
|
||||
if compat(5, 6, 6):
|
||||
config.reject_midi = False
|
||||
|
||||
if compat(6, 2, 0):
|
||||
config.reject_backslash = False
|
||||
|
||||
if compat(6, 9, 0):
|
||||
style.motion.clear()
|
||||
|
||||
if "Fullscreen" in config.translations:
|
||||
fs = _("Fullscreen")
|
||||
config.translations.setdefault("Fullscreen 4:3", fs + " 4:3")
|
||||
config.translations.setdefault("Fullscreen 16:9", fs + " 16:9")
|
||||
config.translations.setdefault("Fullscreen 16:10", fs + " 16:10")
|
||||
|
||||
for i in layout.compat_funcs:
|
||||
i()
|
||||
@@ -0,0 +1,167 @@
|
||||
# This file contains a number of definitions of standard
|
||||
# locations and transitions. We've moved them into the common
|
||||
# directory so that it's easy for an updated version of all of these
|
||||
# definitions.
|
||||
|
||||
init -1110 python:
|
||||
|
||||
_define = define = object()
|
||||
|
||||
# Positions ##############################################################
|
||||
|
||||
# These are positions that can be used inside at clauses. We set
|
||||
# them up here so that they can be used throughout the program.
|
||||
left = Position(xalign=0.0)
|
||||
center = Position(xalign=0.5)
|
||||
truecenter = Position(xalign=0.5, yalign=0.5)
|
||||
right = Position(xalign=1.0)
|
||||
|
||||
# Offscreen positions for use with the move transition. Images at
|
||||
# these positions are still shown (and consume
|
||||
# resources)... remember to hide the image after the transition.
|
||||
offscreenleft = Position(xpos=0.0, xanchor=1.0)
|
||||
offscreenright = Position(xpos=1.0, xanchor=0.0)
|
||||
|
||||
# Transitions ############################################################
|
||||
|
||||
# Simple transitions.
|
||||
fade = Fade(.5, 0, .5) # Fade to black and back.
|
||||
dissolve = Dissolve(0.5)
|
||||
pixellate = Pixellate(1.0, 5)
|
||||
|
||||
# Various uses of CropMove.
|
||||
wiperight = CropMove(1.0, "wiperight")
|
||||
wipeleft = CropMove(1.0, "wipeleft")
|
||||
wipeup = CropMove(1.0, "wipeup")
|
||||
wipedown = CropMove(1.0, "wipedown")
|
||||
|
||||
slideright = CropMove(1.0, "slideright")
|
||||
slideleft = CropMove(1.0, "slideleft")
|
||||
slideup = CropMove(1.0, "slideup")
|
||||
slidedown = CropMove(1.0, "slidedown")
|
||||
|
||||
slideawayright = CropMove(1.0, "slideawayright")
|
||||
slideawayleft = CropMove(1.0, "slideawayleft")
|
||||
slideawayup = CropMove(1.0, "slideawayup")
|
||||
slideawaydown = CropMove(1.0, "slideawaydown")
|
||||
|
||||
irisout = CropMove(1.0, "irisout")
|
||||
irisin = CropMove(1.0, "irisin")
|
||||
|
||||
# Ease images around. These are basically cosine-warped moves.
|
||||
def _ease_out_time_warp(x):
|
||||
import math
|
||||
return 1.0 - math.cos(x * math.pi / 2.0)
|
||||
|
||||
def _ease_in_time_warp(x):
|
||||
import math
|
||||
return math.cos((1.0 - x) * math.pi / 2.0)
|
||||
|
||||
def _ease_time_warp(x):
|
||||
import math
|
||||
return .5 - math.cos(math.pi * x) / 2.0
|
||||
|
||||
# This defines a family of move transitions.
|
||||
def move_transitions(prefix, delay, time_warp=None, in_time_warp=None, out_time_warp=None, old=False, layers=[ 'master' ], **kwargs):
|
||||
moves = {
|
||||
"" : MoveTransition(
|
||||
delay,
|
||||
old=old,
|
||||
layers=layers,
|
||||
factory=MoveFactory(time_warp=time_warp, **kwargs)),
|
||||
|
||||
"inright" : MoveTransition(
|
||||
delay,
|
||||
old=old,
|
||||
layers=layers,
|
||||
factory=MoveFactory(time_warp=time_warp, **kwargs),
|
||||
enter_factory=MoveIn((1.0, None, 0.0, None), time_warp=in_time_warp, **kwargs)),
|
||||
|
||||
"inleft" : MoveTransition(
|
||||
delay,
|
||||
old=old,
|
||||
layers=layers,
|
||||
factory=MoveFactory(time_warp=time_warp, **kwargs),
|
||||
enter_factory=MoveIn((0.0, None, 1.0, None), time_warp=in_time_warp, **kwargs)),
|
||||
|
||||
"intop" : MoveTransition(
|
||||
delay,
|
||||
old=old,
|
||||
layers=layers,
|
||||
factory=MoveFactory(time_warp=time_warp, **kwargs),
|
||||
enter_factory=MoveIn((None, 0.0, None, 1.0), time_warp=in_time_warp, **kwargs)),
|
||||
|
||||
"inbottom" : MoveTransition(
|
||||
delay,
|
||||
old=old,
|
||||
layers=layers,
|
||||
factory=MoveFactory(time_warp=time_warp, **kwargs),
|
||||
enter_factory=MoveIn((None, 1.0, None, 0.0), time_warp=in_time_warp, **kwargs)),
|
||||
|
||||
"outright" : MoveTransition(
|
||||
delay,
|
||||
old=old,
|
||||
layers=layers,
|
||||
factory=MoveFactory(time_warp=time_warp, **kwargs),
|
||||
leave_factory=MoveOut((1.0, None, 0.0, None), time_warp=out_time_warp, **kwargs)),
|
||||
|
||||
"outleft" : MoveTransition(
|
||||
delay,
|
||||
old=old,
|
||||
layers=layers,
|
||||
factory=MoveFactory(time_warp=time_warp, **kwargs),
|
||||
leave_factory=MoveOut((0.0, None, 1.0, None), time_warp=out_time_warp, **kwargs)),
|
||||
|
||||
"outtop" : MoveTransition(
|
||||
delay,
|
||||
old=old,
|
||||
layers=layers,
|
||||
factory=MoveFactory(time_warp=time_warp, **kwargs),
|
||||
leave_factory=MoveOut((None, 0.0, None, 1.0), time_warp=out_time_warp, **kwargs)),
|
||||
|
||||
"outbottom" : MoveTransition(
|
||||
delay,
|
||||
old=old,
|
||||
layers=layers,
|
||||
factory=MoveFactory(time_warp=time_warp, **kwargs),
|
||||
leave_factory=MoveOut((None, 1.0, None, 0.0), time_warp=time_warp, **kwargs)),
|
||||
}
|
||||
|
||||
for k, v in moves.iteritems():
|
||||
setattr(store, prefix + k, v)
|
||||
|
||||
define.move_transitions = move_transitions
|
||||
del move_transitions
|
||||
|
||||
define.move_transitions("move", 0.5)
|
||||
define.move_transitions("ease", 0.5, _ease_time_warp, _ease_in_time_warp, _ease_out_time_warp)
|
||||
|
||||
# Zoom-based transitions.
|
||||
zoomin = MoveTransition(0.5, enter_factory=ZoomInOut(0.01, 1.0))
|
||||
zoomout = MoveTransition(0.5, leave_factory=ZoomInOut(1.0, 0.01))
|
||||
zoominout = MoveTransition(0.5, enter_factory=ZoomInOut(0.01, 1.0), leave_factory=ZoomInOut(1.0, 0.01))
|
||||
|
||||
|
||||
|
||||
# These shake the screen up and down for a quarter second.
|
||||
# The delay needs to be an integer multiple of the period.
|
||||
vpunch = Move((0, 10), (0, -10), .10, bounce=True, repeat=True, delay=.275)
|
||||
hpunch = Move((15, 0), (-15, 0), .10, bounce=True, repeat=True, delay=.275)
|
||||
|
||||
# These use the ImageDissolve to do some nifty effects.
|
||||
blinds = ImageDissolve(im.Tile("blindstile.png"), 1.0, 8)
|
||||
squares = ImageDissolve(im.Tile("squarestile.png"), 1.0, 256)
|
||||
|
||||
|
||||
init -1110:
|
||||
image black = Solid("#000")
|
||||
|
||||
init 1110 python:
|
||||
if not hasattr(store, 'narrator'):
|
||||
narrator = Character(None, kind=adv, what_style='say_thought')
|
||||
|
||||
if not hasattr(store, 'name_only'):
|
||||
name_only = adv
|
||||
|
||||
if not hasattr(store, 'centered'):
|
||||
centered = Character(None, what_style="centered_text", window_style="centered_window")
|
||||
@@ -0,0 +1,289 @@
|
||||
# Entry point for the developer console.
|
||||
label _developer:
|
||||
|
||||
if not config.developer:
|
||||
return
|
||||
|
||||
call _enter_menu from _call__enter_menu_4
|
||||
|
||||
label _developer_screen:
|
||||
|
||||
python hide:
|
||||
|
||||
ui.window(style=style.gm_root)
|
||||
ui.null()
|
||||
|
||||
ui.frame(xpos=10, ypos=10, style=style.menu_frame)
|
||||
ui.vbox(box_first_spacing=10)
|
||||
layout.label(u"Developer Menu", None)
|
||||
|
||||
sg = "developer_menu"
|
||||
|
||||
layout.button("Return", None, clicked=ui.returns(True), size_group=sg)
|
||||
layout.button("Reload Game (Shift+R)", None, clicked=ui.callsinnewcontext("_save_reload_game"), size_group=sg)
|
||||
layout.button("Variable Viewer", None, clicked=ui.jumps("_debugger_screen"), size_group=sg)
|
||||
layout.button("Theme Test", None, clicked=ui.jumps("_theme_test"), size_group=sg)
|
||||
layout.button("Style Hierarchy", None, clicked=ui.jumps("_style_hierarchy"), size_group=sg)
|
||||
|
||||
ui.close()
|
||||
ui.interact()
|
||||
|
||||
return
|
||||
|
||||
label _debugger_screen:
|
||||
|
||||
python hide:
|
||||
|
||||
ui.window(style=style.gm_root)
|
||||
ui.null()
|
||||
|
||||
ui.frame(ymargin=10, xmargin=10, style=style.menu_frame)
|
||||
ui.side(['t', 'c', 'r', 'b'])
|
||||
|
||||
layout.label("Variable Viewer", None)
|
||||
|
||||
entries = [ ]
|
||||
|
||||
ebc = renpy.game.log.ever_been_changed
|
||||
ebc = list(ebc)
|
||||
ebc.sort()
|
||||
|
||||
ebc.remove("nvl_list")
|
||||
|
||||
import repr
|
||||
aRepr = repr.Repr()
|
||||
aRepr.maxstring = 40
|
||||
|
||||
for var in ebc:
|
||||
if not hasattr(store, var):
|
||||
continue
|
||||
|
||||
if var.startswith("__00"):
|
||||
continue
|
||||
|
||||
if var.startswith("_") and not var.startswith("__"):
|
||||
continue
|
||||
|
||||
val = aRepr.repr(getattr(store, var))
|
||||
entries.append((0, (var + " = " + val).replace("{", "{{")))
|
||||
|
||||
if entries:
|
||||
vp = ui.viewport(mousewheel=True)
|
||||
layout.list(entries)
|
||||
ui.bar(adjustment=vp.yadjustment, style='vscrollbar')
|
||||
else:
|
||||
layout.prompt("No variables have changed since the game started.", None)
|
||||
ui.null()
|
||||
|
||||
layout.button(u"Return to the developer menu", None, clicked=ui.returns(True))
|
||||
|
||||
ui.close()
|
||||
|
||||
ui.interact()
|
||||
|
||||
jump _developer_screen
|
||||
|
||||
label _theme_test:
|
||||
|
||||
python hide:
|
||||
|
||||
# Never gets pickled
|
||||
def role(b):
|
||||
if b:
|
||||
return "selected_"
|
||||
else:
|
||||
return ""
|
||||
|
||||
toggle_var = True
|
||||
adj = ui.adjustment(100, 25, page=25)
|
||||
|
||||
while True:
|
||||
|
||||
ui.window(style=style.gm_root)
|
||||
ui.null()
|
||||
|
||||
# Buttons
|
||||
ui.hbox(box_spacing=10, xpos=10, ypos=10)
|
||||
|
||||
ui.vbox(box_spacing=10)
|
||||
|
||||
sg = "theme_test"
|
||||
|
||||
ui.frame(style='menu_frame')
|
||||
ui.vbox()
|
||||
layout.label("Button", None)
|
||||
ui.textbutton("Button", size_group=sg, clicked=ui.returns("gndn"))
|
||||
ui.textbutton("Button (Selected)", size_group=sg, clicked=ui.returns("gndn"), role=role(True))
|
||||
ui.textbutton("Small", clicked=ui.returns("gndn"), style='small_button')
|
||||
ui.close()
|
||||
|
||||
ui.frame(style='menu_frame')
|
||||
ui.vbox()
|
||||
layout.label("Radio Button", None)
|
||||
ui.textbutton("True", size_group=sg, clicked=ui.returns("set"), role=role(toggle_var), style='radio_button')
|
||||
ui.textbutton("False", size_group=sg, clicked=ui.returns("unset"), role=role(not toggle_var), style='radio_button')
|
||||
ui.close()
|
||||
|
||||
ui.frame(style='menu_frame')
|
||||
ui.vbox()
|
||||
layout.label("Check Button", None)
|
||||
ui.textbutton("Check Button", size_group=sg, clicked=ui.returns("toggle"), role=role(toggle_var), style='check_button')
|
||||
ui.close()
|
||||
|
||||
ui.frame(style='menu_frame')
|
||||
ui.vbox(box_spacing=2)
|
||||
ui.bar(adjustment=adj, style='bar', xmaximum=200)
|
||||
ui.bar(adjustment=adj, style='slider', xmaximum=200)
|
||||
ui.bar(adjustment=adj, style='scrollbar', xmaximum=200)
|
||||
ui.close()
|
||||
|
||||
ui.close() # vbox
|
||||
|
||||
ui.frame(style='menu_frame')
|
||||
ui.hbox(box_spacing=2)
|
||||
ui.bar(adjustment=adj, style='vbar', ymaximum=200)
|
||||
ui.bar(adjustment=adj, style='vslider', ymaximum=200)
|
||||
ui.bar(adjustment=adj, style='vscrollbar', ymaximum=200)
|
||||
ui.close()
|
||||
|
||||
ui.frame(style='menu_frame', xmaximum=0.95)
|
||||
ui.vbox(box_spacing=20)
|
||||
layout.prompt("This a prompt. Hopefully, we've made this long enough to wrap around at least once.", None)
|
||||
ui.close()
|
||||
|
||||
ui.close() # hbox
|
||||
|
||||
ui.frame(style='menu_frame', xalign=.01, yalign=.99)
|
||||
ui.textbutton("Return to the developer menu", clicked=ui.returns("return"))
|
||||
|
||||
rv = ui.interact()
|
||||
if rv == "return":
|
||||
renpy.jump("_developer_screen")
|
||||
|
||||
elif rv == "set":
|
||||
toggle_var = True
|
||||
elif rv == "unset":
|
||||
toggle_var = False
|
||||
elif rv == "toggle":
|
||||
toggle_var = not toggle_var
|
||||
|
||||
label _style_hierarchy:
|
||||
|
||||
python hide:
|
||||
|
||||
ui.window(style=style.gm_root)
|
||||
ui.null()
|
||||
|
||||
ui.frame(ymargin=10, xmargin=10, style=style.menu_frame)
|
||||
ui.side(['t', 'c', 'r', 'b'], spacing=2)
|
||||
|
||||
layout.label("Style Hierarchy", None)
|
||||
|
||||
hier = renpy.style.style_hierarchy()
|
||||
|
||||
entries = [ (i[0], i[1] + " - " + str(i[2])) for i in hier if i[2] ]
|
||||
|
||||
vp = ui.viewport(mousewheel=True)
|
||||
layout.list(entries)
|
||||
ui.bar(adjustment=vp.yadjustment, style='vscrollbar')
|
||||
|
||||
layout.button(u"Return to the developer menu", None, clicked=ui.returns(True))
|
||||
|
||||
ui.close()
|
||||
|
||||
ui.interact()
|
||||
|
||||
jump _developer_screen
|
||||
|
||||
|
||||
init -1050 python:
|
||||
config.missing_background = "black"
|
||||
|
||||
init 1050 python:
|
||||
|
||||
if renpy.game.options.remote:
|
||||
|
||||
config.window_title = "Preview: " + config.window_title
|
||||
|
||||
class Remote(renpy.Displayable):
|
||||
|
||||
def render(self, width, height, st, at):
|
||||
return renpy.Render(0, 0)
|
||||
|
||||
def event(self, ev, x, y, st):
|
||||
renpy.remote.remote()
|
||||
renpy.timeout(.05)
|
||||
|
||||
config.underlay.append(Remote())
|
||||
del Remote
|
||||
|
||||
|
||||
if config.developer:
|
||||
|
||||
# This is used to indicate that a scene has just occured,
|
||||
# and so if the next thing is a missing_show, we should
|
||||
# blank the screen.
|
||||
__missing_scene = False
|
||||
|
||||
# This returns the __missing dictionary from the current
|
||||
# context object.
|
||||
def __missing():
|
||||
try:
|
||||
return renpy.context().__missing
|
||||
except AttributeError:
|
||||
rv = dict()
|
||||
renpy.context().__missing = rv
|
||||
return rv
|
||||
|
||||
def __missing_show_callback(name, what, layer):
|
||||
if layer != 'master':
|
||||
return False
|
||||
|
||||
global __missing_scene
|
||||
if __missing_scene:
|
||||
renpy.show(name, what=config.missing_background)
|
||||
__missing_scene = False
|
||||
|
||||
what = " ".join(what).replace("{", "{{")
|
||||
__missing()[name[0]] = what
|
||||
return True
|
||||
|
||||
def __missing_hide_callback(name, layer):
|
||||
if layer != 'master':
|
||||
return False
|
||||
|
||||
global __missing_scene
|
||||
__missing_scene = False
|
||||
|
||||
__missing().pop(name[0], None)
|
||||
return True
|
||||
|
||||
def __missing_scene_callback(layer):
|
||||
if layer != 'master':
|
||||
return False
|
||||
|
||||
global __missing_scene
|
||||
__missing_scene = True
|
||||
__missing().clear()
|
||||
|
||||
return True
|
||||
|
||||
def __missing_overlay():
|
||||
missing = __missing()
|
||||
|
||||
if not missing:
|
||||
return
|
||||
|
||||
ui.vbox(xalign=0.5, yalign=0.0)
|
||||
ui.text(_("Undefined Images"), xalign=0.5)
|
||||
|
||||
for what in sorted(missing.values()):
|
||||
ui.text(what, xalign=0.5)
|
||||
|
||||
ui.close()
|
||||
|
||||
|
||||
config.missing_scene = __missing_scene_callback
|
||||
config.missing_show = __missing_show_callback
|
||||
config.missing_hide = __missing_hide_callback
|
||||
config.overlay_functions.append(__missing_overlay)
|
||||
@@ -0,0 +1,345 @@
|
||||
# Copyright 2004-2007 PyTom
|
||||
#
|
||||
# Please see the LICENSE.txt distributed with Ren'Py for permission to
|
||||
# copy and modify.
|
||||
|
||||
init -1105 python:
|
||||
|
||||
class Layout():
|
||||
def __call__(self, func):
|
||||
setattr(self, func.func_name, func)
|
||||
return func
|
||||
|
||||
layout = _layout = Layout()
|
||||
del Layout
|
||||
|
||||
layout.compat_funcs = [ ]
|
||||
layout.provided = set()
|
||||
|
||||
# This takes care of actually displaying button menus.
|
||||
def _display_button_menu(menuitems):
|
||||
|
||||
narration = [ s for s, i in menuitems if i is None and s ]
|
||||
menuitems = [ (s, i) for s, i in menuitems if i is not None or not s ]
|
||||
|
||||
if narration:
|
||||
renpy.say(None, "\n".join(narration), interact=False)
|
||||
|
||||
return renpy.display_menu(menuitems)
|
||||
|
||||
init -1105 python hide:
|
||||
|
||||
# Called to indicate that the given kind of layout has been
|
||||
# provided.
|
||||
@layout
|
||||
def provides(kind):
|
||||
|
||||
if kind in layout.provided:
|
||||
raise Exception("%s has already been provided by another layout function." % kind)
|
||||
|
||||
layout.provided.add(kind)
|
||||
|
||||
# Called by registered themes to have the default versions of
|
||||
# various kinds of layouts provided, if a more specific version
|
||||
# has not been requested by the user.
|
||||
@layout
|
||||
def defaults():
|
||||
|
||||
# Do nothing, in compatibility mode.
|
||||
if 'compat' in layout.provided:
|
||||
return
|
||||
|
||||
defaults = dict(
|
||||
main_menu=layout.classic_main_menu,
|
||||
load_save=layout.classic_load_save,
|
||||
navigation=layout.classic_navigation,
|
||||
yesno_prompt=layout.classic_yesno_prompt,
|
||||
preferences=layout.classic_preferences,
|
||||
joystick_preferences=layout.classic_joystick_preferences,
|
||||
)
|
||||
|
||||
for k, v in defaults.iteritems():
|
||||
if k not in layout.provided:
|
||||
v()
|
||||
|
||||
if store._game_menu_screen is None:
|
||||
if renpy.has_label("save_screen"):
|
||||
store._game_menu_screen = "save_screen"
|
||||
elif renpy.has_label("preferences_screen"):
|
||||
store._game_menu_screen = "preferences_screen"
|
||||
|
||||
|
||||
##########################################################################
|
||||
# These live on the layout object, and ease the construction of buttons,
|
||||
# labels, and prompts. A sufficently aggressive layout might change
|
||||
# these.
|
||||
|
||||
@layout
|
||||
def button(label,
|
||||
type=None,
|
||||
selected=False,
|
||||
enabled=True,
|
||||
clicked=None,
|
||||
hovered=None,
|
||||
unhovered=None,
|
||||
index=None,
|
||||
**properties):
|
||||
|
||||
"""
|
||||
label - The label of this button. Will be translated if necessary.
|
||||
type - The type of this button. Used to generate the appropriate styles.
|
||||
selected - Determines if this button should be selected.
|
||||
enabled - Determines if this button should be enabled.
|
||||
clicked - A function that is run when the button is clicked.
|
||||
hovered - A function that is run when the button is hovered.
|
||||
unhovered - A function that is run when the button is unhovered.
|
||||
index - A style index. If None, label is used.
|
||||
size_group - The size_group used by this button.
|
||||
"""
|
||||
|
||||
if not enabled:
|
||||
clicked = None
|
||||
|
||||
if selected and enabled:
|
||||
role = "selected_"
|
||||
else:
|
||||
role = ""
|
||||
|
||||
if type:
|
||||
button_style = type + "_button"
|
||||
text_style = type + "_button_text"
|
||||
else:
|
||||
button_style = 'button'
|
||||
text_style = 'button_text'
|
||||
|
||||
if index is None:
|
||||
index = label
|
||||
|
||||
button_style = getattr(style, button_style)[index]
|
||||
text_style = getattr(style, text_style)[index]
|
||||
|
||||
rv = ui.button(style=button_style, role=role, clicked=clicked, hovered=hovered, unhovered=unhovered, **properties)
|
||||
ui.text(_(label), style=text_style)
|
||||
|
||||
return rv
|
||||
|
||||
@layout
|
||||
def label(label, type, suffix="label", index=None, **properties):
|
||||
|
||||
if index is None:
|
||||
index = label
|
||||
|
||||
if type:
|
||||
label_style = getattr(style, type + "_" + suffix)[index]
|
||||
text_style = getattr(style, type + "_" + suffix + "_text")[index]
|
||||
else:
|
||||
label_style = style.label[index]
|
||||
text_style = style.label_text[index]
|
||||
|
||||
ui.window(style=label_style, **properties)
|
||||
ui.text(_(label), style=text_style)
|
||||
|
||||
@layout
|
||||
def prompt(label, type, index=None, **properties):
|
||||
return layout.label(label, type, "prompt", index, **properties)
|
||||
|
||||
@layout
|
||||
def list(entries, clicked=None, hovered=None, unhovered=None, selected=None, **properties):
|
||||
|
||||
ui.window(style=style.list, **properties)
|
||||
ui.vbox(style=style.list_box)
|
||||
|
||||
size_group = str(id(entries))
|
||||
|
||||
for i, (spacers, content) in enumerate(entries):
|
||||
if clicked is not None:
|
||||
new_clicked = renpy.curry(clicked)(i)
|
||||
else:
|
||||
new_clicked = None
|
||||
|
||||
if hovered is not None:
|
||||
new_hovered = renpy.curry(hovered)(i)
|
||||
else:
|
||||
new_hovered = None
|
||||
|
||||
if unhovered is not None:
|
||||
new_unhovered = renpy.curry(unhovered)(i)
|
||||
else:
|
||||
new_unhovered = None
|
||||
|
||||
if selected == i:
|
||||
role = "selected_"
|
||||
else:
|
||||
role = ""
|
||||
|
||||
ui.button(style=style.list_row[i%2],
|
||||
clicked=new_clicked,
|
||||
hovered=new_hovered,
|
||||
unhovered=new_unhovered,
|
||||
role=role,
|
||||
size_group=size_group,
|
||||
)
|
||||
|
||||
ui.hbox(style=style.list_row_box)
|
||||
|
||||
for j in range(0, spacers):
|
||||
ui.window(style=style.list_spacer)
|
||||
ui.null()
|
||||
|
||||
ui.text(content, style=style.list_text)
|
||||
|
||||
ui.close() # row
|
||||
|
||||
ui.close() # vbox
|
||||
|
||||
##########################################################################
|
||||
# Misc.
|
||||
|
||||
@layout
|
||||
def button_menu():
|
||||
|
||||
store.menu = _display_button_menu
|
||||
|
||||
style.menu.box_spacing = 2
|
||||
style.menu_window.set_parent(style.default)
|
||||
style.menu_window.xalign = 0.5
|
||||
style.menu_window.yalign = 0.5
|
||||
style.menu_choice.set_parent(style.button_text)
|
||||
style.menu_choice.clear()
|
||||
style.menu_choice_button.set_parent(style.button)
|
||||
style.menu_choice_button.xminimum = int(config.screen_width * 0.75)
|
||||
style.menu_choice_button.xmaximum = int(config.screen_width * 0.75)
|
||||
|
||||
store._button_menu = button_menu
|
||||
|
||||
###########################################################################
|
||||
# Compat layout.
|
||||
|
||||
@layout
|
||||
def compat():
|
||||
layout.provides('compat')
|
||||
renpy.load_module("_compat/styles")
|
||||
renpy.load_module("_compat/library")
|
||||
renpy.load_module("_compat/mainmenu")
|
||||
renpy.load_module("_compat/gamemenu")
|
||||
renpy.load_module("_compat/preferences")
|
||||
renpy.load_module("_compat/themes")
|
||||
|
||||
###########################################################################
|
||||
# Classic layout.
|
||||
|
||||
@layout
|
||||
def classic_main_menu():
|
||||
renpy.load_module("_layout/classic_main_menu")
|
||||
|
||||
@layout
|
||||
def classic_navigation():
|
||||
renpy.load_module('_layout/classic_navigation')
|
||||
|
||||
@layout
|
||||
def classic_load_save():
|
||||
renpy.load_module('_layout/classic_load_save')
|
||||
|
||||
@layout
|
||||
def classic_yesno_prompt():
|
||||
renpy.load_module('_layout/classic_yesno_prompt')
|
||||
|
||||
@layout
|
||||
def classic_preferences(center=False):
|
||||
renpy.load_module('_layout/classic_preferences')
|
||||
|
||||
if center:
|
||||
style.prefs_button.xalign = 0.5
|
||||
style.prefs_slider.xalign = 0.5
|
||||
style.prefs_jump_button.xalign = 0.5
|
||||
|
||||
@layout
|
||||
def classic_joystick_preferences():
|
||||
renpy.load_module('_layout/classic_joystick_preferences')
|
||||
|
||||
@layout
|
||||
def two_column_preferences():
|
||||
renpy.load_module("_layout/two_column_preferences")
|
||||
|
||||
@layout
|
||||
def one_column_preferences():
|
||||
renpy.load_module("_layout/one_column_preferences")
|
||||
|
||||
@layout
|
||||
def grouped_main_menu(per_group=2, equal_size=True):
|
||||
renpy.load_module("_layout/grouped_main_menu")
|
||||
config.main_menu_per_group = per_group
|
||||
|
||||
if equal_size:
|
||||
style.mm_button.size_group = "main_menu"
|
||||
|
||||
|
||||
@layout
|
||||
def grouped_navigation(per_group=2, equal_size=True):
|
||||
renpy.load_module("_layout/grouped_navigation")
|
||||
config.navigation_per_group = per_group
|
||||
|
||||
if equal_size:
|
||||
style.gm_nav_button.size_group = "navigation"
|
||||
|
||||
@layout
|
||||
def scrolling_load_save():
|
||||
renpy.load_module("_layout/scrolling_load_save")
|
||||
|
||||
|
||||
@layout
|
||||
def imagemap_main_menu(ground, selected, hotspots):
|
||||
renpy.load_module("_layout/imagemap_main_menu")
|
||||
|
||||
config.main_menu_ground = ground
|
||||
config.main_menu_selected = selected
|
||||
config.main_menu_hotspots = hotspots
|
||||
|
||||
@layout
|
||||
def imagemap_navigation(ground, idle, hover, selected_idle, selected_hover,
|
||||
hotspots):
|
||||
|
||||
renpy.load_module("_layout/imagemap_navigation")
|
||||
|
||||
config.navigation_ground = ground
|
||||
config.navigation_idle = idle
|
||||
config.navigation_hover = hover
|
||||
config.navigation_selected_idle = selected_idle
|
||||
config.navigation_selected_hover = selected_hover
|
||||
config.navigation_hotspots = hotspots
|
||||
|
||||
@layout
|
||||
def imagemap_preferences(ground, idle, hover, selected_idle, selected_hover,
|
||||
hotspots):
|
||||
|
||||
renpy.load_module("_layout/imagemap_preferences")
|
||||
|
||||
config.preferences_ground = ground
|
||||
config.preferences_idle = idle
|
||||
config.preferences_hover = hover
|
||||
config.preferences_selected_idle = selected_idle
|
||||
config.preferences_selected_hover = selected_hover
|
||||
config.preferences_hotspots = hotspots
|
||||
|
||||
@layout
|
||||
def imagemap_yesno_prompt(ground, idle, hover, hotspots):
|
||||
|
||||
renpy.load_module("_layout/imagemap_yesno_prompt")
|
||||
|
||||
config.yesno_prompt_ground = ground
|
||||
config.yesno_prompt_idle = idle
|
||||
config.yesno_prompt_hover = hover
|
||||
config.yesno_prompt_hotspots = hotspots
|
||||
|
||||
@layout
|
||||
def imagemap_load_save(ground, idle, hover, selected_idle, selected_hover,
|
||||
hotspots):
|
||||
|
||||
renpy.load_module("_layout/imagemap_load_save")
|
||||
|
||||
config.load_save_ground = ground
|
||||
config.load_save_idle = idle
|
||||
config.load_save_hover = hover
|
||||
config.load_save_selected_idle = selected_idle
|
||||
config.load_save_selected_hover = selected_hover
|
||||
config.load_save_hotspots = hotspots
|
||||
@@ -0,0 +1,741 @@
|
||||
# Copyright 2004-2007 PyTom
|
||||
#
|
||||
# Please see the LICENSE.txt distributed with Ren'Py for permission to
|
||||
# copy and modify.
|
||||
|
||||
# This file consists of renpy functions that aren't expected to be
|
||||
# touched by the user too much. We reserve the _ prefix for names
|
||||
# defined in the library.
|
||||
|
||||
init -1180 python:
|
||||
|
||||
# These are settings that the user can tweak to control the
|
||||
# look of the main menu and the load/save/escape screens.
|
||||
|
||||
# basics: The version of Ren'Py this script is intended for, or
|
||||
# None if it's intended for the current version.
|
||||
config.script_version = None
|
||||
|
||||
# The minimum version of the module we work with. Don't change
|
||||
# this unless you know what you're doing.
|
||||
config.module_version = 6007001
|
||||
|
||||
# Should we warn the user if the module is missing or has a bad
|
||||
# version?
|
||||
config.module_warning = False
|
||||
|
||||
# basics: A map from a string that's displayed by the interface to
|
||||
# a translated value of that string.
|
||||
config.translations = { }
|
||||
|
||||
# Used internally to maintain compatiblity with old
|
||||
# translations of strings.
|
||||
config.old_names = { }
|
||||
|
||||
# basics: True if the skip indicator should be shown.
|
||||
config.skip_indicator = True
|
||||
|
||||
# basics: The width of a thumbnail.
|
||||
config.thumbnail_width = 66
|
||||
|
||||
# basics: The height of a thumbnail.
|
||||
config.thumbnail_height = 50
|
||||
|
||||
# basics: If not None, the default value of the fullscreen
|
||||
# preference when the game is first run.
|
||||
config.default_fullscreen = None
|
||||
|
||||
# basics: If not None, the default value of the text_cps
|
||||
# preference when the game is first run.
|
||||
config.default_text_cps = None
|
||||
|
||||
# This is updated to give the user an idea of where a save is
|
||||
# taking place.
|
||||
save_name = ''
|
||||
|
||||
# Should the window be shown during transitions?
|
||||
_window_during_transitions = False
|
||||
|
||||
def _default_with_callback(trans, paired=None):
|
||||
if (_window_during_transitions and not
|
||||
renpy.context_nesting_level() and
|
||||
not renpy.count_displayables_in_layer('transient')):
|
||||
|
||||
# narrator("", interact=False)
|
||||
ui.window(style=style.say_window["empty"])
|
||||
ui.null()
|
||||
|
||||
return trans
|
||||
|
||||
config.with_callback = _default_with_callback
|
||||
|
||||
|
||||
def _default_empty_window():
|
||||
store.narrator("", interact=False)
|
||||
|
||||
config.empty_window = _default_empty_window
|
||||
|
||||
style.skip_indicator = Style(style.default, heavy=True, help='The skip indicator.')
|
||||
style.skip_indicator.xpos = 10
|
||||
style.skip_indicator.ypos = 10
|
||||
|
||||
# This is used to jump to a label with a transition.
|
||||
def _intra_jumps_core(label, transition):
|
||||
renpy.transition(getattr(config, transition))
|
||||
renpy.jump(label)
|
||||
|
||||
_intra_jumps = renpy.curry(_intra_jumps_core)
|
||||
|
||||
|
||||
# The function that's used to translate strings in the game menu.
|
||||
def _(s):
|
||||
"""
|
||||
Translates s into another language or something.
|
||||
"""
|
||||
|
||||
if s in config.translations:
|
||||
return config.translations[s]
|
||||
|
||||
if s in config.old_names and config.old_names[s] in config.translations:
|
||||
return config.translations[config.old_names[s]]
|
||||
|
||||
return s
|
||||
|
||||
# Are the windows currently hidden?
|
||||
_windows_hidden = False
|
||||
|
||||
init -1180 python:
|
||||
|
||||
def toggle_skipping():
|
||||
|
||||
if not config.skipping:
|
||||
config.skipping = "slow"
|
||||
else:
|
||||
config.skipping = None
|
||||
|
||||
if renpy.context()._menu:
|
||||
renpy.jump("_noisy_return")
|
||||
else:
|
||||
renpy.restart_interaction()
|
||||
|
||||
config.help = None
|
||||
|
||||
def _help():
|
||||
if not config.help:
|
||||
return
|
||||
|
||||
if renpy.has_label(config.help):
|
||||
renpy.call_in_new_context(config.help)
|
||||
return
|
||||
|
||||
_preferences.fullscreen = False
|
||||
|
||||
import webbrowser
|
||||
webbrowser.open_new("file:///" + config.basedir + "/" + config.help)
|
||||
|
||||
|
||||
init -1180 python hide:
|
||||
|
||||
# Called to make a screenshot happen.
|
||||
def screenshot():
|
||||
import os.path
|
||||
import os
|
||||
|
||||
pattern = os.environ.get("RENPY_SCREENSHOT_PATTERN", "screenshot%04d.png")
|
||||
|
||||
i = 1
|
||||
while True:
|
||||
fn = pattern % i
|
||||
if not os.path.exists(fn):
|
||||
break
|
||||
i += 1
|
||||
|
||||
renpy.screenshot(fn)
|
||||
|
||||
def dump_styles():
|
||||
if config.developer:
|
||||
renpy.style.write_text("styles.txt")
|
||||
|
||||
def invoke_game_menu():
|
||||
if renpy.context()._menu:
|
||||
renpy.jump("_noisy_return")
|
||||
else:
|
||||
renpy.call_in_new_context('_game_menu')
|
||||
|
||||
def keymap_toggle_skipping():
|
||||
if renpy.context()._menu:
|
||||
return
|
||||
|
||||
toggle_skipping()
|
||||
|
||||
def fast_skip():
|
||||
if config.fast_skipping or config.developer:
|
||||
config.skipping = "fast"
|
||||
|
||||
if renpy.context()._menu:
|
||||
renpy.jump("_noisy_return")
|
||||
|
||||
def reload_game():
|
||||
if not config.developer:
|
||||
return
|
||||
|
||||
renpy.call_in_new_context("_save_reload_game")
|
||||
|
||||
def launch_editor():
|
||||
if not config.developer:
|
||||
return
|
||||
|
||||
filename, line = renpy.get_filename_line()
|
||||
renpy.launch_editor([ filename ], line)
|
||||
|
||||
# The default keymap. We might also want to put some of this into
|
||||
# the launcher.
|
||||
km = renpy.Keymap(
|
||||
rollback = renpy.rollback,
|
||||
screenshot = screenshot,
|
||||
toggle_fullscreen = renpy.toggle_fullscreen,
|
||||
toggle_music = renpy.toggle_music,
|
||||
toggle_skip = keymap_toggle_skipping,
|
||||
fast_skip = fast_skip,
|
||||
game_menu = invoke_game_menu,
|
||||
hide_windows = renpy.curried_call_in_new_context("_hide_windows"),
|
||||
launch_editor = launch_editor,
|
||||
dump_styles = dump_styles,
|
||||
reload_game = reload_game,
|
||||
developer = renpy.curried_call_in_new_context("_developer"),
|
||||
quit = renpy.quit_event,
|
||||
iconify = renpy.iconify,
|
||||
help = _help,
|
||||
)
|
||||
|
||||
config.underlay = [ km ]
|
||||
|
||||
def skip_indicator():
|
||||
|
||||
### skip_indicator default
|
||||
# (text) The style and placement of the skip indicator.
|
||||
|
||||
if config.skip_indicator is True:
|
||||
|
||||
if config.skipping == "slow" and config.skip_indicator:
|
||||
ui.text(_(u"Skip Mode"), style='skip_indicator')
|
||||
|
||||
if config.skipping == "fast" and config.skip_indicator:
|
||||
ui.text(_(u"Fast Skip Mode"), style='skip_indicator')
|
||||
|
||||
return
|
||||
|
||||
if not config.skip_indicator:
|
||||
return
|
||||
|
||||
if not config.skipping:
|
||||
return
|
||||
|
||||
ui.add(renpy.easy.displayable(config.skip_indicator))
|
||||
|
||||
config.overlay_functions.append(skip_indicator)
|
||||
|
||||
|
||||
def hyperlink_styler(target):
|
||||
return style.hyperlink_text
|
||||
|
||||
def hyperlink_function(target):
|
||||
if target.startswith("http:"):
|
||||
try:
|
||||
import webbrowser
|
||||
webbrowser.open(target)
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
renpy.call_in_new_context(target)
|
||||
|
||||
config.hyperlink_styler = hyperlink_styler
|
||||
config.hyperlink_callback = hyperlink_function
|
||||
|
||||
|
||||
config.extend_interjection = "{fast}"
|
||||
|
||||
init -1180 python:
|
||||
def extend(what, interact=True):
|
||||
who = _last_say_who
|
||||
|
||||
if who is not None:
|
||||
who = eval(who)
|
||||
|
||||
if who is None:
|
||||
who = narrator
|
||||
|
||||
if isinstance(who, basestring):
|
||||
who = unknown.copy(who)
|
||||
|
||||
# This ensures extend works even with NVL mode.
|
||||
who.do_extend()
|
||||
|
||||
what = _last_say_what + config.extend_interjection + what
|
||||
|
||||
renpy.exports.say(who, what, interact=interact)
|
||||
store._last_say_what = what
|
||||
|
||||
extend.record_say = False
|
||||
|
||||
|
||||
label _hide_windows:
|
||||
|
||||
if renpy.context()._menu:
|
||||
return
|
||||
|
||||
if _windows_hidden:
|
||||
return
|
||||
|
||||
python:
|
||||
_windows_hidden = True
|
||||
ui.saybehavior(dismiss=['dismiss', 'hide_windows'])
|
||||
ui.interact(suppress_overlay=True, suppress_window=True)
|
||||
_windows_hidden = False
|
||||
|
||||
return
|
||||
|
||||
|
||||
# This code here handles check for the correct version of the Ren'Py module.
|
||||
|
||||
label _check_module:
|
||||
|
||||
if not config.module_warning:
|
||||
return
|
||||
|
||||
python hide:
|
||||
module_info = _(u"While Ren'Py games may be playable without the renpy module, some features may be disabled. For more information, read the module/README.txt file or go to http://www.bishoujo.us/renpy/.")
|
||||
|
||||
if renpy.module_version() == 0:
|
||||
_show_exception(_(u"renpy module not found."),
|
||||
_(u"The renpy module could not be loaded on your system.") + "\n\n" + module_info)
|
||||
elif renpy.module_version() < config.module_version:
|
||||
_show_exception(_(u"Old renpy module found."),
|
||||
_(u"An old version (%d) of the Ren'Py module was found on your system, while this game requires version %d.") % (renpy.module_version(), config.module_version) + "\n\n" + module_info)
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
label _save_reload_game:
|
||||
python hide:
|
||||
renpy.take_screenshot((config.thumbnail_width, config.thumbnail_height))
|
||||
|
||||
ui.add(Solid((0, 0, 0, 255)))
|
||||
ui.text("Saving game...",
|
||||
size=32, xalign=0.5, yalign=0.5, color=(255, 255, 255, 255))
|
||||
|
||||
renpy.pause(0)
|
||||
renpy.save("reload", "reload save game")
|
||||
|
||||
persistent._reload_save = "reload"
|
||||
|
||||
ui.add(Solid((0, 0, 0, 255)))
|
||||
ui.text("Reloading script...",
|
||||
size=32, xalign=0.5, yalign=0.5, color=(255, 255, 255, 255))
|
||||
|
||||
renpy.pause(0)
|
||||
|
||||
renpy.utter_restart()
|
||||
|
||||
label _load_reload_game:
|
||||
|
||||
if not persistent._reload_save:
|
||||
return
|
||||
|
||||
python hide:
|
||||
save = persistent._reload_save
|
||||
persistent._reload_save = 0
|
||||
|
||||
ui.add(Solid((0, 0, 0, 255)))
|
||||
ui.text("Reloading game...",
|
||||
size=32, xalign=0.5, yalign=0.5, color=(255, 255, 255, 255))
|
||||
|
||||
ui.pausebehavior(0)
|
||||
ui.interact(suppress_underlay=True, suppress_overlay=True)
|
||||
|
||||
renpy.load(save)
|
||||
|
||||
return
|
||||
|
||||
init -1001:
|
||||
image text = renpy.ParameterizedText(style="centered_text")
|
||||
|
||||
# Lock the library object.
|
||||
$ config.locked = True
|
||||
|
||||
|
||||
# Implement config.default_fullscreen and config.default_text_cps.
|
||||
init 1180 python:
|
||||
|
||||
if not persistent._set_preferences:
|
||||
persistent._set_preferences = True
|
||||
|
||||
if config.default_fullscreen is not None:
|
||||
_preferences.fullscreen = config.default_fullscreen
|
||||
|
||||
if config.default_text_cps is not None:
|
||||
_preferences.text_cps = config.default_text_cps
|
||||
|
||||
if config.developer:
|
||||
|
||||
def _inspector(l):
|
||||
|
||||
ui.add("#000")
|
||||
ui.window(xmargin=20, ymargin=20, style='default')
|
||||
ui.vbox()
|
||||
|
||||
ui.text("Style Inspector")
|
||||
ui.text("")
|
||||
|
||||
|
||||
if not l:
|
||||
ui.text("Nothing to inspect.")
|
||||
|
||||
for depth, width, height, d in l:
|
||||
|
||||
s = d.style
|
||||
|
||||
while s:
|
||||
if s.name:
|
||||
break
|
||||
|
||||
if s.parent:
|
||||
s = style.get(s.parent)
|
||||
else:
|
||||
break
|
||||
|
||||
name = s.name[0] + "".join([ "[%r]" % i for i in s.name[1:] ])
|
||||
|
||||
ui.text(" " * depth + u" \u2022 " + d.__class__.__name__ + " : " + name + " (%dx%d)" % (width, height))
|
||||
|
||||
ui.text("")
|
||||
ui.text("(click to continue)")
|
||||
|
||||
ui.close()
|
||||
ui.saybehavior()
|
||||
ui.interact(suppress_overlay=True, suppress_underlay=True)
|
||||
|
||||
return
|
||||
|
||||
config.inspector = _inspector
|
||||
|
||||
##############################################################################
|
||||
# Code that originated in 00gamemenu.rpy
|
||||
init -1180 python:
|
||||
|
||||
######################################################################
|
||||
# First up, we define a bunch of configuration variable, which the
|
||||
# user can change.
|
||||
|
||||
# menus: Music to play when entering the game menu.
|
||||
config.game_menu_music = None
|
||||
|
||||
# menus: Sound played when entering the library without clicking a
|
||||
# button.
|
||||
config.enter_sound = None
|
||||
|
||||
# menus: Sound played when leaving the library without clicking a
|
||||
# button.
|
||||
config.exit_sound = None
|
||||
|
||||
# menus: Transition that occurs when entering the game menu.
|
||||
config.enter_transition = None
|
||||
|
||||
# menus: Transition that occurs when leaving the game menu.
|
||||
config.exit_transition = None
|
||||
|
||||
# menus: Transition that's used when going from one screen to another.
|
||||
config.intra_transition = None
|
||||
|
||||
# menus: Transition that's used when going from the main to the game
|
||||
# menu.
|
||||
config.main_game_transition = None
|
||||
|
||||
# menus: Transition that's used when going from the game to the main
|
||||
# menu.
|
||||
config.game_main_transition = None
|
||||
|
||||
# menus: Transition that's used at the end of the game, when returning
|
||||
# to the main menu.
|
||||
config.end_game_transition = None
|
||||
|
||||
# menus: Transition that's used at the end of the splash screen, when
|
||||
# it is shown.
|
||||
config.end_splash_transition = None
|
||||
|
||||
# Transition that's used after the game is loaded.
|
||||
config.after_load_transition = None
|
||||
|
||||
# basics: True if autosave should be used.
|
||||
config.has_autosave = True
|
||||
|
||||
# basics: True if quicksave has been enabled.
|
||||
config.has_quicksave = False
|
||||
|
||||
# A list of layers to clear when entering the main and game menus.
|
||||
config.clear_layers = [ ]
|
||||
|
||||
# The _window_subtitle used inside menus.
|
||||
config.menu_window_subtitle = ''
|
||||
|
||||
# The screen that we go to when entering the game menu.
|
||||
_game_menu_screen = None
|
||||
|
||||
style.error_root = Style(style.default)
|
||||
style.error_title = Style(style.default)
|
||||
style.error_body = Style(style.default)
|
||||
|
||||
def _show_exception(title, message):
|
||||
|
||||
ui.window(style='error_root')
|
||||
ui.vbox()
|
||||
|
||||
ui.text(title, style='error_title')
|
||||
ui.text("")
|
||||
ui.text(message, style='error_body')
|
||||
ui.text("")
|
||||
ui.text(_(u"Please click to continue."), style='error_body')
|
||||
|
||||
ui.close()
|
||||
|
||||
ui.saybehavior()
|
||||
|
||||
ui.interact()
|
||||
|
||||
|
||||
# Run at the end of init, to set up autosaving based on the user's
|
||||
# choices.
|
||||
init 1180 python:
|
||||
|
||||
if config.has_autosave:
|
||||
config.autosave_slots = 10
|
||||
else:
|
||||
config.autosave_frequency = None
|
||||
|
||||
label _enter_menu:
|
||||
python hide:
|
||||
renpy.movie_stop(only_fullscreen=True)
|
||||
renpy.take_screenshot((config.thumbnail_width, config.thumbnail_height))
|
||||
|
||||
renpy.context()._menu = True
|
||||
|
||||
# This may be changed, if we are already in the main menu.
|
||||
renpy.context().main_menu = False
|
||||
renpy.context_dynamic("main_menu")
|
||||
renpy.context_dynamic("_window_subtitle")
|
||||
renpy.context_dynamic("_window")
|
||||
|
||||
store.main_menu = False
|
||||
store._window_subtitle = config.menu_window_subtitle
|
||||
store._window = False
|
||||
|
||||
store.mouse_visible = True
|
||||
store.suppress_overlay = True
|
||||
ui.clear()
|
||||
|
||||
for i in config.clear_layers:
|
||||
renpy.scene(layer=i)
|
||||
|
||||
return
|
||||
|
||||
# Factored this all into one place, to make our lives a bit easier.
|
||||
label _enter_game_menu:
|
||||
call _enter_menu from _call__enter_menu_2
|
||||
|
||||
$ renpy.transition(config.enter_transition)
|
||||
|
||||
if renpy.has_label("enter_game_menu"):
|
||||
call expression "enter_game_menu" from _call_enter_game_menu_1
|
||||
|
||||
if config.game_menu_music:
|
||||
$ renpy.music.play(config.game_menu_music, if_changed=True)
|
||||
|
||||
return
|
||||
|
||||
# Entry points from the game into menu-space.
|
||||
label _game_menu(_game_menu_screen=_game_menu_screen):
|
||||
if not _game_menu_screen:
|
||||
return
|
||||
|
||||
$ renpy.play(config.enter_sound)
|
||||
|
||||
call _enter_game_menu from _call__enter_game_menu_0
|
||||
|
||||
if renpy.has_label("game_menu"):
|
||||
jump expression "game_menu"
|
||||
|
||||
jump expression _game_menu_screen
|
||||
|
||||
label _game_menu_save:
|
||||
call _enter_game_menu from _call__enter_game_menu_1
|
||||
|
||||
if renpy.has_label("_save_screen"):
|
||||
jump expression "_save_screen"
|
||||
else:
|
||||
jump expression "save_screen"
|
||||
|
||||
label _game_menu_load:
|
||||
call _enter_game_menu from _call__enter_game_menu_2
|
||||
|
||||
if renpy.has_label("_load_screen"):
|
||||
jump expression "_load_screen"
|
||||
else:
|
||||
jump expression "load_screen"
|
||||
|
||||
label _game_menu_preferences:
|
||||
call _enter_game_menu from _call__enter_game_menu_3
|
||||
|
||||
if renpy.has_label("_prefs_screen"):
|
||||
jump expression "_prefs_screen"
|
||||
else:
|
||||
jump expression "preferences_screen"
|
||||
|
||||
label _quit:
|
||||
$ renpy.quit()
|
||||
|
||||
label _return_skipping:
|
||||
$ config.skipping = "slow"
|
||||
jump _return
|
||||
|
||||
# Make some noise, then return.
|
||||
label _noisy_return:
|
||||
$ renpy.play(config.exit_sound)
|
||||
|
||||
# Return to the game.
|
||||
label _return:
|
||||
|
||||
if renpy.context().main_menu:
|
||||
$ renpy.transition(config.game_main_transition)
|
||||
jump _main_menu_screen
|
||||
|
||||
$ renpy.transition(config.exit_transition)
|
||||
|
||||
return
|
||||
|
||||
label _confirm_quit:
|
||||
call _enter_menu from _call__enter_menu_3
|
||||
|
||||
if renpy.has_label("confirm_quit"):
|
||||
jump expression "confirm_quit"
|
||||
elif renpy.has_label("_compat_confirm_quit"):
|
||||
jump expression "_compat_confirm_quit"
|
||||
else:
|
||||
jump expression "_quit_prompt"
|
||||
|
||||
|
||||
##############################################################################
|
||||
# Code that originated in 00mainmenu.rpy
|
||||
|
||||
init -1180 python hide:
|
||||
|
||||
# menus: Music to play at the main menu.
|
||||
config.main_menu_music = None
|
||||
|
||||
# advanced: Callbacks to run at start.
|
||||
config.start_callbacks = [ ]
|
||||
|
||||
|
||||
# This fixes up the context, if necessary, then calls the real
|
||||
# after_load.
|
||||
label _after_load:
|
||||
$ renpy.context()._menu = False
|
||||
|
||||
if config.after_load_transition:
|
||||
$ renpy.transition(config.after_load_transition, force=True)
|
||||
|
||||
if renpy.has_label("after_load"):
|
||||
jump expression "after_load"
|
||||
else:
|
||||
return
|
||||
|
||||
|
||||
# This is the true starting point of the program. Sssh... Don't
|
||||
# tell anyone.
|
||||
label _start:
|
||||
|
||||
python hide:
|
||||
renpy.context()._menu = False
|
||||
|
||||
for i in config.start_callbacks:
|
||||
i()
|
||||
|
||||
call _check_module from _call__check_module_1
|
||||
call _load_reload_game from _call__load_reload_game_1
|
||||
|
||||
scene black
|
||||
|
||||
if not _restart:
|
||||
$ ui.pausebehavior(0)
|
||||
$ ui.interact(suppress_underlay=True, suppress_overlay=True)
|
||||
|
||||
$ renpy.block_rollback()
|
||||
|
||||
$ _old_game_menu_screen = _game_menu_screen
|
||||
$ _game_menu_screen = None
|
||||
|
||||
if renpy.has_label("splashscreen") and not _restart:
|
||||
call expression "splashscreen" from _call_splashscreen_1
|
||||
|
||||
$ _game_menu_screen = _old_game_menu_screen
|
||||
$ del _old_game_menu_screen
|
||||
|
||||
$ renpy.block_rollback()
|
||||
|
||||
if config.main_menu_music:
|
||||
$ renpy.music.play(config.main_menu_music, if_changed=True)
|
||||
else:
|
||||
$ renpy.music.stop()
|
||||
|
||||
# Clean out any residual scene from the splashscreen.
|
||||
scene black
|
||||
|
||||
if _restart is None:
|
||||
$ renpy.transition(config.end_splash_transition)
|
||||
else:
|
||||
$ renpy.transition(_restart[0])
|
||||
jump expression _restart[1]
|
||||
|
||||
label _invoke_main_menu:
|
||||
|
||||
if _restart:
|
||||
$ renpy.call_in_new_context(_restart[2])
|
||||
else:
|
||||
$ renpy.call_in_new_context("_main_menu")
|
||||
|
||||
|
||||
# If the main menu returns, then start the game.
|
||||
jump start
|
||||
|
||||
# At this point, we've been switched into a new context. So we
|
||||
# initialize it.
|
||||
label _main_menu(_main_menu_screen="_main_menu_screen"):
|
||||
|
||||
call _enter_menu from _call__enter_menu_1
|
||||
|
||||
python:
|
||||
renpy.dynamic("_load_prompt")
|
||||
_load_prompt = False
|
||||
|
||||
renpy.context().main_menu = True
|
||||
store.main_menu = True
|
||||
|
||||
jump expression _main_menu_screen
|
||||
|
||||
# This is called to show the main menu to the user.
|
||||
label _main_menu_screen:
|
||||
|
||||
# Let the user completely override the main menu. (But please note
|
||||
# it still lives in the menu context, rather than the game context.)
|
||||
if renpy.has_label("main_menu"):
|
||||
jump expression "main_menu"
|
||||
|
||||
# New name.
|
||||
if renpy.has_label("main_menu_screen"):
|
||||
jump expression "main_menu_screen"
|
||||
|
||||
# Compatibility name.
|
||||
if renpy.has_label("_library_main_menu"):
|
||||
jump expression "_library_main_menu"
|
||||
|
||||
return
|
||||
@@ -0,0 +1,46 @@
|
||||
# Copyright 2008 PyTom
|
||||
#
|
||||
# Please see the LICENSE.txt distributed with Ren'Py for permission to
|
||||
# copy and modify.
|
||||
|
||||
# Common stuff that's used by the various Ren'Py menus. This includes
|
||||
# the default definitions of config.main_menu and config.game_menu, as
|
||||
# well as the default definitions of the various preferences (and the objects
|
||||
# holding those preferences)
|
||||
|
||||
init -1150 python:
|
||||
|
||||
config.main_menu = [
|
||||
(u"Start Game", "start", "True"),
|
||||
(u"Load Game", _intra_jumps("load_screen", "main_game_transition"), "True"),
|
||||
(u"Preferences", _intra_jumps("preferences_screen", "main_game_transition"), "True"),
|
||||
(u"Help", _help, "True", "config.help"),
|
||||
(u"Quit", ui.jumps("_quit"), "True"),
|
||||
]
|
||||
|
||||
config.game_menu = [
|
||||
( None, u"Return", ui.jumps("_return"), 'True'),
|
||||
( "preferences", u"Preferences", _intra_jumps("preferences_screen", "intra_transition"), 'True' ),
|
||||
( "save", u"Save Game", _intra_jumps("save_screen", "intra_transition"), 'not main_menu' ),
|
||||
( "load", u"Load Game", _intra_jumps("load_screen", "intra_transition"), 'True'),
|
||||
( None, u"Main Menu", ui.callsinnewcontext("_main_menu_prompt"), 'not main_menu' ),
|
||||
( "help", u"Help", _help, "True", "config.help"),
|
||||
( None, u"Quit", ui.callsinnewcontext("_quit_prompt"), 'True' ),
|
||||
]
|
||||
|
||||
label _quit_prompt:
|
||||
$ renpy.loadsave.force_autosave()
|
||||
|
||||
if layout.yesno_prompt(None, u"Are you sure you want to quit?"):
|
||||
jump _quit
|
||||
else:
|
||||
return
|
||||
|
||||
label _main_menu_prompt:
|
||||
if layout.yesno_prompt(None, u"Are you sure you want to return to the main menu?\nThis will lose unsaved progress."):
|
||||
$ renpy.full_restart(transition=config.game_main_transition)
|
||||
else:
|
||||
return
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
# This file contains code that sets up the various mixers, based on how
|
||||
# the user sets config.has_music, .has_sound, and .has_voice.
|
||||
|
||||
init -1130 python hide:
|
||||
|
||||
# Set to true in the very unlikely event you want to manually init
|
||||
# the sound system.
|
||||
config.force_sound = False
|
||||
|
||||
# basics: True if the game will have music.
|
||||
config.has_music = True
|
||||
|
||||
# basics: True if the game will have sound effects.
|
||||
config.has_sound = True
|
||||
|
||||
# Register 8 channels by default, for compatiblity with older version
|
||||
# of Ren'Py.
|
||||
for i in xrange(0, 8):
|
||||
renpy.music.register_channel(i)
|
||||
|
||||
renpy.music.register_channel("movie", "music", False, stop_on_mute=False)
|
||||
|
||||
# Set up default names for some of the channels.
|
||||
renpy.music.alias_channel(0, "sound")
|
||||
renpy.music.alias_channel(7, "music")
|
||||
renpy.music.alias_channel(2, "voice")
|
||||
|
||||
init 1130:
|
||||
|
||||
python hide:
|
||||
|
||||
if not config.has_music and not config.has_sound:
|
||||
mixers = None
|
||||
|
||||
elif not config.has_music and config.has_sound:
|
||||
mixers = [ 'sfx' ] * 8
|
||||
|
||||
elif config.has_music and not config.has_sound:
|
||||
mixers = [ 'music' ] * 8
|
||||
|
||||
else:
|
||||
mixers = [ 'sfx' ] * 3 + [ 'music' ] * 5
|
||||
|
||||
if config.has_voice:
|
||||
if not mixers:
|
||||
mixers = [ 'voice' ] * 8
|
||||
else:
|
||||
mixers[2] = 'voice'
|
||||
|
||||
if not mixers:
|
||||
config.sound = config.force_sound
|
||||
|
||||
else:
|
||||
for i, m in enumerate(mixers):
|
||||
renpy.sound.set_mixer(i, m, default=True)
|
||||
if m == 'music':
|
||||
renpy.music.set_music(i, True, default=True)
|
||||
else:
|
||||
renpy.music.set_music(i, False, default=True)
|
||||
|
||||
@@ -0,0 +1,334 @@
|
||||
# This is an implementation of NVL-mode, which can be used to show
|
||||
# dialogue in a fullscreen way, like NVL-style games. Multiple lines
|
||||
# of dialogue are shown on the screen at once, whenever a line of
|
||||
# dialogue is said by a NVLCharacter. Calling the nvl_clear function
|
||||
# clears the screen, ensuring that the the next line will appear at
|
||||
# the top of the screen.
|
||||
#
|
||||
# You can also have menus appear on the screen, by running:
|
||||
#
|
||||
# init:
|
||||
# $ menu = nvl_menu
|
||||
#
|
||||
# It's also possible to make the narrator a NVLCharacter, using code like:
|
||||
#
|
||||
# init:
|
||||
# $ narrator = NVLCharacter(None)
|
||||
|
||||
##############################################################################
|
||||
# The implementation of NVL mode lives below this line.
|
||||
|
||||
init -1100 python:
|
||||
|
||||
# Styles that are used by nvl mode.
|
||||
style.create('nvl_window', 'default', 'the window containing nvl-mode dialogue')
|
||||
style.create('nvl_vbox', 'vbox', 'the vbox containing each box of nvl-mode dialogue')
|
||||
style.create('nvl_label', 'say_label', 'an nvl-mode character\'s name')
|
||||
style.create('nvl_dialogue', 'say_dialogue', 'nvl-mode character dialogue')
|
||||
style.create('nvl_entry', 'default', 'a window containing each line of nvl-mode dialogue')
|
||||
|
||||
style.create('nvl_menu_window', 'default', 'a window containing an nvl-mode menu')
|
||||
style.create('nvl_menu_choice', 'default', 'an nvl-mode menu choice')
|
||||
style.create('nvl_menu_choice_chosen', 'nvl_menu_choice', 'an nvl-mode menu choice that has been chosen')
|
||||
style.create('nvl_menu_choice_button', 'default', 'an nvl-mode choice button')
|
||||
style.create('nvl_menu_choice_chosen_button', 'nvl_menu_choice_button', 'an nvl-mode choice button that\'s been chosen.')
|
||||
|
||||
# Set up nvl mode styles.
|
||||
style.nvl_label.minwidth = 150
|
||||
style.nvl_label.text_align = 1.0
|
||||
|
||||
style.nvl_window.background = "#0008"
|
||||
style.nvl_window.yfill = True
|
||||
style.nvl_window.xfill = True
|
||||
style.nvl_window.xpadding = 20
|
||||
style.nvl_window.ypadding = 30
|
||||
|
||||
style.nvl_vbox.box_spacing = 10
|
||||
|
||||
style.nvl_menu_choice.idle_color = "#0ff"
|
||||
style.nvl_menu_choice.hover_color = "#ff0"
|
||||
style.nvl_menu_choice_button.left_margin = 160
|
||||
style.nvl_menu_choice_button.right_margin = 20
|
||||
style.nvl_menu_choice_button.xfill = True
|
||||
style.nvl_menu_choice_button.hover_background = "#F0F2"
|
||||
|
||||
# nvlmode: The CTC indicator to use when at the end of an NVL page.
|
||||
config.nvl_page_ctc = None
|
||||
|
||||
# nvlmode: The position of the CTC indicator used at the end of an NVL page.
|
||||
config.nvl_page_ctc_position = "nestled"
|
||||
|
||||
# Should we used paged rollback?
|
||||
config.nvl_paged_rollback = False
|
||||
|
||||
# A hook that delta wanted, that is called instead of renpy.show_display_say
|
||||
config.nvl_show_display_say = renpy.show_display_say
|
||||
|
||||
# A list of arguments that have been passed to nvl_record_show.
|
||||
nvl_list = None
|
||||
|
||||
# If set, then all of the nvl-specific style get indexed with this.
|
||||
nvl_variant = None
|
||||
|
||||
# Returns the appropriate variant style.
|
||||
def __s(s):
|
||||
if nvl_variant:
|
||||
return s[nvl_variant]
|
||||
else:
|
||||
return s
|
||||
|
||||
def nvl_show_core():
|
||||
|
||||
if renpy.in_rollback():
|
||||
nvl_window = __s(style.nvl_window)['rollback']
|
||||
nvl_vbox = __s(style.nvl_vbox)['rollback']
|
||||
else:
|
||||
nvl_window = __s(style.nvl_window)
|
||||
nvl_vbox = __s(style.nvl_vbox)
|
||||
|
||||
ui.window(style=nvl_window)
|
||||
ui.vbox(style=nvl_vbox)
|
||||
|
||||
rv = None
|
||||
|
||||
for i in nvl_list:
|
||||
if not i:
|
||||
continue
|
||||
|
||||
who, what, kw = i
|
||||
rv = config.nvl_show_display_say(who, what, variant=nvl_variant, **kw)
|
||||
|
||||
ui.close()
|
||||
|
||||
renpy.shown_window()
|
||||
|
||||
return rv
|
||||
|
||||
def nvl_window():
|
||||
nvl_show_core()
|
||||
|
||||
def nvl_show(with_):
|
||||
nvl_show_core()
|
||||
renpy.with_statement(with_)
|
||||
|
||||
def nvl_hide(with_):
|
||||
nvl_show_core()
|
||||
renpy.with_statement(None)
|
||||
renpy.with_statement(with_)
|
||||
|
||||
def nvl_erase():
|
||||
if nvl_list:
|
||||
nvl_list.pop()
|
||||
|
||||
# Check to see if one of the next statements is nvl clear.
|
||||
def nvl_clear_next():
|
||||
|
||||
# The number of statements forward to look.
|
||||
count = 10
|
||||
|
||||
scry = renpy.scry()
|
||||
scry = scry.next()
|
||||
|
||||
while count and scry:
|
||||
|
||||
count -= 1
|
||||
if scry.nvl_clear:
|
||||
return True
|
||||
|
||||
if scry.interacts:
|
||||
return False
|
||||
|
||||
scry = scry.next()
|
||||
|
||||
|
||||
class NVLCharacter(ADVCharacter):
|
||||
|
||||
def __init__(self,
|
||||
who=renpy.character.NotSet,
|
||||
kind=None,
|
||||
**properties):
|
||||
|
||||
if kind is None:
|
||||
kind = store.nvl
|
||||
|
||||
if "clear" in properties:
|
||||
self.clear = properties.pop("clear")
|
||||
else:
|
||||
self.clear = kind.clear
|
||||
|
||||
ADVCharacter.__init__(
|
||||
self,
|
||||
who,
|
||||
kind=kind,
|
||||
**properties)
|
||||
|
||||
def do_add(self, who, what):
|
||||
if store.nvl_list is None:
|
||||
store.nvl_list = [ ]
|
||||
|
||||
kwargs = self.show_args.copy()
|
||||
kwargs["what_args"] = self.what_args
|
||||
kwargs["who_args"] = self.who_args
|
||||
kwargs["window_args"] = self.window_args
|
||||
|
||||
store.nvl_list.append((who, what, kwargs))
|
||||
|
||||
def do_display(self, who, what, **display_args):
|
||||
|
||||
page = self.clear or nvl_clear_next()
|
||||
|
||||
if config.nvl_page_ctc and page:
|
||||
display_args["ctc"] = config.nvl_page_ctc
|
||||
display_args["ctc_position"] = config.nvl_page_ctc_position
|
||||
|
||||
if config.nvl_paged_rollback:
|
||||
if page:
|
||||
checkpoint = True
|
||||
else:
|
||||
if renpy.in_rollback():
|
||||
return
|
||||
checkpoint = False
|
||||
else:
|
||||
checkpoint = True
|
||||
|
||||
renpy.display_say(nvl_show_core,
|
||||
checkpoint=checkpoint,
|
||||
**display_args)
|
||||
|
||||
def do_done(self, who, what):
|
||||
|
||||
if self.clear:
|
||||
nvl_clear()
|
||||
|
||||
def do_extend(self):
|
||||
store.nvl_list = store.nvl_list[:-1]
|
||||
|
||||
# The default NVLCharacter.
|
||||
nvl = NVLCharacter(
|
||||
show_say_vbox_properties={ 'box_layout' : 'horizontal' },
|
||||
who_style='nvl_label',
|
||||
what_style='nvl_dialogue',
|
||||
window_style='nvl_entry',
|
||||
type='nvl',
|
||||
clear=False,
|
||||
kind=adv)
|
||||
|
||||
def nvl_clear():
|
||||
store.nvl_list = [ ]
|
||||
|
||||
# Run clear at the start of the game.
|
||||
config.start_callbacks.append(nvl_clear)
|
||||
|
||||
def nvl_menu(items):
|
||||
|
||||
if nvl_list is None:
|
||||
store.nvl_list = [ ]
|
||||
|
||||
ui.layer("transient")
|
||||
ui.clear()
|
||||
ui.close()
|
||||
|
||||
ui.window(style=__s(style.nvl_window))
|
||||
ui.vbox(style=__s(style.nvl_vbox))
|
||||
|
||||
for i in nvl_list:
|
||||
if not i:
|
||||
continue
|
||||
|
||||
who, what, kw = i
|
||||
rv = renpy.show_display_say(who, what, **kw)
|
||||
|
||||
renpy.display_menu(items, interact=False,
|
||||
window_style=__s(style.nvl_menu_window),
|
||||
choice_style=__s(style.nvl_menu_choice),
|
||||
choice_chosen_style=__s(style.nvl_menu_choice_chosen),
|
||||
choice_button_style=__s(style.nvl_menu_choice_button),
|
||||
choice_chosen_button_style=__s(style.nvl_menu_choice_chosen_button),
|
||||
)
|
||||
|
||||
ui.close()
|
||||
|
||||
roll_forward = renpy.roll_forward_info()
|
||||
|
||||
rv = ui.interact(roll_forward=roll_forward)
|
||||
renpy.checkpoint(rv)
|
||||
|
||||
return rv
|
||||
|
||||
config.nvl_adv_transition = None
|
||||
config.adv_nvl_transition = None
|
||||
|
||||
init 1140 python:
|
||||
|
||||
if config.nvl_adv_transition or config.adv_nvl_transition:
|
||||
|
||||
def _nvl_adv_callback(event, interact, type, **kwargs):
|
||||
|
||||
if event != "begin" or not interact or renpy.get_transition():
|
||||
return
|
||||
|
||||
old_type = renpy.last_interact_type()
|
||||
|
||||
if old_type == "say" and type == "nvl":
|
||||
# We have an extra line in the nvl_list as we do this. So
|
||||
# take it out for the duration of the nvl_show.
|
||||
old_nvl_list = store.nvl_list
|
||||
store.nvl_list = old_nvl_list[:-1]
|
||||
nvl_show(config.adv_nvl_transition)
|
||||
store.nvl_list = old_nvl_list
|
||||
elif old_type == "nvl" and type == "say":
|
||||
nvl_hide(config.nvl_adv_transition)
|
||||
|
||||
config.all_character_callbacks.insert(0, _nvl_adv_callback)
|
||||
|
||||
|
||||
python early hide:
|
||||
|
||||
def parse_nvl_show_hide(l):
|
||||
rv = l.simple_expression()
|
||||
if rv is None:
|
||||
renpy.error('expected simple expression')
|
||||
|
||||
if not l.eol():
|
||||
renpy.error('expected end of line')
|
||||
|
||||
return rv
|
||||
|
||||
def lint_nvl_show_hide(trans):
|
||||
_try_eval(trans, 'transition')
|
||||
|
||||
def execute_nvl_show(trans):
|
||||
nvl_show(eval(trans))
|
||||
|
||||
def execute_nvl_hide(trans):
|
||||
nvl_hide(eval(trans))
|
||||
|
||||
renpy.statements.register("nvl show",
|
||||
parse=parse_nvl_show_hide,
|
||||
execute=execute_nvl_show,
|
||||
lint=lint_nvl_show_hide)
|
||||
|
||||
renpy.statements.register("nvl hide",
|
||||
parse=parse_nvl_show_hide,
|
||||
execute=execute_nvl_hide,
|
||||
lint=lint_nvl_show_hide)
|
||||
|
||||
def parse_nvl_clear(l):
|
||||
if not l.eol():
|
||||
renpy.error('expected end of line')
|
||||
|
||||
return None
|
||||
|
||||
def execute_nvl_clear(parse):
|
||||
nvl_clear()
|
||||
|
||||
def scry_nvl_clear(parse, scry):
|
||||
scry.nvl_clear = True
|
||||
|
||||
renpy.statements.register('nvl clear',
|
||||
parse=parse_nvl_clear,
|
||||
execute=execute_nvl_clear,
|
||||
scry=scry_nvl_clear)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
# This file contains the spline motion code contributed by Aenakume, at
|
||||
# http://lemmasoft.renai.us/forums/viewtopic.php?f=8&t=3977
|
||||
|
||||
init -1080 python:
|
||||
class _SplineInterpolator(object):
|
||||
|
||||
ANCHORS = {
|
||||
'top' : 0.0,
|
||||
'center' : 0.5,
|
||||
'bottom' : 1.0,
|
||||
'left' : 0.0,
|
||||
'right' : 1.0,
|
||||
}
|
||||
|
||||
def __init__(self, points, anchors=(0.5, 0.5)):
|
||||
|
||||
assert len(points) >= 2, "Need at least a start and end point."
|
||||
|
||||
def setup_coordinate_(c):
|
||||
if len(c) == 2:
|
||||
c += anchors
|
||||
return [ self.ANCHORS.get(i, i) for i in c ]
|
||||
|
||||
self.points = []
|
||||
|
||||
for p in points:
|
||||
length = len(p)
|
||||
|
||||
if isinstance(p[-1], float):
|
||||
length = len(p) - 1
|
||||
point = [ p[-1] ]
|
||||
else:
|
||||
length = len(p)
|
||||
point = [ -1 ]
|
||||
|
||||
self.points.append(point + [ setup_coordinate_(p[i]) for i in range(length) ])
|
||||
|
||||
# Make sure start and end times are set, if not already set
|
||||
if self.points[0][0] == -1:
|
||||
self.points[0][0] = 0.0
|
||||
if self.points[-1][0] == -1:
|
||||
self.points[-1][0] = 1.0
|
||||
|
||||
# Now we gotta calculate the step times that need calculating
|
||||
for start in range(1, len(self.points) - 1):
|
||||
if self.points[start][0] != -1:
|
||||
continue
|
||||
|
||||
end = start + 1
|
||||
|
||||
while end < (len(self.points) - 1) and self.points[end][0] == -1:
|
||||
end += 1
|
||||
|
||||
step = (self.points[end][0] - self.points[start - 1][0]) / float(end - start + 1)
|
||||
|
||||
for i in range(start, end):
|
||||
self.points[i][0] = self.points[i - 1][0] + step
|
||||
|
||||
# And finally, sort the list of points by increasing time
|
||||
self.points.sort(key=lambda a : a[0])
|
||||
|
||||
self.initialized = None
|
||||
|
||||
def init_values(self, sizes):
|
||||
def to_abs_(value, size):
|
||||
if isinstance(value, float):
|
||||
return value * size
|
||||
else:
|
||||
return value
|
||||
|
||||
def coord_(c):
|
||||
return ( to_abs_(c[0], sizes[0]) - to_abs_(c[2], sizes[2]),
|
||||
to_abs_(c[1], sizes[1]) - to_abs_(c[3], sizes[3]) )
|
||||
|
||||
for p in self.points:
|
||||
for i in range(1, len(p)):
|
||||
p[i] = coord_(p[i])
|
||||
|
||||
self.initialized = sizes
|
||||
|
||||
def __call__(self, t, sizes):
|
||||
# Initialize if necessary
|
||||
if not self.initialized == sizes:
|
||||
self.init_values(sizes)
|
||||
|
||||
# Now we must determine which segment we are in
|
||||
for segment in range(len(self.points)):
|
||||
if self.points[segment][0] > t:
|
||||
break
|
||||
|
||||
# If this is the zeroth segment, just start at the start point
|
||||
if segment == 0:
|
||||
result = self.points[0][1]
|
||||
# If this is past the last segment, just leave it at the end point
|
||||
elif segment == len(self.points) - 1 and t > self.points[-1][0]:
|
||||
result = self.points[-1][1]
|
||||
else:
|
||||
# Scale t
|
||||
t = (t - self.points[segment - 1][0]) / (self.points[segment][0] - self.points[segment - 1][0])
|
||||
|
||||
# Get start and end points
|
||||
start = self.points[segment - 1][1]
|
||||
end = self.points[segment][1]
|
||||
|
||||
# Now what kind of interpolation is it?
|
||||
if len(self.points[segment]) == 2: # Straight line
|
||||
t_p = 1.0 - t
|
||||
|
||||
result = [ t_p * start[i] + t * end[i] for i in 0,1 ]
|
||||
|
||||
elif len(self.points[segment]) == 3: # Quadratic Bezier
|
||||
t_pp = (1.0 - t)**2
|
||||
t_p = 2 * t * (1.0 - t)
|
||||
t2 = t**2
|
||||
|
||||
result = [ t_pp * start[i] + t_p * self.points[segment][2][i] + t2 * end[i] for i in 0,1 ]
|
||||
|
||||
elif len(self.points[segment]) == 4: # Cubic Bezier
|
||||
t_ppp = (1.0 - t)**3
|
||||
t_pp = 3 * t * (1.0 - t)**2
|
||||
t_p = 3 * t**2 * (1.0 - t)
|
||||
t3 = t**3
|
||||
|
||||
result = [ t_ppp * start[i] + t_pp * self.points[segment][2][i] + t_p * self.points[segment][3][i] + t3 * end[i] for i in 0,1 ]
|
||||
|
||||
return ( int(result[0]), int(result[1]), 0, 0 )
|
||||
|
||||
def SplineMotion(points, time, child=None, anchors=(0.5, 0.5), repeat=False, bounce=False, anim_timebase=False, style='default', time_warp=None, **properties):
|
||||
return Motion(_SplineInterpolator(points, anchors), time, child, repeat=repeat, bounce=bounce, anim_timebase=anim_timebase, style=style, time_warp=time_warp, add_sizes=True, **properties)
|
||||
|
||||
|
||||
@@ -0,0 +1,386 @@
|
||||
# This file contains code that creates a few new statements. We'll
|
||||
# also describe here the API for defining your own statements.
|
||||
#
|
||||
# Statements can be defined by calling renpy.statements.register. This
|
||||
# function takes a string giving the keywords at the start of the
|
||||
# statement, and then up to 4 functions defining the behavior of the
|
||||
# statement: parse, execute, predict, and lint
|
||||
#
|
||||
# The parse function takes a lexer object as an argument, and is
|
||||
# expected to return some parser data. The lexer has the following
|
||||
# methods.
|
||||
#
|
||||
# l.eol() - True if we are at the end of the line.
|
||||
# l.match(re) - Matches an arbitrary regexp string.
|
||||
# l.keyword(s) - Matches s.
|
||||
# l.name() - Matches any non-keyword name. Note that this only
|
||||
# counts built-in keywords.
|
||||
# l.word() - Matches any word, period.
|
||||
# l.string() - Matches a renpy string.
|
||||
# l.integer() - Matches an integer, returns a string containing the
|
||||
# integer.
|
||||
# l.float() - Matches a floating point number.
|
||||
# l.simple_expression() - Matches a simple python expression, returns
|
||||
# it as a string.
|
||||
# l.rest() - Skips whitespace, then returns the rest of the line.
|
||||
# l.checkpoint() - Returns an opaque object representing the current
|
||||
# point in the parse.
|
||||
# l.revert(o) - Given the object returned by l.checkpoint(), returns
|
||||
# there.
|
||||
#
|
||||
# The parse function is expected to return an object, which is passed
|
||||
# to the other functions. Parse should call renpy.error with the error
|
||||
# message to report an error.
|
||||
#
|
||||
# The execute function is passed the object returned from parse, and
|
||||
# is expected to execute the statement.
|
||||
#
|
||||
# The predict function is passed the object returned from parse, and
|
||||
# is expected to return a list of images that are used by the
|
||||
# statement.
|
||||
#
|
||||
# The lint function is called at lint time, after the init code is
|
||||
# run. It should check the statement for errors, and report them by
|
||||
# calling renpy.error with the appropriate error message.
|
||||
#
|
||||
# The scry function is called with a scry object. It may mutate that
|
||||
# object, but it is then expected to return it. See 00nvlmode.rpy for
|
||||
# details.
|
||||
#
|
||||
# The next function is expected to return a string giving the label of
|
||||
# the next statement to execute, or None to indicate that next
|
||||
# statement in the block should be executed. The next function is
|
||||
# called during predict, scry, and execute, and should always return
|
||||
# the same value. (Or scrying may be incorrect.)
|
||||
|
||||
|
||||
python early hide:
|
||||
|
||||
# Music play - The example of a full statement.
|
||||
|
||||
def parse_play_music(l):
|
||||
|
||||
file = l.simple_expression()
|
||||
if not file:
|
||||
renpy.error("play requires a file")
|
||||
|
||||
fadeout = "None"
|
||||
fadein = "0"
|
||||
channel = None
|
||||
|
||||
while True:
|
||||
|
||||
if l.eol():
|
||||
break
|
||||
|
||||
if l.keyword('fadeout'):
|
||||
fadeout = l.simple_expression()
|
||||
if fadeout is None:
|
||||
renpy.error('expected simple expression')
|
||||
|
||||
continue
|
||||
|
||||
if l.keyword('fadein'):
|
||||
fadein = l.simple_expression()
|
||||
if fadein is None:
|
||||
renpy.error('expected simple expression')
|
||||
|
||||
continue
|
||||
|
||||
if l.keyword('channel'):
|
||||
channel = l.simple_expression()
|
||||
if channel is None:
|
||||
renpy.error('expected simple expression')
|
||||
|
||||
continue
|
||||
|
||||
renpy.error('could not parse statement.')
|
||||
|
||||
return dict(file=file,
|
||||
fadeout=fadeout,
|
||||
fadein=fadein,
|
||||
channel=channel)
|
||||
|
||||
def execute_play_music(p):
|
||||
|
||||
if p["channel"] is not None:
|
||||
channel = eval(p["channel"])
|
||||
else:
|
||||
channel = 7
|
||||
|
||||
renpy.music.play(eval(p["file"]),
|
||||
fadeout=eval(p["fadeout"]),
|
||||
fadein=eval(p["fadein"]),
|
||||
channel=channel)
|
||||
|
||||
def predict_play_music(p):
|
||||
return [ ]
|
||||
|
||||
def lint_play_music(p):
|
||||
|
||||
file = _try_eval(p["file"], 'filename')
|
||||
if p["channel"] is not None:
|
||||
_try_eval(p["channel"], 'channel')
|
||||
|
||||
if not isinstance(file, list):
|
||||
file = [ file ]
|
||||
|
||||
for fn in file:
|
||||
if isinstance(fn, basestring) and not renpy.loadable(fn):
|
||||
renpy.error("%r is not loadable" % fn)
|
||||
|
||||
renpy.statements.register('play music',
|
||||
parse=parse_play_music,
|
||||
execute=execute_play_music,
|
||||
predict=predict_play_music,
|
||||
lint=lint_play_music)
|
||||
|
||||
# From here on, we'll steal bits of other statements when defining other
|
||||
# statements.
|
||||
|
||||
def parse_queue_music(l):
|
||||
|
||||
file = l.simple_expression()
|
||||
if not file:
|
||||
renpy.error("queue requires a file")
|
||||
|
||||
channel = None
|
||||
|
||||
if l.keyword('channel'):
|
||||
channel = l.simple_expression()
|
||||
if channel is None:
|
||||
renpy.error('expected simple expression')
|
||||
|
||||
if not l.eol():
|
||||
renpy.error("expected end of line")
|
||||
|
||||
return dict(file=file, channel=channel)
|
||||
|
||||
def execute_queue_music(p):
|
||||
if p["channel"] is not None:
|
||||
channel = eval(p["channel"])
|
||||
else:
|
||||
channel = 7
|
||||
|
||||
renpy.music.queue(eval(p["file"]), channel=channel)
|
||||
|
||||
renpy.statements.register('queue music',
|
||||
parse=parse_queue_music,
|
||||
execute=execute_queue_music,
|
||||
lint=lint_play_music)
|
||||
|
||||
def parse_stop_music(l):
|
||||
fadeout = "None"
|
||||
|
||||
if l.keyword("fadeout"):
|
||||
fadeout = l.simple_expression()
|
||||
|
||||
channel = None
|
||||
|
||||
if l.keyword('channel'):
|
||||
channel = l.simple_expression()
|
||||
if channel is None:
|
||||
renpy.error('expected simple expression')
|
||||
|
||||
if not l.eol():
|
||||
renpy.error('expected end of line')
|
||||
|
||||
if fadeout is None:
|
||||
renpy.error('expected simple expression')
|
||||
|
||||
return dict(fadeout=fadeout, channel=channel)
|
||||
|
||||
def execute_stop_music(p):
|
||||
if p["channel"] is not None:
|
||||
channel = eval(p["channel"])
|
||||
else:
|
||||
channel = 7
|
||||
|
||||
renpy.music.stop(fadeout=eval(p["fadeout"]), channel=channel)
|
||||
|
||||
renpy.statements.register('stop music',
|
||||
parse=parse_stop_music,
|
||||
execute=execute_stop_music)
|
||||
|
||||
|
||||
# Sound statements. They share alot with the equivalent music
|
||||
# statements.
|
||||
|
||||
def execute_play_sound(p):
|
||||
|
||||
if p["channel"] is not None:
|
||||
channel = eval(p["channel"])
|
||||
else:
|
||||
channel = 0
|
||||
|
||||
fadeout = eval(p["fadeout"]) or 0
|
||||
|
||||
renpy.sound.play(eval(p["file"]),
|
||||
fadeout=fadeout,
|
||||
fadein=eval(p["fadein"]),
|
||||
channel=channel)
|
||||
|
||||
renpy.statements.register('play sound',
|
||||
parse=parse_play_music,
|
||||
execute=execute_play_sound,
|
||||
lint=lint_play_music)
|
||||
|
||||
def execute_queue_sound(p):
|
||||
if p["channel"] is not None:
|
||||
channel = eval(p["channel"])
|
||||
else:
|
||||
channel = 0
|
||||
|
||||
renpy.sound.queue(eval(p["file"]), channel=channel)
|
||||
|
||||
|
||||
renpy.statements.register('queue sound',
|
||||
parse=parse_queue_music,
|
||||
execute=execute_queue_sound,
|
||||
lint=lint_play_music)
|
||||
|
||||
def execute_stop_sound(p):
|
||||
if p["channel"] is not None:
|
||||
channel = eval(p["channel"])
|
||||
else:
|
||||
channel = 0
|
||||
|
||||
fadeout = eval(p["fadeout"]) or 0
|
||||
|
||||
renpy.sound.stop(fadeout=fadeout, channel=channel)
|
||||
|
||||
renpy.statements.register('stop sound',
|
||||
parse=parse_stop_music,
|
||||
execute=execute_stop_sound)
|
||||
|
||||
|
||||
# Generic play/queue/stop statements. These take a channel name as
|
||||
# the second thing.
|
||||
|
||||
def parse_play_generic(l, parse_play_music=parse_play_music):
|
||||
channel = l.name()
|
||||
|
||||
if channel is None:
|
||||
renpy.error('play requires a channel')
|
||||
|
||||
rv = parse_play_music(l)
|
||||
if rv["channel"] is None:
|
||||
rv["channel"] = repr(channel)
|
||||
|
||||
return rv
|
||||
|
||||
def parse_queue_generic(l, parse_queue_music=parse_queue_music):
|
||||
channel = l.name()
|
||||
|
||||
if channel is None:
|
||||
renpy.error('queue requires a channel')
|
||||
|
||||
rv = parse_queue_music(l)
|
||||
if rv["channel"] is None:
|
||||
rv["channel"] = repr(channel)
|
||||
|
||||
return rv
|
||||
|
||||
def parse_stop_generic(l, parse_stop_music=parse_stop_music):
|
||||
channel = l.name()
|
||||
|
||||
if channel is None:
|
||||
renpy.error('stop requires a channel')
|
||||
|
||||
rv = parse_stop_music(l)
|
||||
if rv["channel"] is None:
|
||||
rv["channel"] = repr(channel)
|
||||
|
||||
return rv
|
||||
|
||||
def lint_play_generic(p, lint_play_music=lint_play_music):
|
||||
channel = eval(p["channel"])
|
||||
|
||||
if not renpy.music.channel_defined(channel):
|
||||
renpy.error("channel %r is not defined" % channel)
|
||||
|
||||
lint_play_music(p)
|
||||
|
||||
def lint_stop_generic(p):
|
||||
channel = eval(p["channel"])
|
||||
|
||||
if not renpy.music.channel_defined(channel):
|
||||
renpy.error("channel %r is not defined" % channel)
|
||||
|
||||
renpy.statements.register('play',
|
||||
parse=parse_play_generic,
|
||||
execute=execute_play_music,
|
||||
predict=predict_play_music,
|
||||
lint=lint_play_generic)
|
||||
|
||||
renpy.statements.register('queue',
|
||||
parse=parse_queue_generic,
|
||||
execute=execute_queue_music,
|
||||
lint=lint_play_generic)
|
||||
|
||||
renpy.statements.register('stop',
|
||||
parse=parse_stop_generic,
|
||||
execute=execute_stop_music,
|
||||
lint=lint_stop_generic)
|
||||
|
||||
|
||||
# The "window show" and "window hide" statements.
|
||||
def parse_window(l):
|
||||
p = l.simple_expression()
|
||||
if not l.eol():
|
||||
renpy.error('expected end of line')
|
||||
|
||||
return p
|
||||
|
||||
def lint_window(p):
|
||||
if p is not None:
|
||||
_try_eval(p, 'window transition')
|
||||
|
||||
def execute_window_show(p):
|
||||
if store._window:
|
||||
return
|
||||
|
||||
if p is not None:
|
||||
trans = eval(p)
|
||||
else:
|
||||
trans = config.window_show_transition
|
||||
|
||||
renpy.with_statement(None)
|
||||
store._window = True
|
||||
renpy.with_statement(trans)
|
||||
|
||||
def execute_window_hide(p):
|
||||
if not _window:
|
||||
return
|
||||
|
||||
if p is not None:
|
||||
trans = eval(p)
|
||||
else:
|
||||
trans = config.window_hide_transition
|
||||
|
||||
renpy.with_statement(None)
|
||||
store._window = False
|
||||
renpy.with_statement(trans)
|
||||
|
||||
renpy.statements.register('window show',
|
||||
parse=parse_window,
|
||||
execute=execute_window_show,
|
||||
lint=lint_window)
|
||||
|
||||
renpy.statements.register('window hide',
|
||||
parse=parse_window,
|
||||
execute=execute_window_hide,
|
||||
lint=lint_window)
|
||||
|
||||
|
||||
init -1200 python:
|
||||
|
||||
config.window_show_transition = None
|
||||
config.window_hide_transition = None
|
||||
|
||||
def _try_eval(e, what):
|
||||
try:
|
||||
return eval(e)
|
||||
except:
|
||||
renpy.error('unable to evaluate %s %r' % (what, e))
|
||||
|
||||
@@ -0,0 +1,311 @@
|
||||
# Copyright 2004-2008 PyTom
|
||||
#
|
||||
# Please see the LICENSE.txt distributed with Ren'Py for permission to
|
||||
# copy and modify.
|
||||
|
||||
# This file is responsible for creating and defining the default styles
|
||||
# used by the system.
|
||||
|
||||
# This file should be considered part of the Ren'Py library, and not
|
||||
# something that needs to be modified by the user. Instead, just update
|
||||
# the appropriate style property in an init: block in your script.
|
||||
#
|
||||
# For example, to change the default window backgrounds to a
|
||||
# transparent dark red, add:
|
||||
#
|
||||
# init:
|
||||
# $ style.window.background = "#8008"
|
||||
#
|
||||
# to your script. No need to mess around here, it will just make your
|
||||
# life harder when a new version of Ren'Py is released.
|
||||
|
||||
init -1200 python hide:
|
||||
|
||||
# Style Declarations #################################################
|
||||
|
||||
style.default = Style(None, help='root of style hierarchy')
|
||||
|
||||
style.hbox = Style(style.default, help='horizontal boxes')
|
||||
style.vbox = Style(style.default, help='vertical boxes')
|
||||
|
||||
style.window = Style(style.default, help='windows created with ui.window')
|
||||
|
||||
style.image_placement = Style(style.default, help='default placement of images on the screen')
|
||||
style.image = Style(style.default, help="default style of images")
|
||||
|
||||
style.motion = Style(style.default, help="default style of motions and zooms.")
|
||||
style.animation = Style(style.default, help="default style of animations.")
|
||||
|
||||
style.say_label = Style(style.default, help='the name of the character speaking dialogue.')
|
||||
style.say_dialogue = Style(style.default, help='used for dialogue text')
|
||||
style.say_thought = Style(style.default, help='used by the default narrator')
|
||||
style.say_window = Style(style.window, help='windows containing dialogue and thoughts')
|
||||
style.say_who_window = Style(style.window, help='window containing the label in two-window-say mode')
|
||||
style.say_two_window_vbox = Style(style.vbox, help='vbox containing the two windows in two-window-say mode')
|
||||
style.say_vbox = Style(style.vbox, help='contains the label (if present) and the body of dialogue')
|
||||
|
||||
style.menu = Style(style.default, help='the vbox containing an in-game menu')
|
||||
style.menu_caption = Style(style.default, help='in-game menu caption text')
|
||||
style.menu_choice = Style(style.default, help='text of an in-game menu choice')
|
||||
style.menu_choice_button = Style(style.default, help='buttons containing in-game menu choices')
|
||||
style.menu_choice_chosen = Style(style.menu_choice, help='text of an in-game menu choice that has been chosen')
|
||||
style.menu_choice_chosen_button = Style(style.menu_choice_button, help='buttons containing chosen in-game menu choices')
|
||||
style.menu_window = Style(style.window, help='a window containing a menu')
|
||||
|
||||
style.input_text = Style(style.default, help='text of an input box')
|
||||
style.input_prompt = Style(style.default, help='prompt of an input box')
|
||||
style.input_window = Style(style.window, help='window of an input box')
|
||||
|
||||
style.centered_window = Style(style.default, help='window containing centered text')
|
||||
style.centered_text = Style(style.default, help='centered text')
|
||||
|
||||
style.imagemap = Style(style.image_placement, help='default style of imagemaps')
|
||||
style.imagemap_button = Style(style.default, help='default style of buttons inside imagemaps')
|
||||
|
||||
style.image_button = Style(style.default, help='default style of image buttons')
|
||||
style.image_button_image = Style(style.default, help='default style of images inside image buttons')
|
||||
|
||||
style.hyperlink = Style(style.default, help=None) # ignored
|
||||
style.hyperlink_text = Style(style.default, help='hyperlinked text')
|
||||
|
||||
style.viewport = Style(style.default, help='default style of viewports')
|
||||
style.transform = Style(style.motion, help='default style of transforms')
|
||||
|
||||
style.list = Style(style.default)
|
||||
style.list_box = Style(style.vbox)
|
||||
style.list_row = Style(style.default)
|
||||
style.list_row_box = Style(style.hbox)
|
||||
style.list_spacer = Style(style.default)
|
||||
style.list_text = Style(style.default)
|
||||
|
||||
# The base styles that can be customized by themes.
|
||||
|
||||
style.frame = Style(style.default, help='base style for frames.')
|
||||
style.menu_frame = Style(style.frame, help='base style for frames used in the game and main menus.')
|
||||
|
||||
style.button = Style(style.default, help='base style for buttons.')
|
||||
style.button_text = Style(style.default, help='base style for button text')
|
||||
|
||||
style.small_button = Style(style.button, help="base style for small buttons")
|
||||
style.small_button_text = Style(style.button_text, help="base style for small button text")
|
||||
style.radio_button = Style(style.button, help="base style for radio buttons")
|
||||
style.radio_button_text = Style(style.button_text, help="base style for radio button text")
|
||||
style.check_button = Style(style.button, help="base style for check buttons")
|
||||
style.check_button_text = Style(style.button_text, help="base style for check button text")
|
||||
|
||||
style.large_button = Style(style.default, help="base style for large buttons")
|
||||
style.large_button_text = Style(style.default, help="base style for large button text")
|
||||
|
||||
style.label = Style(style.default, help="base style for windows surrounding labels")
|
||||
style.label_text = Style(style.default, help="base style for label text")
|
||||
|
||||
style.prompt = Style(style.default, help="base style for windows surrounding prompts")
|
||||
style.prompt_text = Style(style.default, help="base style for prompt text")
|
||||
|
||||
style.bar = Style(style.default, help='base style for horizontal bars')
|
||||
style.vbar = Style(style.default, help='base style for vertical bars')
|
||||
|
||||
style.slider = Style(style.default, help='base style for horizontal sliders')
|
||||
style.vslider = Style(style.default, help='base style for vertical sliders')
|
||||
|
||||
style.scrollbar = Style(style.default, help='base style for horizontal scrollbars')
|
||||
style.vscrollbar = Style(style.default, help='base style for vertical scollbars')
|
||||
|
||||
style.mm_root = Style(style.default, help="main menu root window")
|
||||
style.gm_root = Style(style.default, help="game menu root window")
|
||||
|
||||
|
||||
init -1090 python:
|
||||
|
||||
# Colors #############################################################
|
||||
|
||||
# The Default Style ###################################################
|
||||
|
||||
# Text properties.
|
||||
style.default.font = "DejaVuSans.ttf"
|
||||
style.default.language = "western"
|
||||
style.default.antialias = True
|
||||
style.default.size = 22
|
||||
style.default.color = (255, 255, 255, 255)
|
||||
style.default.black_color = (0, 0, 0, 255)
|
||||
style.default.bold = False
|
||||
style.default.italic = False
|
||||
style.default.underline = False
|
||||
style.default.strikethrough = False
|
||||
style.default.drop_shadow = None
|
||||
style.default.drop_shadow_color = (0, 0, 0, 255)
|
||||
style.default.outlines = [ ]
|
||||
style.default.minwidth = 0
|
||||
style.default.text_align = 0
|
||||
style.default.justify = False
|
||||
style.default.text_y_fudge = 0
|
||||
style.default.first_indent = 0
|
||||
style.default.rest_indent = 0
|
||||
style.default.line_spacing = 0
|
||||
style.default.layout = "greedy"
|
||||
style.default.subtitle_width = 0.9
|
||||
style.default.slow_cps = None
|
||||
style.default.slow_cps_multiplier = 1.0
|
||||
style.default.slow_abortable = False
|
||||
|
||||
# Window properties.
|
||||
style.default.background = None
|
||||
style.default.xpadding = 0
|
||||
style.default.ypadding = 0
|
||||
style.default.xmargin = 0
|
||||
style.default.ymargin = 0
|
||||
style.default.xfill = False
|
||||
style.default.yfill = False
|
||||
style.default.xminimum = 0 # Includes margins and padding.
|
||||
style.default.yminimum = 0 # Includes margins and padding.
|
||||
|
||||
# Placement properties.
|
||||
style.default.xpos = None # 0
|
||||
style.default.ypos = None # 0
|
||||
style.default.xanchor = None # 0
|
||||
style.default.yanchor = None # 0
|
||||
style.default.xmaximum = None
|
||||
style.default.ymaximum = None
|
||||
style.default.xoffset = 0
|
||||
style.default.yoffset = 0
|
||||
style.default.subpixel = False
|
||||
|
||||
# Sound properties.
|
||||
style.default.sound = None
|
||||
|
||||
# Box properties.
|
||||
style.default.spacing = 0
|
||||
style.default.first_spacing = None
|
||||
style.default.box_layout = None
|
||||
|
||||
# Focus properties.
|
||||
style.default.focus_mask = None
|
||||
style.default.focus_rect = None
|
||||
|
||||
# Bar properties.
|
||||
style.default.fore_bar = Null()
|
||||
style.default.aft_bar = Null()
|
||||
style.default.thumb = None
|
||||
style.default.thumb_shadow = None
|
||||
style.default.left_gutter = 0
|
||||
style.default.right_gutter = 0
|
||||
style.default.thumb_offset = 0
|
||||
style.default.unscrollable = None
|
||||
|
||||
# Misc.
|
||||
style.default.activate_sound = None
|
||||
style.default.clipping = False
|
||||
|
||||
# Boxes.
|
||||
style.hbox.box_layout = 'horizontal'
|
||||
style.vbox.box_layout = 'vertical'
|
||||
|
||||
# Motions, zooms, rotozooms, and transforms.
|
||||
style.motion.xanchor = 0
|
||||
style.motion.yanchor = 0
|
||||
|
||||
# Windows.
|
||||
style.window.background = Solid((0, 0, 0, 192))
|
||||
style.window.xpadding = 6
|
||||
style.window.ypadding = 6
|
||||
style.window.xmargin = 0
|
||||
style.window.ymargin = 0
|
||||
style.window.xfill = True
|
||||
style.window.yfill = False
|
||||
style.window.yminimum = 150 # Includes margins and padding.
|
||||
|
||||
style.window.xalign = 0.5
|
||||
style.window.yalign = 1.0
|
||||
|
||||
# Image placement.
|
||||
style.image_placement.xpos = 0.5
|
||||
style.image_placement.ypos = 1.0
|
||||
style.image_placement.xanchor = 0.5
|
||||
style.image_placement.yanchor = 1.0
|
||||
|
||||
# Dialogue
|
||||
style.say_label.bold = True
|
||||
style.say_vbox.spacing = 8
|
||||
|
||||
# Two window styles.
|
||||
style.say_who_window.xminimum = 200
|
||||
style.say_who_window.yminimum = 34
|
||||
style.say_who_window.xfill = False
|
||||
style.say_who_window.xalign = 0
|
||||
|
||||
style.say_two_window_vbox.yalign = 1.0
|
||||
|
||||
# Menus.
|
||||
style.menu_choice.idle_color = "#0ff"
|
||||
style.menu_choice.hover_color = "#ff0"
|
||||
style.input_text.color = "#ff0"
|
||||
|
||||
# Styles used by centered.
|
||||
style.centered_window.xalign = 0.5
|
||||
style.centered_window.xfill = False
|
||||
style.centered_window.yalign = 0.5
|
||||
style.centered_window.yfill = False
|
||||
style.centered_window.xpadding = 10
|
||||
|
||||
style.centered_text.textalign = 0.5
|
||||
style.centered_text.xalign = 0.5
|
||||
style.centered_text.yalign = 0.5
|
||||
style.centered_text.layout = "subtitle"
|
||||
|
||||
# Hyperlinks.
|
||||
style.hyperlink_text.underline = True
|
||||
style.hyperlink_text.hover_color = "#0ff"
|
||||
style.hyperlink_text.idle_color = "#08f"
|
||||
|
||||
# Bars.
|
||||
style.default.bar_invert = False
|
||||
style.default.bar_resizing = False
|
||||
style.default.bar_vertical = False
|
||||
|
||||
style.vbar.bar_vertical = True
|
||||
style.vslider.bar_vertical = True
|
||||
style.vscrollbar.bar_vertical = True
|
||||
style.vscrollbar.bar_invert = True
|
||||
|
||||
# Viewport
|
||||
style.viewport.clipping = True
|
||||
|
||||
# Transform
|
||||
style.transform.subpixel = True
|
||||
|
||||
# Menu windows.
|
||||
style.mm_root.background = "#000"
|
||||
style.mm_root.xfill = True
|
||||
style.mm_root.yfill = True
|
||||
|
||||
style.gm_root.background = "#000"
|
||||
style.gm_root.xfill = True
|
||||
style.gm_root.yfill = True
|
||||
|
||||
# Lists.
|
||||
style.list_row.xfill = True
|
||||
|
||||
style.list_row.ymargin = 0
|
||||
style.list_row.background = "#eee"
|
||||
style.list_row[1].background = "#ddd"
|
||||
style.list_row.hover_background = "#fff"
|
||||
style.list_row[1].hover_background = "#fff"
|
||||
style.list_row.selected_background = "#cce"
|
||||
style.list_row[1].selected_background = "#cce"
|
||||
style.list_text.color = "#000"
|
||||
style.list_text.size = 14
|
||||
style.list_spacer.xminimum = 15
|
||||
|
||||
|
||||
######################################################################
|
||||
|
||||
# Error messages.
|
||||
style.error_root.background = Solid((220, 220, 255, 255))
|
||||
style.error_root.xfill = True
|
||||
style.error_root.yfill = True
|
||||
style.error_root.xpadding = 20
|
||||
style.error_root.ypadding = 20
|
||||
|
||||
style.error_title.color = (255, 128, 128, 255)
|
||||
style.error_body.color = (128, 128, 255, 255)
|
||||
|
||||
@@ -0,0 +1,712 @@
|
||||
# Copyright 2004-2008 PyTom
|
||||
#
|
||||
# Please see the LICENSE.txt distributed with Ren'Py for permission to
|
||||
# copy and modify.
|
||||
|
||||
init -1110 python:
|
||||
|
||||
class _Theme(object):
|
||||
|
||||
# Using theme as a decorator is what we do to create a new theme.
|
||||
def __call__(self, func):
|
||||
setattr(self, func.func_name, func)
|
||||
return func
|
||||
|
||||
_theme = theme = _Theme()
|
||||
del _Theme
|
||||
|
||||
# Public only for compatiblity purposes.
|
||||
def RoundRect(color, small=False):
|
||||
if small:
|
||||
size = 6
|
||||
else:
|
||||
if config.screen_width <= 640:
|
||||
size = 6
|
||||
else:
|
||||
size = 12
|
||||
|
||||
return Frame(theme.OneOrTwoColor("_roundrect/rr%dg.png" % size, color), size, size)
|
||||
|
||||
init -1110 python hide:
|
||||
|
||||
@theme
|
||||
def clear_frames():
|
||||
style.frame.clear()
|
||||
|
||||
@theme
|
||||
def clear_buttons():
|
||||
style.button.clear()
|
||||
style.button_text.clear()
|
||||
style.radio_button.clear()
|
||||
style.radio_button_text.clear()
|
||||
style.check_button.clear()
|
||||
style.check_button_text.clear()
|
||||
style.small_button.clear()
|
||||
style.small_button_text.clear()
|
||||
|
||||
@theme
|
||||
def clear_large_buttons():
|
||||
style.large_button.clear()
|
||||
style.large_button_text.clear()
|
||||
|
||||
@theme
|
||||
def clear_labels():
|
||||
style.label.clear()
|
||||
style.label_text.clear()
|
||||
|
||||
@theme
|
||||
def clear_prompts():
|
||||
style.prompt.clear()
|
||||
style.prompt_text.clear()
|
||||
|
||||
@theme
|
||||
def clear_bars():
|
||||
style.bar.clear()
|
||||
style.vbar.clear()
|
||||
style.scrollbar.clear()
|
||||
style.vscrollbar.clear()
|
||||
style.slider.clear()
|
||||
style.vslider.clear()
|
||||
|
||||
style.vbar.bar_vertical = True
|
||||
style.vslider.bar_vertical = True
|
||||
style.vscrollbar.bar_vertical = True
|
||||
style.vscrollbar.bar_invert = True
|
||||
|
||||
|
||||
|
||||
|
||||
# This recolors the given image using one or two colors.
|
||||
@theme
|
||||
def OneOrTwoColor(image, color):
|
||||
if len(color) == 2:
|
||||
return im.Twocolor(image, color[0], color[1])
|
||||
else:
|
||||
return im.Twocolor(image, color, color)
|
||||
|
||||
@theme
|
||||
def roundrect_frames(
|
||||
less_rounded,
|
||||
frame):
|
||||
|
||||
theme.clear_frames()
|
||||
|
||||
style.frame.background = RoundRect(frame, less_rounded)
|
||||
|
||||
style.frame.xpadding = 6
|
||||
style.frame.ypadding = 6
|
||||
|
||||
|
||||
@theme
|
||||
def roundrect_buttons(text_size,
|
||||
less_rounded,
|
||||
widget,
|
||||
widget_hover,
|
||||
widget_text,
|
||||
widget_selected,
|
||||
disabled,
|
||||
disabled_text):
|
||||
|
||||
theme.clear_buttons()
|
||||
|
||||
style.button.background = RoundRect(widget, less_rounded)
|
||||
style.button.hover_background = RoundRect(widget_hover, less_rounded)
|
||||
style.button.insensitive_background = RoundRect(disabled, less_rounded)
|
||||
|
||||
style.button_text.size = text_size
|
||||
style.button_text.color = widget_text
|
||||
style.button_text.selected_color = widget_selected
|
||||
style.button_text.insensitive_color = disabled_text
|
||||
|
||||
if less_rounded:
|
||||
style.button.xpadding = 6
|
||||
else:
|
||||
style.button.xpadding = 12
|
||||
|
||||
style.button.ypadding = 1
|
||||
style.button.xmargin = 1
|
||||
style.button.ymargin = 1
|
||||
|
||||
style.button_text.xalign = 0.5
|
||||
style.button_text.yalign = 0.5
|
||||
style.button_text.text_align = 0.5
|
||||
|
||||
@theme
|
||||
def roundrect_large_buttons(
|
||||
text_size,
|
||||
less_rounded,
|
||||
widget,
|
||||
widget_hover,
|
||||
widget_text,
|
||||
widget_selected,
|
||||
disabled,
|
||||
disabled_text):
|
||||
|
||||
theme.clear_large_buttons()
|
||||
|
||||
if less_rounded:
|
||||
style.large_button.xpadding = 6
|
||||
else:
|
||||
style.large_button.xpadding = 12
|
||||
|
||||
style.large_button.ypadding = 1
|
||||
style.large_button.xmargin = 1
|
||||
style.large_button.ymargin = 1
|
||||
|
||||
style.large_button.background = RoundRect(widget, less_rounded)
|
||||
style.large_button.hover_background = RoundRect(widget_hover, less_rounded)
|
||||
style.large_button.insensitive_background = RoundRect(disabled, less_rounded)
|
||||
|
||||
style.large_button_text.size = text_size
|
||||
style.large_button_text.color = widget_text
|
||||
style.large_button_text.selected_color = widget_selected
|
||||
style.large_button_text.insensitive_color = disabled_text
|
||||
|
||||
style.large_button_text.xalign = 0
|
||||
style.large_button_text.yalign = 0
|
||||
|
||||
@theme
|
||||
def roundrect_labels(
|
||||
text_size,
|
||||
label):
|
||||
|
||||
theme.clear_labels()
|
||||
|
||||
style.label_text.size = text_size
|
||||
style.label_text.color = label
|
||||
|
||||
@theme
|
||||
def roundrect_prompts(
|
||||
text_size,
|
||||
label):
|
||||
|
||||
theme.clear_prompts()
|
||||
|
||||
style.prompt_text.size = text_size
|
||||
style.prompt_text.color = label
|
||||
|
||||
style.prompt.xalign = 0.5
|
||||
style.prompt_text.text_align = 0.5
|
||||
style.prompt_text.layout = "subtitle"
|
||||
|
||||
@theme
|
||||
def roundrect_bars(
|
||||
widget,
|
||||
widget_hover):
|
||||
|
||||
theme.clear_bars()
|
||||
|
||||
def img(name, color, x, y):
|
||||
rv = theme.OneOrTwoColor("_roundrect/" + name + ".png", color)
|
||||
if x is not None:
|
||||
rv = Frame(rv, x, y)
|
||||
return rv
|
||||
|
||||
# Bars.
|
||||
style.bar.ymaximum = 24
|
||||
style.bar.left_gutter = 6
|
||||
style.bar.right_gutter = 6
|
||||
style.bar.thumb_offset = 6
|
||||
|
||||
style.bar.left_bar = img("rrslider_full", widget, 12, 0)
|
||||
style.bar.right_bar = img("rrslider_empty", widget, 12, 0)
|
||||
style.bar.thumb = img("rrslider_thumb", widget, None, None)
|
||||
style.bar.hover_left_bar = img("rrslider_full", widget_hover, 12, 0)
|
||||
style.bar.hover_right_bar = img("rrslider_empty", widget_hover, 12, 0)
|
||||
style.bar.hover_thumb = img("rrslider_thumb", widget_hover, None, None)
|
||||
|
||||
style.vbar.xmaximum = 24
|
||||
style.vbar.top_gutter = 6
|
||||
style.vbar.bottom_gutter = 6
|
||||
style.vbar.thumb_offset = 6
|
||||
|
||||
style.vbar.bottom_bar = img("rrvslider_full", widget, 0, 12)
|
||||
style.vbar.top_bar = img("rrvslider_empty", widget, 0, 12)
|
||||
style.vbar.thumb = img("rrvslider_thumb", widget, None, None)
|
||||
style.vbar.hover_bottom_bar = img("rrvslider_full", widget_hover, 0, 12)
|
||||
style.vbar.hover_top_bar = img("rrvslider_empty", widget_hover, 0, 12)
|
||||
style.vbar.hover_thumb = img("rrvslider_thumb", widget_hover, None, None)
|
||||
|
||||
# Sliders.
|
||||
style.slider.ymaximum = 24
|
||||
style.slider.left_gutter = 6
|
||||
style.slider.right_gutter = 6
|
||||
style.slider.thumb_offset = 6
|
||||
|
||||
style.slider.left_bar = img("rrslider_full", widget, 12, 0)
|
||||
style.slider.right_bar = img("rrslider_empty", widget, 12, 0)
|
||||
style.slider.thumb = img("rrslider_thumb", widget, None, None)
|
||||
style.slider.hover_left_bar = img("rrslider_full", widget_hover, 12, 0)
|
||||
style.slider.hover_right_bar = img("rrslider_empty", widget_hover, 12, 0)
|
||||
style.slider.hover_thumb = img("rrslider_thumb", widget_hover, None, None)
|
||||
|
||||
style.vslider.xmaximum = 24
|
||||
style.vslider.top_gutter = 6
|
||||
style.vslider.bottom_gutter = 6
|
||||
style.vslider.thumb_offset = 6
|
||||
|
||||
style.vslider.bottom_bar = img("rrvslider_full", widget, 0, 12)
|
||||
style.vslider.top_bar = img("rrvslider_empty", widget, 0, 12)
|
||||
style.vslider.thumb = img("rrvslider_thumb", widget, None, None)
|
||||
style.vslider.hover_bottom_bar = img("rrvslider_full", widget_hover, 0, 12)
|
||||
style.vslider.hover_top_bar = img("rrvslider_empty", widget_hover, 0, 12)
|
||||
style.vslider.hover_thumb = img("rrvslider_thumb", widget_hover, None, None)
|
||||
|
||||
|
||||
# Scrollbars.
|
||||
style.scrollbar.left_gutter = 6
|
||||
style.scrollbar.right_gutter = 6
|
||||
style.scrollbar.thumb_offset = 6
|
||||
style.scrollbar.ymaximum = 12
|
||||
|
||||
style.scrollbar.left_bar = img("rrscrollbar", widget, 12, 0)
|
||||
style.scrollbar.right_bar = img("rrscrollbar", widget, 12, 0)
|
||||
style.scrollbar.thumb = img("rrscrollbar_thumb", widget, None, None)
|
||||
style.scrollbar.hover_left_bar = img("rrscrollbar", widget_hover, 12, 0)
|
||||
style.scrollbar.hover_right_bar = img("rrscrollbar", widget_hover, 12, 0)
|
||||
style.scrollbar.hover_thumb = img("rrscrollbar_thumb", widget_hover, None, None)
|
||||
|
||||
style.vscrollbar.top_gutter = 6
|
||||
style.vscrollbar.bottom_gutter = 6
|
||||
style.vscrollbar.thumb_offset = 6
|
||||
style.vscrollbar.xmaximum = 12
|
||||
|
||||
style.vscrollbar.left_bar = img("rrvscrollbar", widget, 0, 12)
|
||||
style.vscrollbar.right_bar = img("rrvscrollbar", widget, 0, 12)
|
||||
style.vscrollbar.thumb = img("rrvscrollbar_thumb", widget, None, None)
|
||||
style.vscrollbar.hover_left_bar = img("rrvscrollbar", widget_hover, 0, 12)
|
||||
style.vscrollbar.hover_right_bar = img("rrvscrollbar", widget_hover, 0, 12)
|
||||
style.vscrollbar.hover_thumb = img("rrvscrollbar_thumb", widget_hover, None, None)
|
||||
|
||||
@theme
|
||||
def roundrect(
|
||||
widget = (0, 60, 120, 255),
|
||||
widget_hover = (0, 80, 160, 255),
|
||||
widget_text = (200, 225, 255, 255),
|
||||
widget_selected = (255, 255, 200, 255),
|
||||
disabled = (64, 64, 64, 255),
|
||||
disabled_text = (200, 200, 200, 255),
|
||||
label = (255, 255, 255, 255),
|
||||
frame = (100, 150, 200, 255),
|
||||
window = (0, 0, 0, 192),
|
||||
mm_root = Solid((220, 235, 255, 255)),
|
||||
gm_root = Solid((220, 235, 255, 255)),
|
||||
|
||||
text_size=None,
|
||||
small_text_size=None,
|
||||
less_rounded = False,
|
||||
|
||||
# Compat for the old roundrect theme.
|
||||
window = None,
|
||||
button_menu = None,
|
||||
rounded_window = True,
|
||||
outline_bars = False,
|
||||
|
||||
mm_root = None,
|
||||
gm_root = None):
|
||||
|
||||
if button_menu is None:
|
||||
if (config.script_version is not None) and (config.script_version < (6, 9, 0)):
|
||||
button_menu = True
|
||||
else:
|
||||
button_menu = False
|
||||
|
||||
layout.defaults()
|
||||
|
||||
if config.screen_width <= 640:
|
||||
text_size = text_size or 18
|
||||
small_text_size = small_text_size or 12
|
||||
less_rounded = True
|
||||
|
||||
else:
|
||||
text_size = text_size or 22
|
||||
small_text_size = small_text_size or 16
|
||||
radius = 12
|
||||
|
||||
theme.roundrect_frames(
|
||||
less_rounded,
|
||||
frame)
|
||||
|
||||
theme.roundrect_buttons(
|
||||
text_size,
|
||||
less_rounded,
|
||||
widget,
|
||||
widget_hover,
|
||||
widget_text,
|
||||
widget_selected,
|
||||
disabled,
|
||||
disabled_text)
|
||||
|
||||
theme.roundrect_large_buttons(
|
||||
small_text_size,
|
||||
less_rounded,
|
||||
widget,
|
||||
widget_hover,
|
||||
widget_text,
|
||||
widget_selected,
|
||||
disabled,
|
||||
disabled_text)
|
||||
|
||||
theme.roundrect_labels(
|
||||
text_size,
|
||||
label)
|
||||
|
||||
theme.roundrect_prompts(
|
||||
text_size,
|
||||
label)
|
||||
|
||||
theme.roundrect_bars(
|
||||
widget,
|
||||
widget_hover)
|
||||
|
||||
if mm_root is not None:
|
||||
style.mm_root.background = mm_root
|
||||
|
||||
if gm_root is not None:
|
||||
style.gm_root.background = gm_root
|
||||
|
||||
if window is not None:
|
||||
|
||||
if rounded_window:
|
||||
style.window.background = RoundRect(window, less_rounded)
|
||||
style.window.xpadding = 6
|
||||
style.window.xmargin = 6
|
||||
style.window.ypadding = 6
|
||||
style.window.ymargin = 6
|
||||
else:
|
||||
style.window.background = Solid(window)
|
||||
style.window.xpadding = 6
|
||||
style.window.xmargin = 0
|
||||
style.window.ypadding = 6
|
||||
style.window.ymargin = 0
|
||||
|
||||
|
||||
if button_menu:
|
||||
layout.button_menu()
|
||||
|
||||
@theme
|
||||
def ancient():
|
||||
|
||||
layout.defaults()
|
||||
|
||||
style.frame.background = Solid((0, 0, 128, 128))
|
||||
style.frame.xpadding = 10
|
||||
style.frame.ypadding = 10
|
||||
style.frame.xmargin = 10
|
||||
style.frame.ymargin = 5
|
||||
|
||||
style.menu_frame.set_parent(style.default)
|
||||
|
||||
dark_cyan = (0, 192, 255, 255)
|
||||
bright_cyan = (0, 255, 255, 255)
|
||||
dark_red = (255, 128, 128, 255)
|
||||
bright_red = (255, 64, 64, 255)
|
||||
green = (0, 128, 0, 255)
|
||||
|
||||
style.button_text.color = dark_cyan
|
||||
style.button_text.hover_color = bright_cyan
|
||||
style.button_text.insensitive_color = (192, 192, 192, 255)
|
||||
style.button_text.size = 24
|
||||
style.button_text.drop_shadow = (2, 2)
|
||||
style.button_text.drop_shadow_color = "#000"
|
||||
|
||||
style.button_text.selected_color = dark_red
|
||||
style.button_text.selected_hover_color = bright_red
|
||||
|
||||
style.button_text.xalign = 0.5
|
||||
style.button_text.text_align = 0.5
|
||||
|
||||
style.bar.ymaximum = 22
|
||||
style.bar.left_bar = Solid(bright_cyan)
|
||||
style.bar.right_bar = Solid((0, 0, 0, 128))
|
||||
style.bar.thumb = None
|
||||
style.bar.thumb_offset = 0
|
||||
style.bar.thumb_shadow = None
|
||||
|
||||
style.vbar.xmaximum = 22
|
||||
style.vbar.bottom_bar = Solid(bright_cyan)
|
||||
style.vbar.top_bar = Solid((0, 0, 0, 128))
|
||||
style.vbar.thumb = None
|
||||
style.vbar.thumb_offset = 0
|
||||
style.vbar.thumb_shadow = None
|
||||
|
||||
style.slider.ymaximum = 22
|
||||
style.slider.left_bar = Solid(bright_cyan)
|
||||
style.slider.right_bar = Solid((0, 0, 0, 128))
|
||||
style.slider.thumb = None
|
||||
style.slider.thumb_offset = 0
|
||||
style.slider.thumb_shadow = None
|
||||
|
||||
style.vslider.xmaximum = 22
|
||||
style.vslider.bottom_bar = Solid(bright_cyan)
|
||||
style.vslider.top_bar = Solid((0, 0, 0, 128))
|
||||
style.vslider.thumb = None
|
||||
style.vslider.thumb_offset = 0
|
||||
style.vslider.thumb_shadow = None
|
||||
|
||||
style.scrollbar.ymaximum = 22
|
||||
style.scrollbar.left_bar = Solid("#0008")
|
||||
style.scrollbar.right_bar = Solid("#0008")
|
||||
style.scrollbar.thumb = Solid(bright_cyan)
|
||||
style.scrollbar.thumb_offset = 0
|
||||
style.scrollbar.thumb_shadow = None
|
||||
|
||||
style.vscrollbar.xmaximum = 22
|
||||
style.vscrollbar.top_bar = Solid("#0008")
|
||||
style.vscrollbar.bottom_bar = Solid("#0008")
|
||||
style.vscrollbar.thumb = Solid(bright_cyan)
|
||||
style.vscrollbar.thumb_offset = 0
|
||||
style.vscrollbar.thumb_shadow = None
|
||||
|
||||
style.large_button.xpadding = 5
|
||||
style.large_button.ypadding = 2
|
||||
style.large_button.xmargin = 5
|
||||
style.large_button.ymargin = 2
|
||||
style.large_button.background = "#fff"
|
||||
style.large_button.hover_background = "#ffc"
|
||||
|
||||
style.large_button_text.size = 16
|
||||
style.large_button_text.drop_shadow = (1, 1)
|
||||
style.large_button_text.xalign = 0
|
||||
style.large_button_text.text_align = 0
|
||||
|
||||
style.label_text.size = 24
|
||||
style.label_text.color = green
|
||||
style.label_text.drop_shadow = (1, 1)
|
||||
style.label_text.drop_shadow_color = "#000"
|
||||
|
||||
style.prompt_text.size = 24
|
||||
style.prompt_text.color = green
|
||||
style.prompt_text.layout = "subtitle"
|
||||
style.prompt_text.text_align = 0.5
|
||||
style.prompt_text.drop_shadow = (1, 1)
|
||||
style.prompt_text.drop_shadow_color = "#000"
|
||||
|
||||
style.mm_root.background = "#e9d8bc"
|
||||
style.gm_root.background = "#e9d8bc"
|
||||
|
||||
|
||||
@theme
|
||||
def outline_frames():
|
||||
theme.clear_frames()
|
||||
|
||||
@theme
|
||||
def outline_buttons(
|
||||
inside,
|
||||
idle,
|
||||
hover,
|
||||
selected,
|
||||
insensitive,
|
||||
text_size):
|
||||
|
||||
theme.clear_buttons()
|
||||
|
||||
style.button.xmargin = 4
|
||||
|
||||
style.button_text.size = text_size
|
||||
style.button_text.color = inside
|
||||
style.button_text.outlines = [ (2, idle) ]
|
||||
style.button_text.hover_outlines = [ (2, hover) ]
|
||||
style.button_text.selected_outlines = [ (2, selected) ]
|
||||
style.button_text.selected_hover_outlines = [ (2, hover) ]
|
||||
style.button_text.insensitive_outlines = [ (2, insensitive) ]
|
||||
|
||||
|
||||
@theme
|
||||
def outline_large_buttons(
|
||||
inside,
|
||||
idle,
|
||||
hover,
|
||||
selected,
|
||||
insensitive,
|
||||
text_size,
|
||||
large_button):
|
||||
|
||||
theme.clear_large_buttons()
|
||||
|
||||
style.large_button.xmargin = 4
|
||||
style.large_button.ymargin = 2
|
||||
|
||||
style.large_button.background = large_button
|
||||
|
||||
style.large_button_text.size = text_size
|
||||
style.large_button_text.color = inside
|
||||
|
||||
style.large_button_text.outlines = [ (2, idle) ]
|
||||
style.large_button_text.hover_outlines = [ (2, hover) ]
|
||||
style.large_button_text.selected_outlines = [ (2, selected) ]
|
||||
style.large_button_text.selected_hover_outlines = [ (2, hover) ]
|
||||
style.large_button_text.insensitive_outlines = [ (2, insensitive) ]
|
||||
|
||||
@theme
|
||||
def outline_prompts(
|
||||
inside,
|
||||
prompt,
|
||||
text_size):
|
||||
|
||||
theme.clear_prompts()
|
||||
|
||||
style.prompt_text.color = inside
|
||||
style.prompt_text.outlines = [ (2, prompt) ]
|
||||
style.prompt_text.size = text_size
|
||||
|
||||
@theme
|
||||
def outline_labels(
|
||||
inside,
|
||||
label,
|
||||
text_size):
|
||||
|
||||
theme.clear_labels()
|
||||
|
||||
style.label_text.color = inside
|
||||
style.label_text.outlines = [ (2, label) ]
|
||||
style.label_text.size = text_size
|
||||
|
||||
@theme
|
||||
def outline_bars(
|
||||
inside,
|
||||
idle,
|
||||
hover):
|
||||
|
||||
theme.clear_bars()
|
||||
|
||||
def color(fn, c):
|
||||
return im.Twocolor("_outline/" + fn + ".png", inside, c)
|
||||
|
||||
style.bar.ymaximum = 16
|
||||
style.bar.left_bar = Frame(color("circle", idle), 7, 0)
|
||||
style.bar.right_bar = Frame(color("bar", idle), 0, 0)
|
||||
style.bar.left_gutter = 16
|
||||
style.bar.bar_resizing = True
|
||||
|
||||
style.slider.ymaximum = 16
|
||||
style.slider.left_bar = Frame(color("bar", idle), 0, 0)
|
||||
style.slider.right_bar = Frame(color("bar", idle), 0, 0)
|
||||
style.slider.thumb = color("circle", idle)
|
||||
style.slider.hover_left_bar = Frame(color("bar", hover), 0, 0)
|
||||
style.slider.hover_right_bar = Frame(color("bar", hover), 0, 0)
|
||||
style.slider.hover_thumb = color("circle", hover)
|
||||
|
||||
style.scrollbar.ymaximum = 16
|
||||
style.scrollbar.left_bar = Frame(color("bar", idle), 0, 0)
|
||||
style.scrollbar.right_bar = Frame(color("bar", idle), 0, 0)
|
||||
style.scrollbar.thumb = Frame(color("circle", idle), 7, 0)
|
||||
style.scrollbar.hover_left_bar = Frame(color("bar", hover), 0, 0)
|
||||
style.scrollbar.hover_right_bar = Frame(color("bar", hover), 0, 0)
|
||||
style.scrollbar.hover_thumb = Frame(color("circle", hover), 7, 0)
|
||||
|
||||
style.vbar.xmaximum = 16
|
||||
style.vbar.bottom_bar = Frame(color("circle", idle), 0, 7)
|
||||
style.vbar.top_bar = Frame(color("vbar", idle), 0, 0)
|
||||
style.vbar.bottom_gutter = 16
|
||||
style.vbar.bar_resizing = True
|
||||
|
||||
style.vslider.xmaximum = 16
|
||||
style.vslider.top_bar = Frame(color("vbar", idle), 0, 0)
|
||||
style.vslider.bottom_bar = Frame(color("vbar", idle), 0, 0)
|
||||
style.vslider.thumb = color("circle", idle)
|
||||
style.vslider.hover_top_bar = Frame(color("vbar", hover), 0, 0)
|
||||
style.vslider.hover_bottom_bar = Frame(color("vbar", hover), 0, 0)
|
||||
style.vslider.hover_thumb = color("circle", hover)
|
||||
|
||||
style.vscrollbar.xmaximum = 16
|
||||
style.vscrollbar.top_bar = Frame(color("vbar", idle), 0, 0)
|
||||
style.vscrollbar.bottom_bar = Frame(color("vbar", idle), 0, 0)
|
||||
style.vscrollbar.thumb = Frame(color("circle", idle), 0, 7)
|
||||
style.vscrollbar.hover_top_bar = Frame(color("vbar", hover), 0, 0)
|
||||
style.vscrollbar.hover_bottom_bar = Frame(color("vbar", hover), 0, 0)
|
||||
style.vscrollbar.hover_thumb = Frame(color("circle", hover), 0, 7)
|
||||
|
||||
@theme
|
||||
def outline(
|
||||
inside="#fff",
|
||||
idle="#e66",
|
||||
hover="#48f",
|
||||
selected="#84f",
|
||||
insensitive="#ccc",
|
||||
label="#484",
|
||||
prompt="#484",
|
||||
background="#fee",
|
||||
large_button="#fff8f8",
|
||||
text_size=22,
|
||||
small_text_size=16,
|
||||
):
|
||||
|
||||
layout.defaults()
|
||||
|
||||
theme.outline_frames()
|
||||
|
||||
theme.outline_buttons(
|
||||
inside,
|
||||
idle,
|
||||
hover,
|
||||
selected,
|
||||
insensitive,
|
||||
text_size)
|
||||
|
||||
theme.outline_large_buttons(
|
||||
inside,
|
||||
idle,
|
||||
hover,
|
||||
selected,
|
||||
insensitive,
|
||||
small_text_size,
|
||||
large_button)
|
||||
|
||||
theme.outline_prompts(
|
||||
inside,
|
||||
prompt,
|
||||
text_size)
|
||||
|
||||
theme.outline_labels(
|
||||
inside,
|
||||
label,
|
||||
text_size)
|
||||
|
||||
theme.outline_bars(
|
||||
inside,
|
||||
idle,
|
||||
hover)
|
||||
|
||||
style.mm_root.background = background
|
||||
style.gm_root.background = background
|
||||
|
||||
@theme
|
||||
def image_buttons(d):
|
||||
for k, (idle, hover, selected_idle, selected_hover, insensitive) in d.iteritems():
|
||||
s = style.button[k]
|
||||
s.xpadding = 0
|
||||
s.ypadding = 0
|
||||
s.background = None
|
||||
s.foreground = None
|
||||
s.idle_child = idle
|
||||
s.hover_child = hover
|
||||
s.selected_idle_child = selected_idle
|
||||
s.selected_hover_child = selected_hover
|
||||
s.insensitive_child = insensitive
|
||||
s.focus_mask = True
|
||||
|
||||
|
||||
@theme
|
||||
def image_labels(d):
|
||||
for k, l in d.iteritems():
|
||||
s = style.label[k]
|
||||
s.xpadding = 0
|
||||
s.ypadding = 0
|
||||
s.background = None
|
||||
s.foreground = None
|
||||
s.child = k
|
||||
|
||||
|
||||
config.image_buttons = { }
|
||||
config.image_labels = { }
|
||||
|
||||
init 1110 python:
|
||||
|
||||
if not "compat" in _layout.provided:
|
||||
theme.image_buttons(config.image_buttons)
|
||||
theme.image_labels(config.image_labels)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
# This extra contains a basic implementation of voice support. Right
|
||||
# now, voice is given its own toggle, and can either be turned on or
|
||||
# turned off. In the future, we'll probably provide some way of
|
||||
# toggling it on or off for individual characters.
|
||||
#
|
||||
# To use it, place a voice "<sndfile>" line before each voiced line of
|
||||
# dialogue.
|
||||
#
|
||||
# voice "e_1001.ogg"
|
||||
# e "Voice support lets you add the spoken word to your games."
|
||||
#
|
||||
# Normally, a voice is cancelled at the start of the next
|
||||
# interaction. If you want a voice to span interactions, call
|
||||
# voice_sustain.
|
||||
#
|
||||
# voice "e_1002.ogg"
|
||||
# e "Voice sustain is a technique that allows the same voice file.."
|
||||
#
|
||||
# $ voice_sustain()
|
||||
# e "...to play for two lines of dialogue."
|
||||
|
||||
init -1120:
|
||||
|
||||
python:
|
||||
|
||||
_voice = object()
|
||||
_voice.play = None
|
||||
_voice.sustain = False
|
||||
_voice.seen_in_lint = False
|
||||
|
||||
# Call this to specify the voice file that will be played for
|
||||
# the user.
|
||||
def voice(file, **kwargs):
|
||||
if not config.has_voice:
|
||||
return
|
||||
|
||||
_voice.play = file
|
||||
|
||||
# Call this to specify that the currently playing voice file
|
||||
# should be sustained through the current interaction.
|
||||
def voice_sustain(ignored="", **kwargs):
|
||||
if not config.has_voice:
|
||||
return
|
||||
|
||||
_voice.sustain = True
|
||||
|
||||
python hide:
|
||||
|
||||
# basics: True if the game will have voice.
|
||||
config.has_voice = True
|
||||
|
||||
# This is called on each interaction, to ensure that the
|
||||
# appropriate voice file is played for the user.
|
||||
def voice_interact():
|
||||
|
||||
if not config.has_voice:
|
||||
return
|
||||
|
||||
if _voice.play and not config.skipping:
|
||||
renpy.sound.play(_voice.play, channel=2)
|
||||
elif not _voice.sustain:
|
||||
renpy.sound.stop(channel=2)
|
||||
|
||||
_voice.play = None
|
||||
_voice.sustain = False
|
||||
|
||||
config.start_interact_callbacks.append(voice_interact)
|
||||
config.say_sustain_callbacks.append(voice_sustain)
|
||||
|
||||
def voice_afm_callback():
|
||||
return not renpy.sound.is_playing(channel=2)
|
||||
|
||||
config.afm_callback = voice_afm_callback
|
||||
|
||||
python early hide:
|
||||
|
||||
def parse_voice(l):
|
||||
fn = l.simple_expression()
|
||||
if fn is None:
|
||||
renpy.error('expected simple expression (string)')
|
||||
|
||||
if not l.eol():
|
||||
renpy.error('expected end of line')
|
||||
|
||||
return fn
|
||||
|
||||
def execute_voice(fn):
|
||||
fn = eval(fn)
|
||||
voice(fn)
|
||||
|
||||
def lint_voice(fn):
|
||||
_voice.seen_in_lint = True
|
||||
|
||||
fn = _try_eval(fn, 'voice filename')
|
||||
if isinstance(fn, basestring) and not renpy.loadable(fn):
|
||||
renpy.error('voice file %r is not loadable' % fn)
|
||||
|
||||
renpy.statements.register('voice',
|
||||
parse=parse_voice,
|
||||
execute=execute_voice,
|
||||
lint=lint_voice)
|
||||
|
||||
def parse_voice_sustain(l):
|
||||
if not l.eol():
|
||||
renpy.error('expected end of line')
|
||||
|
||||
return None
|
||||
|
||||
def execute_voice_sustain(parsed):
|
||||
voice_sustain()
|
||||
|
||||
renpy.statements.register('voice sustain',
|
||||
parse=parse_voice_sustain,
|
||||
execute=execute_voice_sustain)
|
||||
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain. Glyphs imported from Arev fonts are (c) Tavmjung Bah (see below)
|
||||
|
||||
Bitstream Vera Fonts Copyright
|
||||
------------------------------
|
||||
|
||||
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
|
||||
a trademark of Bitstream, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of the fonts accompanying this license ("Fonts") and associated
|
||||
documentation files (the "Font Software"), to reproduce and distribute the
|
||||
Font Software, including without limitation the rights to use, copy, merge,
|
||||
publish, distribute, and/or sell copies of the Font Software, and to permit
|
||||
persons to whom the Font Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright and trademark notices and this permission notice shall
|
||||
be included in all copies of one or more of the Font Software typefaces.
|
||||
|
||||
The Font Software may be modified, altered, or added to, and in particular
|
||||
the designs of glyphs or characters in the Fonts may be modified and
|
||||
additional glyphs or characters may be added to the Fonts, only if the fonts
|
||||
are renamed to names not containing either the words "Bitstream" or the word
|
||||
"Vera".
|
||||
|
||||
This License becomes null and void to the extent applicable to Fonts or Font
|
||||
Software that has been modified and is distributed under the "Bitstream
|
||||
Vera" names.
|
||||
|
||||
The Font Software may be sold as part of a larger software package but no
|
||||
copy of one or more of the Font Software typefaces may be sold by itself.
|
||||
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
|
||||
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
|
||||
FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
|
||||
ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
|
||||
FONT SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the names of Gnome, the Gnome
|
||||
Foundation, and Bitstream Inc., shall not be used in advertising or
|
||||
otherwise to promote the sale, use or other dealings in this Font Software
|
||||
without prior written authorization from the Gnome Foundation or Bitstream
|
||||
Inc., respectively. For further information, contact: fonts at gnome dot
|
||||
org.
|
||||
|
||||
Arev Fonts Copyright
|
||||
------------------------------
|
||||
|
||||
Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the fonts accompanying this license ("Fonts") and
|
||||
associated documentation files (the "Font Software"), to reproduce
|
||||
and distribute the modifications to the Bitstream Vera Font Software,
|
||||
including without limitation the rights to use, copy, merge, publish,
|
||||
distribute, and/or sell copies of the Font Software, and to permit
|
||||
persons to whom the Font Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright and trademark notices and this permission notice
|
||||
shall be included in all copies of one or more of the Font Software
|
||||
typefaces.
|
||||
|
||||
The Font Software may be modified, altered, or added to, and in
|
||||
particular the designs of glyphs or characters in the Fonts may be
|
||||
modified and additional glyphs or characters may be added to the
|
||||
Fonts, only if the fonts are renamed to names not containing either
|
||||
the words "Tavmjong Bah" or the word "Arev".
|
||||
|
||||
This License becomes null and void to the extent applicable to Fonts
|
||||
or Font Software that has been modified and is distributed under the
|
||||
"Tavmjong Bah Arev" names.
|
||||
|
||||
The Font Software may be sold as part of a larger software package but
|
||||
no copy of one or more of the Font Software typefaces may be sold by
|
||||
itself.
|
||||
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
|
||||
TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of Tavmjong Bah shall not
|
||||
be used in advertising or otherwise to promote the sale, use or other
|
||||
dealings in this Font Software without prior written authorization
|
||||
from Tavmjong Bah. For further information, contact: tavmjong @ free
|
||||
. fr.
|
||||
|
||||
$Id: LICENSE 778 2006-04-20 18:14:24Z moyogo $
|
||||
@@ -1,55 +0,0 @@
|
||||
This package was debianized by Michael Fedrowitz <michaelf@debian.org>
|
||||
on Sun, 23 Feb 2003.
|
||||
|
||||
It was downloaded from
|
||||
'http://ftp.gnome.org/pub/GNOME/sources/ttf-bitstream-vera/'.
|
||||
|
||||
Upstream Author: Bitstream, Inc.
|
||||
|
||||
Copyright:
|
||||
|
||||
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream
|
||||
Vera is a trademark of Bitstream, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the fonts accompanying this license ("Fonts") and associated
|
||||
documentation files (the "Font Software"), to reproduce and distribute
|
||||
the Font Software, including without limitation the rights to use,
|
||||
copy, merge, publish, distribute, and/or sell copies of the Font
|
||||
Software, and to permit persons to whom the Font Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright and trademark notices and this permission notice
|
||||
shall be included in all copies of one or more of the Font Software
|
||||
typefaces.
|
||||
|
||||
The Font Software may be modified, altered, or added to, and in
|
||||
particular the designs of glyphs or characters in the Fonts may be
|
||||
modified and additional glyphs or characters may be added to the
|
||||
Fonts, only if the fonts are renamed to names not containing either
|
||||
the words "Bitstream" or the word "Vera".
|
||||
|
||||
This License becomes null and void to the extent applicable to Fonts
|
||||
or Font Software that has been modified and is distributed under the
|
||||
"Bitstream Vera" names.
|
||||
|
||||
The Font Software may be sold as part of a larger software package but
|
||||
no copy of one or more of the Font Software typefaces may be sold by
|
||||
itself.
|
||||
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
|
||||
BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL,
|
||||
OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT
|
||||
SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the names of Gnome, the Gnome
|
||||
Foundation, and Bitstream Inc., shall not be used in advertising or
|
||||
otherwise to promote the sale, use or other dealings in this Font
|
||||
Software without prior written authorization from the Gnome Foundation
|
||||
or Bitstream Inc., respectively. For further information, contact:
|
||||
fonts at gnome dot org.
|
||||
@@ -0,0 +1,501 @@
|
||||
init python:
|
||||
|
||||
######################################################################
|
||||
# First up, we define a bunch of configuration variable, which the
|
||||
# user can change.
|
||||
|
||||
# The contents of the game menu choices.
|
||||
config.game_menu = [
|
||||
( "return", u"Return", ui.jumps("_return"), 'True'),
|
||||
( "skipping", u"Begin Skipping", ui.jumps("_return_skipping"), 'config.allow_skipping and not renpy.context().main_menu'),
|
||||
( "prefs", u"Preferences", _intra_jumps("_prefs_screen", "intra_transition"), 'True' ),
|
||||
( "save", u"Save Game", _intra_jumps("_save_screen", "intra_transition"), 'not renpy.context().main_menu' ),
|
||||
( "load", u"Load Game", _intra_jumps("_load_screen", "intra_transition"), 'True'),
|
||||
( "mainmenu", u"Main Menu", lambda : _mainmenu_prompt(), 'not renpy.context().main_menu' ),
|
||||
( "quit", u"Quit", lambda : _quit_prompt("quit"), 'True' ),
|
||||
]
|
||||
|
||||
# If not None, a map from the names of the game menu
|
||||
# navigation buttons to new fixed positions for them on
|
||||
# the screen.
|
||||
config.game_menu_positions = None
|
||||
|
||||
# The number of columns of files to show at once.
|
||||
config.file_page_cols = 2
|
||||
|
||||
# The number of rows of files to show at once.
|
||||
config.file_page_rows = 5
|
||||
|
||||
# The number of pages to add quick access buttons for.
|
||||
config.file_quick_access_pages = 5
|
||||
|
||||
# The positions of file picker components.
|
||||
config.file_picker_positions = None
|
||||
|
||||
|
||||
# This lets us disable the file pager. (So we only have one
|
||||
# page of files.)
|
||||
config.disable_file_pager = False
|
||||
|
||||
# This lets us disable the thumbnails in the file pager.
|
||||
config.disable_thumbnails = False
|
||||
|
||||
# How we format time.
|
||||
config.time_format = "%b %d, %H:%M"
|
||||
|
||||
# How we format loade_save slot formats.
|
||||
config.file_entry_format = "%(time)s\n%(save_name)s"
|
||||
|
||||
# If True, we will be prompted before loading a game. (This can
|
||||
# be changed from inside the game code, so that one can load from
|
||||
# the first few screens but not after that.)
|
||||
_load_prompt = True
|
||||
|
||||
|
||||
_game_menu_screen = "_save_screen"
|
||||
|
||||
######################################################################
|
||||
# Next, support code.
|
||||
|
||||
# This is used to store scratch data that's used by the
|
||||
# library, but shouldn't be saved out as part of the savegame.
|
||||
_scratch = object()
|
||||
|
||||
# This returns a window containing the game menu navigation
|
||||
# buttons, set up to jump to the appropriate screen sections.
|
||||
#
|
||||
# This can be overridden by user code. It's called with the
|
||||
# name of the selected screen... one of "mainmenu", "prefs",
|
||||
# "save", "load", or "quit", at least for the default game
|
||||
# menu. If None, then it's an indication that none of the
|
||||
# nav buttons should be shown.
|
||||
def _game_nav(screen, buttons=True):
|
||||
|
||||
global _screen
|
||||
_screen = screen
|
||||
|
||||
ui.add(renpy.Keymap(toggle_fullscreen = renpy.toggle_fullscreen))
|
||||
ui.add(renpy.Keymap(game_menu=ui.jumps("_noisy_return")))
|
||||
|
||||
ui.window(style=style.gm_root[screen])
|
||||
ui.null()
|
||||
|
||||
if not screen:
|
||||
return
|
||||
|
||||
if not config.game_menu_positions:
|
||||
ui.window(style='gm_nav_frame')
|
||||
ui.vbox(focus='gm_nav', style='gm_nav_vbox')
|
||||
|
||||
for i, (key, label, clicked, enabled) in enumerate(config.game_menu):
|
||||
|
||||
disabled = False
|
||||
|
||||
if not eval(enabled):
|
||||
disabled = True
|
||||
clicked = None
|
||||
|
||||
if config.game_menu_positions:
|
||||
kwargs = config.game_menu_positions.get(label, { })
|
||||
else:
|
||||
kwargs = { }
|
||||
|
||||
_button_factory(label, "gm_nav",
|
||||
selected=(key==screen),
|
||||
disabled=disabled,
|
||||
clicked=clicked,
|
||||
properties=kwargs)
|
||||
|
||||
if not config.game_menu_positions:
|
||||
ui.close()
|
||||
|
||||
# This is called from the game menu to interact with the
|
||||
# user. It suppresses all of the underlays and overlays.
|
||||
def _game_interact():
|
||||
|
||||
return ui.interact(suppress_underlay=True,
|
||||
suppress_overlay=True,
|
||||
mouse="gamemenu")
|
||||
|
||||
|
||||
# This renders a slot with a file in it, in the file picker.
|
||||
def _render_savefile(index, name, filename, extra_info, screenshot, mtime, newest, clickable, **positions):
|
||||
|
||||
if clickable:
|
||||
clicked = ui.returns(("return", (filename, True)))
|
||||
else:
|
||||
clicked = None
|
||||
|
||||
ui.button(style=style.file_picker_entry[index],
|
||||
clicked=clicked,
|
||||
**positions)
|
||||
|
||||
ui.hbox(style=style.file_picker_entry_box[index])
|
||||
|
||||
if not config.disable_thumbnails:
|
||||
ui.add(screenshot)
|
||||
|
||||
if newest:
|
||||
ui.text(name + ". ", style=style.file_picker_new[index])
|
||||
else:
|
||||
ui.text(name + ". ", style=style.file_picker_old[index])
|
||||
|
||||
|
||||
s = config.file_entry_format % dict(
|
||||
time=renpy.time.strftime(config.time_format,
|
||||
renpy.time.localtime(mtime)),
|
||||
save_name=extra_info)
|
||||
|
||||
ui.text(s, style=style.file_picker_extra_info[index])
|
||||
|
||||
ui.close()
|
||||
|
||||
# This renders an empty slot in the file picker.
|
||||
def _render_new_slot(index, name, filename, clickable, **positions):
|
||||
|
||||
if clickable:
|
||||
clicked=ui.returns(("return", (filename, False)))
|
||||
enable_hover = True
|
||||
else:
|
||||
clicked = None
|
||||
enable_hover = True
|
||||
|
||||
ui.button(style=style.file_picker_entry[index],
|
||||
clicked=clicked,
|
||||
enable_hover=enable_hover,
|
||||
**positions)
|
||||
|
||||
ui.hbox(style=style.file_picker_entry_box[index])
|
||||
|
||||
if not config.disable_thumbnails:
|
||||
ui.null(width=config.thumbnail_width,
|
||||
height=config.thumbnail_height)
|
||||
|
||||
|
||||
ui.text(name + ". ", style=style.file_picker_old[index])
|
||||
|
||||
ui.text(_(u"Empty Slot."), style=style.file_picker_empty_slot[index])
|
||||
ui.close()
|
||||
|
||||
_scratch.file_picker_page = None
|
||||
|
||||
# The names of the various pages that the file picker knows
|
||||
# about.
|
||||
def _file_picker_pages():
|
||||
|
||||
rv = [ ]
|
||||
|
||||
if config.has_autosave:
|
||||
rv.append("Auto")
|
||||
|
||||
if config.has_quicksave:
|
||||
rv.append("Quick")
|
||||
|
||||
for i in range(1, config.file_quick_access_pages + 1):
|
||||
rv.append(str(i))
|
||||
|
||||
return rv
|
||||
|
||||
|
||||
# This function is given a page, and should map it to the names
|
||||
# of the files on that page.
|
||||
def _file_picker_page_files(page):
|
||||
|
||||
per_page = config.file_page_cols * config.file_page_rows
|
||||
rv = [ ]
|
||||
|
||||
if config.has_autosave:
|
||||
if page == 0:
|
||||
for i in range(1, per_page + 1):
|
||||
rv.append(("auto-" + str(i), "a" + str(i), True))
|
||||
|
||||
return rv
|
||||
else:
|
||||
page -= 1
|
||||
|
||||
if config.has_quicksave:
|
||||
if page == 0:
|
||||
for i in range(1, per_page + 1):
|
||||
rv.append(("quick-" + str(i), "q" + str(i), True))
|
||||
|
||||
return rv
|
||||
else:
|
||||
page -= 1
|
||||
|
||||
for i in range(per_page * page + 1, per_page * page + 1 + per_page):
|
||||
rv.append(("%d" % i, "%d" % i, False))
|
||||
|
||||
return rv
|
||||
|
||||
# Given a filename, returns the page that filename is on.
|
||||
def _file_picker_file_page(filename):
|
||||
|
||||
per_page = config.file_page_cols * config.file_page_rows
|
||||
|
||||
base = 0
|
||||
|
||||
if config.has_autosave:
|
||||
if filename.startswith("auto-"):
|
||||
return base
|
||||
else:
|
||||
base += 1
|
||||
|
||||
if config.has_quicksave:
|
||||
if filename.startswith("quick-"):
|
||||
return base
|
||||
else:
|
||||
base += 1
|
||||
|
||||
return base + int((int(filename) - 1) / per_page)
|
||||
|
||||
|
||||
def _file_picker_process_screenshot(s):
|
||||
return s
|
||||
|
||||
# This displays a file picker that can chose a save file from
|
||||
# the list of save files.
|
||||
def _file_picker(selected, save):
|
||||
|
||||
# The number of slots in a page.
|
||||
file_page_length = config.file_page_cols * config.file_page_rows
|
||||
|
||||
saved_games = renpy.list_saved_games(regexp=r'(auto-|quick-)?[0-9]+')
|
||||
|
||||
newest = None
|
||||
newest_mtime = None
|
||||
save_info = { }
|
||||
|
||||
for fn, extra_info, screenshot, mtime in saved_games:
|
||||
screenshot = _file_picker_process_screenshot(screenshot)
|
||||
save_info[fn] = (extra_info, screenshot, mtime)
|
||||
|
||||
if not fn.startswith("auto-") and mtime > newest_mtime:
|
||||
newest = fn
|
||||
newest_mtime = mtime
|
||||
|
||||
if config.file_picker_positions:
|
||||
positions = config.file_picker_positions
|
||||
else:
|
||||
positions = { }
|
||||
|
||||
# The index of the first entry in the page.
|
||||
fpp = _scratch.file_picker_page
|
||||
|
||||
if fpp is None:
|
||||
|
||||
if newest:
|
||||
fpp = _file_picker_file_page(newest)
|
||||
else:
|
||||
fpp = _file_picker_file_page("1")
|
||||
|
||||
|
||||
while True:
|
||||
|
||||
if fpp < 0:
|
||||
fpp = 0
|
||||
|
||||
_scratch.file_picker_page = fpp
|
||||
|
||||
# Show navigation
|
||||
_game_nav(selected)
|
||||
|
||||
if not config.file_picker_positions:
|
||||
|
||||
ui.window(style='file_picker_frame')
|
||||
ui.vbox(style='file_picker_frame_vbox') # whole thing.
|
||||
|
||||
if not config.disable_file_pager:
|
||||
|
||||
### file_picker_navbox thick_hbox
|
||||
# (box) The box containing the naviation (next/previous)
|
||||
# buttons in the file picker.
|
||||
|
||||
### file_picker_nav_button menu_button
|
||||
# (window, hover) The style that is used for enabled file
|
||||
# picker navigation buttons.
|
||||
|
||||
### file_picker_nav_button_text menu_button_text
|
||||
# (text) The style that is used for the label of enabled
|
||||
# file picker navigation buttons.
|
||||
|
||||
# Draw the navigation.
|
||||
if not config.file_picker_positions:
|
||||
ui.hbox(style='file_picker_navbox') # nav buttons.
|
||||
|
||||
def tb(cond, label, clicked, selected):
|
||||
_button_factory(label,
|
||||
"file_picker_nav",
|
||||
disabled=not cond,
|
||||
clicked=clicked,
|
||||
selected=selected,
|
||||
properties=positions.get("nav_" + label, { }))
|
||||
|
||||
# Previous
|
||||
tb(fpp > 0, _(u'Previous'), ui.returns(("fppdelta", -1)), selected=False)
|
||||
|
||||
# Quick Access
|
||||
for i, name in enumerate(_file_picker_pages()):
|
||||
tb(True, name, ui.returns(("fppset", i)), fpp == i)
|
||||
|
||||
# Next
|
||||
tb(True, _(u'Next'), ui.returns(("fppdelta", +1)), False)
|
||||
|
||||
# Done with nav buttons.
|
||||
if not config.file_picker_positions:
|
||||
ui.close()
|
||||
|
||||
# This draws a single slot.
|
||||
def entry(name, filename, offset, ro):
|
||||
place = positions.get("entry_" + str(offset + 1), { })
|
||||
|
||||
if filename not in save_info:
|
||||
clickable = save and not ro
|
||||
|
||||
_render_new_slot(offset, name, filename, clickable, **place)
|
||||
else:
|
||||
clickable = not save or not ro
|
||||
|
||||
extra_info, screenshot, mtime = save_info[filename]
|
||||
_render_savefile(offset, name, filename, extra_info, screenshot,
|
||||
mtime, newest == filename, clickable, **place)
|
||||
|
||||
if not config.file_picker_positions:
|
||||
ui.grid(config.file_page_cols,
|
||||
config.file_page_rows,
|
||||
style='file_picker_grid',
|
||||
transpose=True) # slots
|
||||
|
||||
for i, (filename, name, ro) in enumerate(_file_picker_page_files(fpp)):
|
||||
entry(name, filename, i, ro)
|
||||
|
||||
if not config.file_picker_positions:
|
||||
ui.close() # slots
|
||||
ui.close() # whole thing
|
||||
|
||||
result = _game_interact()
|
||||
type, value = result
|
||||
|
||||
if type == "return":
|
||||
return value
|
||||
|
||||
if type == "fppdelta":
|
||||
fpp += value
|
||||
|
||||
if type == "fppset":
|
||||
fpp = value
|
||||
|
||||
|
||||
# This renders a yes/no prompt, as part of the game menu. If
|
||||
# screen is None, then it omits the game menu navigation.
|
||||
def _yesno_prompt(screen, message):
|
||||
"""
|
||||
@param screen: The screen button that should be highlighted when this prompt is shown. If None, then no game menu navigation is shown.
|
||||
|
||||
@param message: The message that is shown to the user to prompt them to answer yes or no.
|
||||
|
||||
This function returns True if the user clicks Yes, or False if the user clicks No.
|
||||
"""
|
||||
|
||||
renpy.transition(config.intra_transition)
|
||||
|
||||
_game_nav(screen)
|
||||
|
||||
ui.window(style='yesno_frame')
|
||||
ui.vbox(style='yesno_frame_vbox')
|
||||
|
||||
_label_factory(message, "yesno")
|
||||
|
||||
ui.hbox(style='yesno_button_hbox')
|
||||
|
||||
# The extra nulls are because we want equal whitespace surrounding
|
||||
# the two buttons. It should work as long as we have xfill=True
|
||||
_button_factory(u"Yes", 'yesno', clicked=ui.returns(True))
|
||||
_button_factory(u"No", 'yesno', clicked=ui.returns(False))
|
||||
|
||||
ui.close()
|
||||
ui.close()
|
||||
|
||||
rv = _game_interact()
|
||||
renpy.transition(config.intra_transition)
|
||||
return rv
|
||||
|
||||
config.old_names["Are you sure you want to quit?"] = "Are you sure you want to quit the game?"
|
||||
|
||||
def _quit_prompt(screen="quit"):
|
||||
|
||||
def prompt():
|
||||
return _yesno_prompt(screen, u"Are you sure you want to quit?")
|
||||
|
||||
if renpy.invoke_in_new_context(prompt):
|
||||
renpy.quit()
|
||||
else:
|
||||
return
|
||||
|
||||
config.old_names["Are you sure you want to return to the main menu?\nThis will lose unsaved progress."] = "Are you sure you want to return to the main menu?\nThis will end your game."
|
||||
|
||||
def _mainmenu_prompt(screen="mainmenu"):
|
||||
|
||||
def prompt():
|
||||
return _yesno_prompt(screen, u"Are you sure you want to return to the main menu?\nThis will lose unsaved progress.")
|
||||
|
||||
if renpy.invoke_in_new_context(prompt):
|
||||
renpy.full_restart(transition=config.game_main_transition)
|
||||
else:
|
||||
return
|
||||
|
||||
label _compat_confirm_quit:
|
||||
$ _quit_prompt(None)
|
||||
return
|
||||
|
||||
|
||||
init -1160:
|
||||
$ config.old_names["Loading will lose unsaved progress.\nAre you sure you want to do this?"] = "Loading a new game will end your current game.\nAre you sure you want to do this?"
|
||||
|
||||
label _load_screen:
|
||||
|
||||
if renpy.has_label("_load_screen_hook"):
|
||||
call expression "_load_screen_hook" from _call__load_screen_hook
|
||||
|
||||
python hide:
|
||||
|
||||
fn, exists = _file_picker("load", False )
|
||||
|
||||
if not renpy.context().main_menu and _load_prompt:
|
||||
if _yesno_prompt("load", u"Loading will lose unsaved progress.\nAre you sure you want to do this?"):
|
||||
renpy.load(fn)
|
||||
else:
|
||||
renpy.load(fn)
|
||||
|
||||
jump _load_screen
|
||||
|
||||
label _save_screen:
|
||||
|
||||
if renpy.has_label("_save_screen_hook"):
|
||||
call expression "_save_screen_hook" from _call__save_screen_hook
|
||||
|
||||
$ _fn, _exists = _file_picker("save", True)
|
||||
|
||||
if not _exists or _yesno_prompt("save", u"Are you sure you want to overwrite your save?"):
|
||||
python hide:
|
||||
|
||||
if save_name:
|
||||
full_save_name = save_name
|
||||
else:
|
||||
full_save_name = ""
|
||||
|
||||
try:
|
||||
renpy.save(_fn, full_save_name)
|
||||
|
||||
except Exception, e:
|
||||
|
||||
if config.debug:
|
||||
raise
|
||||
|
||||
message = ( _(u"The error message was:") + "\n\n" +
|
||||
e.__class__.__name__ + ": " + unicode(e) + "\n\n" +
|
||||
_(u"You may want to try saving in a different slot, or playing for a while and trying again later.") )
|
||||
|
||||
_show_exception(_(u"Save Failed."), message)
|
||||
|
||||
|
||||
jump _save_screen
|
||||
@@ -0,0 +1,109 @@
|
||||
init:
|
||||
python:
|
||||
|
||||
# A dict of 5-tuples mapping button labels to image buttons.
|
||||
config.image_buttons = { }
|
||||
|
||||
# A dict mapping label to image.
|
||||
config.image_labels = { }
|
||||
|
||||
# Maps from button or label to additional properties.
|
||||
config.button_properties = { }
|
||||
config.button_text_properties = { }
|
||||
config.label_properties = { }
|
||||
|
||||
def _button_factory(label,
|
||||
type=None,
|
||||
selected=None,
|
||||
disabled=False,
|
||||
clicked=None,
|
||||
properties={},
|
||||
index=None,
|
||||
**props):
|
||||
"""
|
||||
This function is called to create the various buttons used
|
||||
in the game menu. By overriding this function, one can
|
||||
(for example) replace the default textbuttons with image buttons.
|
||||
When it is called, it's expected to add a button to the screen.
|
||||
|
||||
@param label: The label of this button, before translation.
|
||||
|
||||
@param type: The type of the button. One of "mm" (main menu),
|
||||
"gm_nav" (game menu), "file_picker_nav", "yesno", or "prefs".
|
||||
|
||||
@param selected: True if the button is selected, False if not,
|
||||
or None if it doesn't matter.
|
||||
|
||||
@param disabled: True if the button is disabled, False if not.
|
||||
|
||||
@param clicked: A function that should be executed when the
|
||||
button is clicked.
|
||||
|
||||
@param properties: Addtional layout properties.
|
||||
"""
|
||||
|
||||
props.update(properties)
|
||||
props.update(config.button_properties.get(label, { }))
|
||||
|
||||
if disabled:
|
||||
clicked = None
|
||||
|
||||
if selected and not disabled:
|
||||
role = "selected_"
|
||||
else:
|
||||
role = ""
|
||||
|
||||
|
||||
if label in config.image_buttons:
|
||||
|
||||
(idle, hover, sel_idle, sel_hover, disabled) = config.image_buttons[label]
|
||||
|
||||
ui.imagebutton(idle,
|
||||
hover,
|
||||
disabled,
|
||||
hover,
|
||||
sel_idle,
|
||||
sel_hover,
|
||||
disabled,
|
||||
sel_hover,
|
||||
clicked=clicked,
|
||||
style=style.image_button[label],
|
||||
role=role,
|
||||
**props)
|
||||
|
||||
return
|
||||
|
||||
button_style = type + "_button"
|
||||
text_style = type + "_button_text"
|
||||
|
||||
if index is None:
|
||||
index = label
|
||||
|
||||
button_style = getattr(style, button_style)[index]
|
||||
text_style = getattr(style, text_style)[index]
|
||||
|
||||
ui.button(style=button_style, clicked=clicked, role=role, **props)
|
||||
ui.text(_(label), style=text_style, **config.button_text_properties.get(label, { }))
|
||||
|
||||
def _label_factory(label, type, properties={}, **props):
|
||||
"""
|
||||
This function is called to create a new label. It can be
|
||||
overridden by the user to change how these labels are created.
|
||||
|
||||
@param label: The label of the box.
|
||||
|
||||
@param type: "prefs" or "yesno". (perhaps more by now.)
|
||||
|
||||
@param properties: This may contain position properties.
|
||||
"""
|
||||
|
||||
props.update(properties)
|
||||
props.update(config.label_properties.get(label, { }))
|
||||
|
||||
if label in config.image_labels:
|
||||
ui.image(config.image_labels[label], **props)
|
||||
return
|
||||
|
||||
style = getattr(store.style, type + "_label")[label]
|
||||
|
||||
ui.text(_(label), style=style, **props)
|
||||
@@ -0,0 +1,59 @@
|
||||
init -1170 python hide:
|
||||
|
||||
config.old_names['Quit'] = 'Quit Game'
|
||||
|
||||
# The contents of the main menu.
|
||||
config.main_menu = [
|
||||
( u"Start Game", "start", 'True'),
|
||||
( u"Continue Game", _intra_jumps("_load_screen", "main_game_transition"), 'True' ),
|
||||
( u"Preferences", _intra_jumps("_prefs_screen", "main_game_transition"), 'True' ),
|
||||
( u"Quit", ui.jumps("_quit"), 'True' ),
|
||||
]
|
||||
|
||||
# If not None, this is used to fix the positions of the
|
||||
# things in the main menu.
|
||||
config.main_menu_positions = None
|
||||
|
||||
# Styles used in this file.
|
||||
|
||||
# This is the default main menu, which we get if the user hasn't
|
||||
# defined his own, or if that function calls this explicitly.
|
||||
label _library_main_menu:
|
||||
|
||||
python hide:
|
||||
|
||||
ui.add(renpy.Keymap(toggle_fullscreen = renpy.toggle_fullscreen))
|
||||
|
||||
ui.window(style='mm_root')
|
||||
ui.null()
|
||||
|
||||
if not config.main_menu_positions:
|
||||
ui.window(style='mm_menu_frame')
|
||||
ui.vbox(style='mm_menu_frame_vbox')
|
||||
|
||||
for i, (text, clicked, enabled) in enumerate(config.main_menu):
|
||||
|
||||
if isinstance(clicked, basestring):
|
||||
clicked = ui.jumpsoutofcontext(clicked)
|
||||
|
||||
if config.main_menu_positions:
|
||||
kwargs = config.main_menu_positions.get(text, { })
|
||||
else:
|
||||
kwargs = { }
|
||||
|
||||
if not eval(enabled):
|
||||
clicked = None
|
||||
disabled = True
|
||||
else:
|
||||
disabled = False
|
||||
|
||||
_button_factory(text, "mm", clicked=clicked, disabled=disabled, properties=kwargs)
|
||||
|
||||
if not config.main_menu_positions:
|
||||
ui.close()
|
||||
|
||||
store._result = ui.interact(suppress_overlay=True,
|
||||
suppress_underlay=True,
|
||||
mouse="mainmenu")
|
||||
|
||||
jump _main_menu
|
||||
@@ -0,0 +1,604 @@
|
||||
# Copyright 2004-2006 PyTom
|
||||
#
|
||||
# Please see the LICENSE.txt distributed with Ren'Py for permission to
|
||||
# copy and modify.
|
||||
|
||||
# This file contains the code to implement the Ren'Py preferences
|
||||
# screen.
|
||||
|
||||
init python:
|
||||
|
||||
# This is a map from the name of the style that is applied to
|
||||
# a list of preferences that should be placed into a vbox
|
||||
# with that style.
|
||||
config.preferences = { }
|
||||
|
||||
# Ditto, for joystick preferences.
|
||||
config.joystick_preferences = { }
|
||||
|
||||
# Positions for preferences... overrides the above.
|
||||
config.preference_positions = None
|
||||
config.joystick_preference_positions = None
|
||||
|
||||
# This is a map from preference name to that preference
|
||||
# object, that can be used in rearranging preferences.
|
||||
config.all_preferences = { }
|
||||
|
||||
# If true, the preference choices will be arranged in an
|
||||
# hbox.
|
||||
config.hbox_pref_choices = False
|
||||
|
||||
# A list of (readable name, synthetic key) tuples
|
||||
# corresponding to joystick events.
|
||||
config.joystick_keys = [
|
||||
(u'Left', 'joy_left'),
|
||||
(u'Right', 'joy_right'),
|
||||
(u'Up', 'joy_up'),
|
||||
(u'Down', 'joy_down'),
|
||||
(u'Select/Dismiss', 'joy_dismiss'),
|
||||
(u'Rollback', 'joy_rollback'),
|
||||
(u'Hold to Skip', 'joy_holdskip'),
|
||||
(u'Toggle Skip', 'joy_toggleskip'),
|
||||
(u'Hide Text', 'joy_hide'),
|
||||
(u'Menu', 'joy_menu'),
|
||||
]
|
||||
|
||||
# If True, then we can always get into the joystick
|
||||
# preferences.
|
||||
config.always_has_joystick = False
|
||||
|
||||
|
||||
def _prefs_screen_run(prefs_map, positions):
|
||||
|
||||
|
||||
_game_nav("prefs")
|
||||
|
||||
if positions is not None:
|
||||
for name, pos in positions.iteritems():
|
||||
ui.vbox(**pos)
|
||||
config.all_preferences[name].render_preference()
|
||||
ui.close()
|
||||
|
||||
else:
|
||||
|
||||
### prefs_frame default
|
||||
# (window) A window containing all preferences.
|
||||
|
||||
ui.window(style='prefs_frame')
|
||||
ui.fixed()
|
||||
|
||||
for style, prefs in prefs_map.iteritems():
|
||||
|
||||
ui.vbox(style=style)
|
||||
for i in prefs:
|
||||
i.render_preference()
|
||||
ui.close()
|
||||
|
||||
ui.close()
|
||||
|
||||
_game_interact()
|
||||
|
||||
|
||||
class _Preference(object):
|
||||
"""
|
||||
This is a class that's used to represent a multiple-choice
|
||||
preference.
|
||||
"""
|
||||
|
||||
def __init__(self, name, field, values, base=_preferences):
|
||||
"""
|
||||
@param name: The name of this preference. It will be
|
||||
displayed to the user.
|
||||
|
||||
@param variable: The field on the base object
|
||||
that will be assigned the selected value. This field
|
||||
must exist.
|
||||
|
||||
@param values: A list of value name, value, condition
|
||||
triples. The value name is the name of this value that
|
||||
will be shown to the user. The value is the literal
|
||||
python value that will be assigned if this value is
|
||||
selected. The condition is a condition that will be
|
||||
evaluated to determine if this is a legal value. If no
|
||||
conditions are true, this preference will not be
|
||||
displayed to the user. A condition of None is always
|
||||
considered to be True.
|
||||
|
||||
@param base: The base object on which the variable is
|
||||
read from and set. This defaults to _preferences,
|
||||
the user preferences object.
|
||||
"""
|
||||
|
||||
self.name = name
|
||||
self.field = field
|
||||
self.values = values
|
||||
self.base = base
|
||||
|
||||
config.all_preferences[name] = self
|
||||
|
||||
def render_preference(self):
|
||||
values = [ (name, val) for name, val, cond in self.values
|
||||
if cond is None or renpy.eval(cond) ]
|
||||
|
||||
if not values:
|
||||
return
|
||||
|
||||
|
||||
ui.window(style=style.prefs_pref_frame[self.name])
|
||||
ui.vbox(style=style.prefs_pref_vbox[self.name])
|
||||
|
||||
_label_factory(self.name, "prefs")
|
||||
|
||||
cur = getattr(self.base, self.field)
|
||||
|
||||
### prefs_hbox default
|
||||
# If config.hbox_pref_choices is True, the style
|
||||
# of the hbox containing the choices.
|
||||
|
||||
if config.hbox_pref_choices:
|
||||
ui.hbox(style=style.prefs_hbox[self.name])
|
||||
|
||||
for name, value in values:
|
||||
|
||||
### prefs_button menu_button
|
||||
# (window, hover) The style of an unselected preferences
|
||||
# button.
|
||||
|
||||
### prefs_button_text menu_button_text
|
||||
# (text, hover) The style of the text of an unselected
|
||||
# preferences button.
|
||||
|
||||
def clicked(value=value):
|
||||
setattr(self.base, self.field, value)
|
||||
return True
|
||||
|
||||
_button_factory(name, "prefs",
|
||||
selected=cur==value,
|
||||
clicked=clicked)
|
||||
|
||||
if config.hbox_pref_choices:
|
||||
ui.close()
|
||||
|
||||
ui.close()
|
||||
|
||||
|
||||
class _VolumePreference(object):
|
||||
"""
|
||||
This represents a preference that controls one of the
|
||||
volumes in the system. It is represented as a slider bar,
|
||||
and a button that can be pushed to play a sample sound on
|
||||
a channel.
|
||||
"""
|
||||
|
||||
def __init__(self, name, mixer, enable='True', sound='None', channel=0):
|
||||
"""
|
||||
@param name: The name of this preference, as shown to the user.
|
||||
|
||||
@param mixer: The mixer this preference controls.
|
||||
|
||||
@param enable: A string giving a python expression. If
|
||||
the expression is evaluates to false, this preference
|
||||
is not shown.
|
||||
|
||||
@param sound: A string that is evaluated to yield
|
||||
another string. The yielded string is expected to give
|
||||
a sound file, which is played as the sample sound. (We
|
||||
apologize for the convolution of this.)
|
||||
|
||||
@param channel: The number of the channel the sample
|
||||
sound is played on.
|
||||
"""
|
||||
|
||||
self.name = name
|
||||
self.mixer = mixer
|
||||
self.enable = enable
|
||||
self.sound = sound
|
||||
self.channel = channel
|
||||
|
||||
config.all_preferences[name] = self
|
||||
|
||||
def render_preference(self):
|
||||
|
||||
if not eval(self.enable):
|
||||
return
|
||||
|
||||
sound = eval(self.sound)
|
||||
|
||||
ui.window(style=style.prefs_pref_frame[self.name])
|
||||
ui.vbox(style=style.prefs_pref_vbox[self.name])
|
||||
|
||||
_label_factory(self.name, "prefs")
|
||||
|
||||
def changed(v):
|
||||
|
||||
_preferences.set_volume(self.mixer, v / 128.0)
|
||||
|
||||
ui.bar(128,
|
||||
int(_preferences.get_volume(self.mixer) * 128),
|
||||
changed=changed,
|
||||
style=style.prefs_volume_slider[self.name])
|
||||
|
||||
if sound:
|
||||
def clicked():
|
||||
renpy.sound.play(sound, channel=self.channel)
|
||||
|
||||
_button_factory(u"Test", "soundtest", clicked=clicked, index=self.name)
|
||||
|
||||
ui.close()
|
||||
|
||||
class _SliderPreference(object):
|
||||
"""
|
||||
A class that represents a preference that is controlled by a
|
||||
slider.
|
||||
"""
|
||||
|
||||
def __init__(self, name, range, get, set, enable='True'):
|
||||
"""
|
||||
@param set: The name of this preference, that is shown to the user.
|
||||
|
||||
@param range: An integer giving the maximum value of
|
||||
this slider. The slider goes from 0 to range.
|
||||
|
||||
@param get: A function that's called to get the
|
||||
initial value of the slider. It's called with no
|
||||
arguments, and should return an integet between 0 and
|
||||
range, inclusive.
|
||||
|
||||
@param set: A function that's called when the value of
|
||||
the slider is set by the user. It is called with a
|
||||
single integer, in the range 0 to range, inclusive.
|
||||
|
||||
@param enable: A string giving a python expression. If
|
||||
the expression is evaluates to false, this preference
|
||||
is not shown.
|
||||
"""
|
||||
|
||||
self.name = name
|
||||
self.range = range
|
||||
self.get = get
|
||||
self.set = set
|
||||
self.enable = enable
|
||||
|
||||
config.all_preferences[name] = self
|
||||
|
||||
def render_preference(self):
|
||||
|
||||
if not eval(self.enable):
|
||||
return
|
||||
|
||||
ui.window(style=style.prefs_pref_frame[self.name])
|
||||
ui.vbox(style=style.prefs_pref_vbox[self.name])
|
||||
|
||||
_label_factory(self.name, "prefs")
|
||||
|
||||
def changed(v):
|
||||
self.set(v)
|
||||
|
||||
### prefs_slider bar
|
||||
# (bar) The style that is applied to preference
|
||||
# sliders.
|
||||
|
||||
ui.bar(self.range,
|
||||
self.get(),
|
||||
changed=changed,
|
||||
style=style.prefs_slider[self.name])
|
||||
|
||||
ui.close()
|
||||
|
||||
|
||||
class _PreferenceSpinner(object):
|
||||
"""
|
||||
This is a class that's used to represent a preference
|
||||
spinner, which is a preference that can be incremented
|
||||
and decremented, when shown to the user.
|
||||
"""
|
||||
|
||||
def __init__(self, name, field, minimum, maximum, delta,
|
||||
cond = "True", render = lambda x : str(x),
|
||||
base=_preferences):
|
||||
"""
|
||||
@param name: The name of this preference, that is presented
|
||||
to the user.
|
||||
|
||||
@param field: The name of the field on the base object
|
||||
that is updated by this spinner.
|
||||
|
||||
@param minimum: The minimum value that this spinner can set
|
||||
the value to.
|
||||
|
||||
@param maximum: The maximum value that this spinner can set
|
||||
the value to.
|
||||
|
||||
@param delta: The delta by which this spinner is
|
||||
incremented or decremented.
|
||||
|
||||
@param cond: If this condition is not true, this spinner is
|
||||
not shown.
|
||||
|
||||
@param render: This function is called with the value of
|
||||
the field, and is expected to render that value to a
|
||||
string.
|
||||
|
||||
@param base: The base object that this spinner updates
|
||||
the field on. It defaults to _preferences, the preferences
|
||||
object.
|
||||
"""
|
||||
|
||||
self.name = name
|
||||
self.field = field
|
||||
self.minimum = minimum
|
||||
self.maximum = maximum
|
||||
self.delta = delta
|
||||
self.cond = cond
|
||||
self.render = render
|
||||
self.base = base
|
||||
|
||||
config.all_preferences[name] = self
|
||||
|
||||
def render_preference(self):
|
||||
|
||||
if not renpy.eval(self.cond):
|
||||
return
|
||||
|
||||
ui.window(style=style.prefs_pref_frame[self.name])
|
||||
ui.vbox(style=style.prefs_pref_vbox[self.name])
|
||||
|
||||
_label_factory(self.name, "prefs")
|
||||
|
||||
cur = getattr(self.base, self.field)
|
||||
|
||||
def minus_clicked():
|
||||
value = cur - self.delta
|
||||
value = max(self.minimum, value)
|
||||
setattr(self.base, self.field, value)
|
||||
return True
|
||||
|
||||
def plus_clicked():
|
||||
value = cur + self.delta
|
||||
value = min(self.maximum, value)
|
||||
setattr(self.base, self.field, value)
|
||||
return True
|
||||
|
||||
ui.hbox(style=style.prefs_spinner[self.name])
|
||||
_button_factory("-", "prefs_spinner", clicked=minus_clicked)
|
||||
_label_factory(self.render(cur), "prefs_spinner")
|
||||
_button_factory("+", "prefs_spinner", clicked=plus_clicked)
|
||||
ui.close()
|
||||
|
||||
ui.close()
|
||||
|
||||
def _joystick_select_binding():
|
||||
|
||||
for label, key in config.joystick_keys:
|
||||
|
||||
def my_clicked(label=label, key=key):
|
||||
return (label, key)
|
||||
|
||||
_button_factory(_(label) + " - " + _(_preferences.joymap.get(key, u"Not Assigned")), "prefs_js", clicked=my_clicked, index=label)
|
||||
|
||||
|
||||
def _joystick_get_binding():
|
||||
ui.add(renpy.display.joystick.JoyBehavior())
|
||||
ui.saybehavior()
|
||||
|
||||
def _joystick_take_binding(binding, key):
|
||||
|
||||
if not isinstance(binding, basestring):
|
||||
if key in _preferences.joymap:
|
||||
del _preferences.joymap[key]
|
||||
else:
|
||||
_preferences.joymap[key] = binding
|
||||
|
||||
|
||||
|
||||
class _JoystickPreference(object):
|
||||
|
||||
def __init__(self, name):
|
||||
self.name = name
|
||||
config.all_preferences[name] = self
|
||||
|
||||
|
||||
def render_preference(self):
|
||||
|
||||
def set_binding(label, key):
|
||||
_game_nav(None)
|
||||
|
||||
ui.window(style='js_frame')
|
||||
ui.vbox(style='js_frame_vbox')
|
||||
_label_factory(_(u"Joystick Mapping") + " - " + _(label), "js_function")
|
||||
_label_factory(u'Move the joystick or press a joystick button to create the mapping. Click the mouse to remove the mapping.', 'js_prompt')
|
||||
ui.close()
|
||||
|
||||
_joystick_get_binding()
|
||||
binding = _game_interact()
|
||||
_joystick_take_binding(binding, key)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
ui.window(style='prefs_js_frame')
|
||||
ui.vbox(style='prefs_js_vbox')
|
||||
_label_factory(self.name, 'prefs')
|
||||
|
||||
for label, key in config.joystick_keys:
|
||||
|
||||
def clicked(label=label, key=key):
|
||||
return renpy.invoke_in_new_context(set_binding, label, key)
|
||||
|
||||
_button_factory(_(label) + " - " + _(_preferences.joymap.get(key, u"Not Assigned")), "prefs_js", clicked=clicked, index=label)
|
||||
|
||||
ui.close()
|
||||
|
||||
|
||||
class _JumpPreference(object):
|
||||
|
||||
def __init__(self, name, target, condition="True"):
|
||||
self.name = name
|
||||
self.target = target
|
||||
self.condition = condition
|
||||
|
||||
config.all_preferences[name] = self
|
||||
|
||||
def render_preference(self):
|
||||
|
||||
ui.window(style=style.prefs_jump[self.name])
|
||||
|
||||
if eval(self.condition):
|
||||
clicked=ui.jumps(self.target)
|
||||
else:
|
||||
clicked=None
|
||||
|
||||
_button_factory(self.name, 'prefs_jump', clicked=clicked)
|
||||
|
||||
def _remove_preference(name):
|
||||
"""
|
||||
Removes the preference with the given name from the
|
||||
preferences menu.
|
||||
"""
|
||||
|
||||
pref = config.all_preferences.get(name, None)
|
||||
if not pref:
|
||||
return
|
||||
|
||||
for k, v in config.preferences.iteritems():
|
||||
if pref in v:
|
||||
v.remove(pref)
|
||||
|
||||
init python hide:
|
||||
|
||||
# Enablers for some preferences.
|
||||
config.has_music = True
|
||||
config.has_sound = True
|
||||
config.sample_sound = None
|
||||
config.has_transitions = True
|
||||
config.has_cps = True
|
||||
config.has_afm = True
|
||||
config.has_skipping = True
|
||||
config.has_skip_after_choice = True
|
||||
|
||||
|
||||
# Left
|
||||
|
||||
pl1 = _Preference(u'Display', 'fullscreen', [
|
||||
(u'Window', False, None),
|
||||
(u'Fullscreen', True, None),
|
||||
])
|
||||
|
||||
pl2 = _Preference(u'Transitions', 'transitions', [
|
||||
(u'All', 2, 'config.has_transitions'),
|
||||
(u'Some', 1, 'config.has_transitions and default_transition'),
|
||||
(u'None', 0, 'config.has_transitions'),
|
||||
])
|
||||
|
||||
# Center
|
||||
|
||||
pc1 = _Preference(u'Skip', 'skip_unseen', [
|
||||
(u'Seen Messages', False, 'config.allow_skipping and config.has_skipping'),
|
||||
(u'All Messages', True, 'config.allow_skipping and config.has_skipping'),
|
||||
])
|
||||
|
||||
config.old_names['Skip'] = 'TAB and CTRL Skip'
|
||||
config.all_preferences['TAB and CTRL Skip'] = pc1
|
||||
|
||||
|
||||
pc2= _Preference(u'After Choices', 'skip_after_choices', [
|
||||
(u'Stop Skipping', False, 'config.allow_skipping and config.has_skip_after_choice'),
|
||||
(u'Keep Skipping', True, 'config.allow_skipping and config.has_skip_after_choice'),
|
||||
])
|
||||
|
||||
config.old_names['Keep Skipping'] = 'Continue Skipping'
|
||||
|
||||
def cps_get():
|
||||
cps = _preferences.text_cps
|
||||
if cps == 0:
|
||||
cps = 150
|
||||
else:
|
||||
cps -= 1
|
||||
return cps
|
||||
|
||||
def cps_set(cps):
|
||||
cps += 1
|
||||
if cps == 151:
|
||||
cps = 0
|
||||
_preferences.text_cps = cps
|
||||
|
||||
|
||||
pc3 = _SliderPreference(u'Text Speed', 150, cps_get, cps_set,
|
||||
'config.has_cps')
|
||||
|
||||
|
||||
def afm_get():
|
||||
afm = _preferences.afm_time
|
||||
if afm == 0:
|
||||
afm = 40
|
||||
else:
|
||||
afm -= 1
|
||||
return afm
|
||||
|
||||
def afm_set(afm):
|
||||
afm += 1
|
||||
if afm == 41:
|
||||
afm = 0
|
||||
_preferences.afm_time = afm
|
||||
|
||||
pc4 = _SliderPreference(u'Auto-Forward Time', 40, afm_get, afm_set,
|
||||
'config.has_afm')
|
||||
|
||||
# Right
|
||||
|
||||
pr1 = _VolumePreference(u"Music Volume", 'music', 'config.has_music')
|
||||
pr2 = _VolumePreference(u"Sound Volume", 'sfx', 'config.has_sound', 'config.sample_sound')
|
||||
|
||||
_JumpPreference(u'Joystick...', '_joystick_screen', 'renpy.display.joystick.enabled or config.always_has_joystick')
|
||||
|
||||
_JoystickPreference(u'Joystick Configuration')
|
||||
|
||||
config.preferences['prefs_left'] = [
|
||||
config.all_preferences[u'Display'],
|
||||
config.all_preferences[u'Transitions'],
|
||||
config.all_preferences[u'Joystick...'],
|
||||
]
|
||||
|
||||
config.preferences['prefs_center'] = [
|
||||
config.all_preferences[u'Skip'],
|
||||
config.all_preferences[u'After Choices'],
|
||||
config.all_preferences[u'Text Speed'],
|
||||
config.all_preferences[u'Auto-Forward Time'],
|
||||
]
|
||||
|
||||
config.preferences['prefs_right'] = [
|
||||
config.all_preferences[u'Music Volume'],
|
||||
config.all_preferences[u'Sound Volume'],
|
||||
]
|
||||
|
||||
config.joystick_preferences['prefs_joystick'] = [
|
||||
config.all_preferences[u'Joystick Configuration'],
|
||||
]
|
||||
|
||||
config.sample_voice = None
|
||||
|
||||
vp = _VolumePreference(u'Voice Volume',
|
||||
'voice',
|
||||
'config.has_voice',
|
||||
'config.sample_voice',
|
||||
2)
|
||||
|
||||
config.preferences['prefs_right'].insert(1, vp)
|
||||
|
||||
label _prefs_screen:
|
||||
|
||||
$ _prefs_screen_run(config.preferences, config.preference_positions)
|
||||
|
||||
jump _prefs_screen
|
||||
|
||||
label _joystick_screen:
|
||||
|
||||
$ _prefs_screen_run(config.joystick_preferences, config.joystick_preference_positions)
|
||||
|
||||
jump _joystick_screen
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,354 @@
|
||||
init python hide:
|
||||
|
||||
style.menu_button = Style(style.button, heavy=True, help='Buttons that are part of the main or game menus.')
|
||||
style.menu_button_text = Style(style.button_text, heavy=True, help='The label of buttons that are part of the main or game menus.')
|
||||
|
||||
style.thin_hbox = Style(style.hbox, heavy=True, help='A hbox with a small amount of spacing.')
|
||||
style.thick_hbox = Style(style.hbox, heavy=True, help='A hbox with a large amount of spacing.')
|
||||
style.thin_vbox = Style(style.vbox, heavy=True, help='A vbox with a small amount of spacing.')
|
||||
style.thick_vbox = Style(style.vbox, heavy=True, help='A vbox with a large amount of spacing.')
|
||||
|
||||
style.mm_menu_frame = Style(style.default, heavy=True, help='The frame containing the main menu.')
|
||||
style.mm_menu_frame_vbox = Style(style.thin_vbox, heavy=True, help='The vbox containing the main menu.')
|
||||
style.mm_button = Style(style.menu_button, heavy=True, help='A main menu button.')
|
||||
style.mm_button_text = Style(style.menu_button_text, heavy=True, help='A main menu button label.')
|
||||
style.default.drop_shadow = (1, 1)
|
||||
|
||||
style.gm_nav_frame = Style(style.default, heavy=True, help='The frame containing the navigation buttons.')
|
||||
style.gm_nav_vbox = Style(style.thin_vbox, heavy=True, help='The vbox containing the navigation buttons.')
|
||||
style.gm_nav_button = Style(style.menu_button, heavy=True, help='A navigation button.')
|
||||
style.gm_nav_button_text = Style(style.menu_button_text, heavy=True, help='A navigation button label.')
|
||||
|
||||
style.file_picker_entry = Style(style.menu_button, heavy=True, help='A button you click to save or load a file.')
|
||||
style.file_picker_entry_box = Style(style.thin_hbox, heavy=True, help='The box inside that button.')
|
||||
style.file_picker_text = Style(style.default, heavy=True, help='Base style for text inside a file picker entry.')
|
||||
style.file_picker_new = Style(style.file_picker_text, heavy=True, help='The number of the newest file.')
|
||||
style.file_picker_old = Style(style.file_picker_text, heavy=True, help='The number of non-newest files.')
|
||||
style.file_picker_extra_info = Style(style.file_picker_text, heavy=True, help='Extra text (the date and save info) of a file.')
|
||||
style.file_picker_empty_slot = Style(style.file_picker_text, heavy=True, help='The style of "Empty Slot" text.')
|
||||
style.file_picker_frame = Style(style.default, heavy=True, help='The frame containing the file picker.')
|
||||
style.file_picker_frame_vbox = Style(style.thin_vbox, heavy=True, help='The box containing file picker navigation and the file picker grid.')
|
||||
style.file_picker_navbox = Style(style.thick_hbox, heavy=True, help='The box containing the file picker navigation buttons.')
|
||||
style.file_picker_nav_button = Style(style.menu_button, heavy=True, help='A file picker navigation button.')
|
||||
style.file_picker_nav_button_text = Style(style.menu_button_text, heavy=True, help='A file picker navigation button label.')
|
||||
style.file_picker_grid = Style(style.default, heavy=True, help='The grid containing the entries in the file picker.')
|
||||
|
||||
style.yesno_frame = Style(style.default, heavy=True, help='The frame containing the yes/no dialog.')
|
||||
style.yesno_frame_vbox = Style(style.thick_vbox, heavy=True, help='Separates the label from the buttons in a yes/no dialog.')
|
||||
style.yesno_label = Style(style.default, heavy=True, help='The label of a yes/no dialog.')
|
||||
style.yesno_button_hbox = Style(style.thick_hbox, heavy=True, help="The box containing the Yes and No buttons.")
|
||||
style.yesno_button = Style(style.menu_button, heavy=True, help='A Yes/No button.')
|
||||
style.yesno_button_text = Style(style.menu_button_text, heavy=True, help='A Yes/No button label.')
|
||||
|
||||
|
||||
style.prefs_frame = Style(style.default, heavy=True, help='')
|
||||
style.prefs_pref_frame = Style(style.default, heavy=True, help='')
|
||||
style.prefs_pref_vbox = Style(style.thin_vbox, heavy=True, help='')
|
||||
style.prefs_label = Style(style.default, heavy=True, help='')
|
||||
style.prefs_hbox = Style(style.default, heavy=True, help='')
|
||||
style.prefs_button = Style(style.menu_button, heavy=True, help='')
|
||||
style.prefs_button_text = Style(style.menu_button_text, heavy=True, help='')
|
||||
style.soundtest_button = Style(style.prefs_button, heavy=True, help='')
|
||||
style.soundtest_button_text = Style(style.prefs_button_text, heavy=True, help='')
|
||||
style.prefs_slider = Style(style.bar, heavy=True, help='')
|
||||
style.prefs_volume_slider = Style(style.prefs_slider, heavy=True, help='')
|
||||
style.prefs_spinner = Style(style.default, heavy=True, help='')
|
||||
style.prefs_spinner_label = Style(style.prefs_label, heavy=True, help='')
|
||||
style.prefs_spinner_button = Style(style.prefs_button, heavy=True, help='')
|
||||
style.prefs_spinner_button_text = Style(style.prefs_button_text, heavy=True, help='')
|
||||
style.prefs_js_frame = Style(style.prefs_pref_frame, heavy=True, help='')
|
||||
style.prefs_js_vbox = Style(style.prefs_pref_vbox, heavy=True, help='')
|
||||
style.prefs_js_button = Style(style.prefs_button, heavy=True, help='')
|
||||
style.prefs_js_button_text = Style(style.prefs_button_text, heavy=True, help='')
|
||||
style.js_frame = Style(style.prefs_frame, heavy=True, help='')
|
||||
style.js_frame_vbox = Style(style.thick_vbox, heavy=True, help='')
|
||||
style.js_function_label = Style(style.prefs_label, heavy=True, help='')
|
||||
style.js_prompt_label = Style(style.prefs_label, heavy=True, help='')
|
||||
style.prefs_jump = Style(style.prefs_pref_frame, heavy=True, help='')
|
||||
style.prefs_jump_button = Style(style.prefs_button, heavy=True, help='')
|
||||
style.prefs_jump_button_text = Style(style.prefs_button_text, heavy=True, help='')
|
||||
style.prefs_column = Style(style.default, heavy=True, help='')
|
||||
style.prefs_left = Style(style.prefs_column, heavy=True, help='')
|
||||
style.prefs_center = Style(style.prefs_column, heavy=True, help='')
|
||||
style.prefs_right = Style(style.prefs_column, heavy=True, help='')
|
||||
style.prefs_joystick = Style(style.prefs_center, heavy=True, help='')
|
||||
|
||||
style.thin_hbox.spacing = 3
|
||||
style.thick_hbox.spacing = 30
|
||||
style.thin_vbox.spacing = 0
|
||||
style.thick_vbox.spacing = 30
|
||||
|
||||
dark_cyan = (0, 192, 255, 255)
|
||||
bright_cyan = (0, 255, 255, 255)
|
||||
dark_red = (255, 128, 128, 255)
|
||||
bright_red = (255, 64, 64, 255)
|
||||
green = (0, 128, 0, 255)
|
||||
|
||||
# Frames.
|
||||
style.frame.background = Solid((0, 0, 128, 128))
|
||||
style.frame.xpadding = 10
|
||||
style.frame.ypadding = 5
|
||||
style.frame.xmargin = 10
|
||||
style.frame.ymargin = 5
|
||||
|
||||
|
||||
######################################################################
|
||||
# Buttons.
|
||||
|
||||
style.button_text.color = dark_cyan
|
||||
style.button_text.hover_color = bright_cyan
|
||||
style.button_text.insensitive_color = (192, 192, 192, 255)
|
||||
style.button_text.size = 24
|
||||
style.button_text.drop_shadow = (2, 2)
|
||||
|
||||
style.button_text.selected_color = dark_red
|
||||
style.button_text.selected_hover_color = bright_red
|
||||
|
||||
style.button_text.xpos = 0.5
|
||||
style.button_text.xanchor = 0.5
|
||||
|
||||
style.menu_button.xpos = 0.5
|
||||
style.menu_button.xanchor = 0.5
|
||||
|
||||
|
||||
######################################################################
|
||||
# Bar.
|
||||
|
||||
style.bar.ymaximum = 22
|
||||
|
||||
style.bar.left_bar = Solid(bright_cyan)
|
||||
style.bar.right_bar = Solid((0, 0, 0, 128))
|
||||
style.bar.bottom_bar = Solid(bright_cyan)
|
||||
style.bar.top_bar = Solid((0, 0, 0, 128))
|
||||
style.bar.left_gutter = 0
|
||||
style.bar.right_gutter = 0
|
||||
style.bar.thumb = None
|
||||
style.bar.thumb_offset = 0
|
||||
style.bar.thumb_shadow = None
|
||||
|
||||
style.vbar.xmaximum = 22
|
||||
|
||||
style.vbar.left_bar = Solid(bright_cyan)
|
||||
style.vbar.right_bar = Solid((0, 0, 0, 128))
|
||||
style.vbar.bottom_bar = Solid(bright_cyan)
|
||||
style.vbar.top_bar = Solid((0, 0, 0, 128))
|
||||
style.vbar.left_gutter = 0
|
||||
style.vbar.right_gutter = 0
|
||||
style.vbar.bottom_gutter = 0
|
||||
style.vbar.top_gutter = 0
|
||||
style.vbar.thumb = None
|
||||
style.vbar.thumb_offset = 0
|
||||
style.vbar.thumb_shadow = None
|
||||
|
||||
style.vscrollbar.set_parent(style.vbar)
|
||||
style.scrollbar.set_parent(style.bar)
|
||||
|
||||
style.vscrollbar.bottom_bar = Solid((0, 0, 0, 128))
|
||||
style.vscrollbar.top_bar = Solid(bright_cyan)
|
||||
|
||||
style.slider.ymaximum = 1
|
||||
style.vslider.xmaximum = 1
|
||||
|
||||
######################################################################
|
||||
# Main menu.
|
||||
|
||||
style.mm_menu_frame.xpos = 0.9
|
||||
style.mm_menu_frame.xanchor = 1.0
|
||||
style.mm_menu_frame.ypos = 0.9
|
||||
style.mm_menu_frame.yanchor = 1.0
|
||||
|
||||
|
||||
######################################################################
|
||||
# Game menu common.
|
||||
|
||||
style.gm_nav_frame.xpos = 0.95
|
||||
style.gm_nav_frame.xanchor = 1.0
|
||||
style.gm_nav_frame.ypos = 0.95
|
||||
style.gm_nav_frame.yanchor = 1.0
|
||||
|
||||
|
||||
##############################################################################
|
||||
# File picker.
|
||||
|
||||
style.file_picker_frame.xpos = 0
|
||||
style.file_picker_frame.xanchor = 0.0
|
||||
style.file_picker_frame.ypos = 0
|
||||
style.file_picker_frame.yanchor = 0.0
|
||||
style.file_picker_frame.xpadding = 5
|
||||
|
||||
style.file_picker_navbox.xpos = 10
|
||||
|
||||
style.file_picker_grid.xfill = True
|
||||
|
||||
style.file_picker_entry.xpadding = 5
|
||||
style.file_picker_entry.ypadding = 2
|
||||
style.file_picker_entry.xmargin = 5
|
||||
style.file_picker_entry.xfill = True
|
||||
style.file_picker_entry.ymargin = 2
|
||||
style.file_picker_entry.background = Solid((255, 255, 255, 255))
|
||||
style.file_picker_entry.hover_background = Solid((255, 255, 192, 255))
|
||||
|
||||
style.file_picker_text.size = 16
|
||||
style.file_picker_text.color = dark_cyan
|
||||
style.file_picker_text.hover_color = bright_cyan
|
||||
|
||||
style.file_picker_new.hover_color = bright_red
|
||||
style.file_picker_new.idle_color = dark_red
|
||||
|
||||
style.file_picker_new.minwidth = 40
|
||||
style.file_picker_old.minwidth = 40
|
||||
|
||||
style.file_picker_new.text_align = 1.0
|
||||
style.file_picker_old.text_align = 1.0
|
||||
|
||||
|
||||
######################################################################
|
||||
# Yes/No Dialog
|
||||
|
||||
style.yesno_label.color = green
|
||||
style.yesno_label.textalign = 0.5
|
||||
style.yesno_label.xpos = 0.5
|
||||
style.yesno_label.xanchor = 0.5
|
||||
|
||||
style.yesno_frame.xfill = True
|
||||
style.yesno_frame.yminimum = 0.5
|
||||
style.yesno_frame.xmargin = .1
|
||||
|
||||
style.yesno_frame_vbox.xpos = 0.5
|
||||
style.yesno_frame_vbox.xanchor = 0.5
|
||||
style.yesno_frame_vbox.ypos = 0.5
|
||||
style.yesno_frame_vbox.yanchor = 0.5
|
||||
|
||||
style.yesno_button_hbox.xalign = 0.5
|
||||
style.yesno_button_hbox.spacing = 100
|
||||
|
||||
##############################################################################
|
||||
# Preferences.
|
||||
|
||||
|
||||
style.prefs_pref_frame.xpos = 0.5
|
||||
style.prefs_pref_frame.xanchor = 0.5
|
||||
style.prefs_pref_frame.bottom_margin = 10
|
||||
|
||||
style.prefs_label.xpos = 0.5
|
||||
style.prefs_label.xanchor = 0.5
|
||||
style.prefs_label.color = green
|
||||
|
||||
style.prefs_slider.xmaximum=200
|
||||
style.prefs_slider.ymaximum=22
|
||||
style.prefs_slider.xpos = 0.5
|
||||
style.prefs_slider.xanchor = 0.5
|
||||
|
||||
style.prefs_hbox.xpos = 0.5
|
||||
style.prefs_hbox.xanchor = 0.5
|
||||
|
||||
style.prefs_button.xpos = 0.5
|
||||
style.prefs_button.xanchor = 0.5
|
||||
|
||||
style.prefs_button.selected_xpos = 0.5
|
||||
style.prefs_button.selected_xanchor = 0.5
|
||||
|
||||
style.prefs_frame.xfill=True
|
||||
style.prefs_frame.ypadding = 0.05
|
||||
|
||||
style.prefs_column.spacing = 6
|
||||
|
||||
style.prefs_left.xanchor = 0.5
|
||||
style.prefs_left.xpos = 1.0 / 6.0
|
||||
|
||||
style.prefs_center.xanchor = 0.5
|
||||
style.prefs_center.xpos = 3.0 / 6.0
|
||||
|
||||
style.prefs_right.xanchor = 0.5
|
||||
style.prefs_right.xpos = 5.0 / 6.0
|
||||
|
||||
style.prefs_spinner.xpos = 0.5
|
||||
style.prefs_spinner.xanchor = 0.5
|
||||
|
||||
style.prefs_spinner_label.minwidth = 100
|
||||
style.prefs_spinner_label.textalign = 0.5
|
||||
|
||||
style.prefs_js_button_text.size = 18
|
||||
style.prefs_js_button_text.drop_shadow = (1, 1)
|
||||
|
||||
style.js_function_label.textalign = 0.5
|
||||
style.js_prompt_label.textalign = 0.5
|
||||
|
||||
style.js_frame.xfill = True
|
||||
style.js_frame.yminimum = 0.5
|
||||
style.js_frame.xmargin = .1
|
||||
|
||||
style.js_frame_vbox.xpos = 0.5
|
||||
style.js_frame_vbox.xanchor = 0.5
|
||||
style.js_frame_vbox.ypos = 0.5
|
||||
style.js_frame_vbox.yanchor = 0.5
|
||||
|
||||
style.soundtest_button.activate_sound = None
|
||||
|
||||
style.window.background = Solid((0, 0, 128, 128))
|
||||
style.window.xpadding = 10
|
||||
style.window.ypadding = 5
|
||||
style.window.xmargin = 10
|
||||
style.window.ymargin = 5
|
||||
style.window.xfill = True
|
||||
style.window.yfill = False
|
||||
style.window.xminimum = 0 # Includes margins and padding.
|
||||
style.window.yminimum = 150 # Includes margins and padding.
|
||||
|
||||
|
||||
|
||||
######################################################################
|
||||
# Compatibility names for renamed styles.
|
||||
style.file_picker_window_vbox = style.file_picker_frame_vbox
|
||||
style.prefs_window = style.prefs_frame
|
||||
style.mm_root_window = style.mm_root
|
||||
style.file_picker_window = style.file_picker_frame
|
||||
style.prefs_pref = style.prefs_pref_frame
|
||||
style.gm_root_window = style.gm_root
|
||||
style.yesno_window_vbox = style.yesno_frame_vbox
|
||||
style.joyprompt_label = style.js_prompt_label
|
||||
style.gm_nav_window = style.gm_nav_frame
|
||||
style.joy_window = style.js_frame
|
||||
style.mm_menu_window = style.mm_menu_frame
|
||||
style.error_window = style.error_root
|
||||
style.joyfunc_label = style.js_function_label
|
||||
style.joy_vbox = style.js_frame_vbox
|
||||
style.yesno_window = style.yesno_frame
|
||||
style.mm_menu_window_vbox = style.mm_menu_frame_vbox
|
||||
style.menu_choice_button_text = style.menu_choice
|
||||
style.menu_choice_chosen_button_text = style.menu_choice_chosen
|
||||
|
||||
store._selected_compat = [ ]
|
||||
|
||||
class _SelectedCompat(object):
|
||||
|
||||
def __init__(self, target):
|
||||
self.__dict__["target"] = target
|
||||
self.__dict__["property_updates"] = [ ]
|
||||
|
||||
store._selected_compat.append(self)
|
||||
|
||||
def __setattr__(self, k, v):
|
||||
self.property_updates.append((k, v))
|
||||
|
||||
def apply(self):
|
||||
target = getattr(style, self.target)
|
||||
for k, v in self.property_updates:
|
||||
setattr(target, "selected_" + k, v)
|
||||
|
||||
def clear(self):
|
||||
self.__dict__["property_updates"] = [ ]
|
||||
|
||||
|
||||
style.selected_button = _SelectedCompat('button')
|
||||
style.selected_button_text = _SelectedCompat('button_text')
|
||||
style.gm_nav_selected_button = _SelectedCompat('gm_nav_button')
|
||||
style.gm_nav_selected_button_text = _SelectedCompat('gm_nav_button_text')
|
||||
style.prefs_selected_button = _SelectedCompat('prefs_button')
|
||||
style.prefs_selected_button_text = _SelectedCompat('prefs_button_text')
|
||||
|
||||
def apply_selected_compat():
|
||||
for scs in _selected_compat:
|
||||
scs.apply()
|
||||
|
||||
layout.compat_funcs.append(apply_selected_compat)
|
||||
@@ -0,0 +1,500 @@
|
||||
# Copyright 2004-2007 PyTom
|
||||
#
|
||||
# Please see the LICENSE.txt distributed with Ren'Py for permission to
|
||||
# copy and modify.
|
||||
|
||||
init -1100:
|
||||
python:
|
||||
|
||||
theme = object()
|
||||
|
||||
def RoundRect(color, small=False):
|
||||
"""
|
||||
Creates a roundrect displayable. Size should be one of
|
||||
6 or 12, while color is the color of the roundrect.
|
||||
"""
|
||||
|
||||
if small:
|
||||
size = 6
|
||||
else:
|
||||
if config.screen_width <= 640:
|
||||
size = 6
|
||||
else:
|
||||
size = 12
|
||||
|
||||
return Frame(theme.OneOrTwoColor("_roundrect/rr%dg.png" % size, color), size, size)
|
||||
|
||||
def _display_button_menu(menuitems):
|
||||
|
||||
narration = [ s for s, i in menuitems if i is None and s ]
|
||||
menuitems = [ (s, i) for s, i in menuitems if i is not None or not s ]
|
||||
|
||||
if narration:
|
||||
renpy.say(None, "\n".join(narration), interact=False)
|
||||
|
||||
return renpy.display_menu(menuitems)
|
||||
|
||||
def _button_menu():
|
||||
|
||||
store.menu = _display_button_menu
|
||||
|
||||
style.menu.clear()
|
||||
style.menu.box_spacing = 2
|
||||
|
||||
style.menu_window.clear()
|
||||
style.menu_window.take(style.default)
|
||||
style.menu_window.xpos = 0.5
|
||||
style.menu_window.xanchor = 0.5
|
||||
style.menu_window.ypos = 0.5
|
||||
style.menu_window.yanchor = 0.5
|
||||
|
||||
style.menu_choice.clear()
|
||||
style.menu_choice.take(style.button_text)
|
||||
|
||||
style.menu_choice_button.clear()
|
||||
style.menu_choice_button.take(style.button)
|
||||
|
||||
style.menu_choice_chosen.clear()
|
||||
style.menu_choice_chosen_button.clear()
|
||||
|
||||
style.menu_choice_button.xminimum = int(config.screen_width * 0.75)
|
||||
style.menu_choice_button.xmaximum = int(config.screen_width * 0.75)
|
||||
|
||||
|
||||
theme.button_menu = _button_menu
|
||||
|
||||
python hide:
|
||||
|
||||
def OneOrTwoColor(image, color):
|
||||
if len(color) == 2:
|
||||
return im.Twocolor(image, color[0], color[1])
|
||||
else:
|
||||
return im.Twocolor(image, color, color)
|
||||
|
||||
theme.OneOrTwoColor = OneOrTwoColor
|
||||
|
||||
|
||||
def theme_roundrect(
|
||||
widget = (0, 60, 120, 255),
|
||||
widget_hover = (0, 80, 160, 255),
|
||||
widget_text = (200, 225, 255, 255),
|
||||
widget_selected = (255, 255, 200, 255),
|
||||
disabled = (64, 64, 64, 255),
|
||||
disabled_text = (200, 200, 200, 255),
|
||||
label = (255, 255, 255, 255),
|
||||
frame = (100, 150, 200, 255),
|
||||
window = (0, 0, 0, 192),
|
||||
mm_root = Solid((220, 235, 255, 255)),
|
||||
gm_root = Solid((220, 235, 255, 255)),
|
||||
centered = False,
|
||||
button_menu = True,
|
||||
launcher = False,
|
||||
rounded_window = True,
|
||||
less_rounded = False,
|
||||
):
|
||||
|
||||
"""This enables the use of the roundrect theme. By
|
||||
default, this theme styles the game in a blue color
|
||||
scheme. However, by supplying one or more of the
|
||||
parameters given below, the color scheme can be
|
||||
changed.
|
||||
|
||||
@param widget: The background color of non-focued
|
||||
buttons and sliders.
|
||||
|
||||
@param widget_hover: The background color of focused
|
||||
buttons and sliders.
|
||||
|
||||
@param widget_text: The text color of non-selected buttons.
|
||||
|
||||
@param widget_selected: The text color of selected buttons.
|
||||
|
||||
@param disabled: The background color of disabled buttons.
|
||||
|
||||
@param disabled_text: The text color of disabled buttons.
|
||||
|
||||
@param label: The text color of non-selected labels.
|
||||
|
||||
@param frame: The background color of frames.
|
||||
|
||||
@param mm_root: A displayable (such as
|
||||
an Image or Solid) that will be used as
|
||||
the background for the main menu.
|
||||
|
||||
@param gm_root: A displayable (such as
|
||||
an Image or Solid) that will be used as
|
||||
the background for the game menu.
|
||||
|
||||
@param centered: If True, the buttons and sliders will
|
||||
be centered in the frames or windows that contain
|
||||
them. If False, the default, they will be pushed to the
|
||||
right side.
|
||||
"""
|
||||
|
||||
if config.screen_width <= 640:
|
||||
size = 18
|
||||
small = 12
|
||||
|
||||
big = False
|
||||
|
||||
spacing = 0
|
||||
pref_spacing = 5
|
||||
title_spacing = 6
|
||||
|
||||
frame_width = 200
|
||||
widget_width = 160
|
||||
|
||||
config.thumbnail_width = 60
|
||||
config.thumbnail_height = 45
|
||||
|
||||
config.file_page_cols = 2
|
||||
config.file_page_rows = 4
|
||||
# style.file_picker_frame.xmaximum = 450
|
||||
|
||||
prefcols = [ 110, 320, 530 ]
|
||||
|
||||
nav_xpos = 530
|
||||
|
||||
else:
|
||||
|
||||
size = 22
|
||||
small = 16
|
||||
|
||||
big = True
|
||||
|
||||
spacing = 0
|
||||
pref_spacing = 10
|
||||
title_spacing = 12
|
||||
|
||||
frame_width = 250
|
||||
widget_width = 200
|
||||
|
||||
prefcols = [ 137, 400, 663 ]
|
||||
|
||||
nav_xpos = 663
|
||||
|
||||
rrslider_empty = "_roundrect/rrslider_empty.png"
|
||||
rrslider_full = "_roundrect/rrslider_full.png"
|
||||
rrslider_thumb = "_roundrect/rrslider_thumb.png"
|
||||
|
||||
rrslider_radius = 6
|
||||
rrslider_height = 24
|
||||
|
||||
rrvslider_empty = "_roundrect/rrvslider_empty.png"
|
||||
rrvslider_full = "_roundrect/rrvslider_full.png"
|
||||
rrvslider_thumb = "_roundrect/rrvslider_thumb.png"
|
||||
|
||||
rrscrollbar = "_roundrect/rrscrollbar.png"
|
||||
rrscrollbar_thumb = "_roundrect/rrscrollbar_thumb.png"
|
||||
rrvscrollbar = "_roundrect/rrvscrollbar.png"
|
||||
rrvscrollbar_thumb = "_roundrect/rrvscrollbar_thumb.png"
|
||||
|
||||
rrvslider_radius = 6
|
||||
rrvslider_width = 24
|
||||
|
||||
|
||||
def rrframe(sty):
|
||||
sty.background = RoundRect(frame, less_rounded)
|
||||
sty.xpadding = 6
|
||||
sty.ypadding = 6
|
||||
|
||||
if big and not less_rounded:
|
||||
store._roundrect_radius = 12
|
||||
else:
|
||||
store._roundrect_radius = 6
|
||||
|
||||
style.button.clear()
|
||||
style.button.background = RoundRect(widget, less_rounded)
|
||||
style.button.hover_background = RoundRect(widget_hover, less_rounded)
|
||||
style.button.xminimum = widget_width
|
||||
style.button.ypadding = 1
|
||||
style.button.xpadding = _roundrect_radius
|
||||
style.button.xmargin = 1
|
||||
style.button.ymargin = 1
|
||||
|
||||
style.button_text.clear()
|
||||
style.button_text.drop_shadow = None
|
||||
style.button_text.color = widget_text
|
||||
style.button_text.size = size
|
||||
style.button_text.xpos = 0.5
|
||||
style.button_text.xanchor = 0.5
|
||||
style.button_text.ypos = 0.5
|
||||
style.button_text.yanchor = 0.5
|
||||
style.button_text.textalign = 0.5
|
||||
|
||||
style.button.insensitive_background = RoundRect(disabled, less_rounded)
|
||||
style.button_text.insensitive_color = disabled_text
|
||||
|
||||
style.button_text.selected_color = widget_selected
|
||||
|
||||
style.menu_button.clear()
|
||||
|
||||
style.mm_root.background = mm_root
|
||||
style.gm_root.background = gm_root
|
||||
|
||||
style.mm_menu_frame_vbox.box_spacing = spacing
|
||||
rrframe(style.mm_menu_frame)
|
||||
style.mm_menu_frame.xpos = nav_xpos
|
||||
style.mm_menu_frame.xanchor = 0.5
|
||||
|
||||
style.gm_nav_vbox.box_spacing = spacing
|
||||
rrframe(style.gm_nav_frame)
|
||||
style.gm_nav_frame.xpos = nav_xpos
|
||||
style.gm_nav_frame.xanchor = 0.5
|
||||
|
||||
|
||||
rrframe(style.prefs_pref_frame)
|
||||
del style.prefs_pref_frame.bottom_margin
|
||||
style.prefs_pref_frame.xfill = True
|
||||
|
||||
style.prefs_pref_vbox.box_spacing = spacing
|
||||
style.prefs_pref_vbox.box_first_spacing = title_spacing
|
||||
style.prefs_pref_vbox.xfill = True
|
||||
|
||||
style.prefs_frame.ypadding = pref_spacing
|
||||
|
||||
rrframe(style.prefs_column)
|
||||
style.prefs_column.box_spacing = pref_spacing
|
||||
style.prefs_column.xmaximum = frame_width
|
||||
|
||||
style.prefs_left.xpos = prefcols[0]
|
||||
style.prefs_center.xpos = prefcols[1]
|
||||
style.prefs_right.xpos = prefcols[2]
|
||||
|
||||
style.prefs_label.color = label
|
||||
style.prefs_label.size = size
|
||||
style.prefs_label.drop_shadow = None
|
||||
style.prefs_label.xpos = 0
|
||||
style.prefs_label.xanchor = 0
|
||||
|
||||
if centered:
|
||||
style.prefs_button.xpos = 0.5
|
||||
style.prefs_button.xanchor = 0.5
|
||||
else:
|
||||
style.prefs_button.xpos = 1.0
|
||||
style.prefs_button.xanchor = 1.0
|
||||
|
||||
|
||||
|
||||
style.bar.ymaximum = rrslider_height
|
||||
style.bar.left_gutter = rrslider_radius
|
||||
style.bar.right_gutter = rrslider_radius
|
||||
style.bar.thumb_offset = -rrslider_radius
|
||||
|
||||
style.bar.left_bar = Frame(theme.OneOrTwoColor(rrslider_full, widget), rrslider_radius * 2, 0)
|
||||
style.bar.right_bar = Frame(theme.OneOrTwoColor(rrslider_empty, widget), rrslider_radius * 2, 0)
|
||||
style.bar.thumb = theme.OneOrTwoColor(rrslider_thumb, widget)
|
||||
|
||||
style.bar.hover_left_bar = Frame(theme.OneOrTwoColor(rrslider_full, widget_hover), rrslider_radius * 2, 0)
|
||||
style.bar.hover_right_bar = Frame(theme.OneOrTwoColor(rrslider_empty, widget_hover), rrslider_radius * 2, 0)
|
||||
style.bar.hover_thumb = theme.OneOrTwoColor(rrslider_thumb, widget_hover)
|
||||
|
||||
style.scrollbar.clear()
|
||||
style.scrollbar.left_bar = Frame(theme.OneOrTwoColor(rrscrollbar, widget), 6, 0)
|
||||
style.scrollbar.right_bar = Frame(theme.OneOrTwoColor(rrscrollbar, widget), 6, 0)
|
||||
style.scrollbar.hover_left_bar = Frame(theme.OneOrTwoColor(rrscrollbar, widget_hover), 6, 0)
|
||||
style.scrollbar.hover_right_bar = Frame(theme.OneOrTwoColor(rrscrollbar, widget_hover), 6, 0)
|
||||
style.scrollbar.thumb = Frame(theme.OneOrTwoColor(rrscrollbar_thumb, widget), 6, 0)
|
||||
style.scrollbar.hover_thumb = Frame(theme.OneOrTwoColor(rrscrollbar_thumb, widget_hover), 6, 0)
|
||||
style.scrollbar.left_gutter = 6
|
||||
style.scrollbar.right_gutter = 6
|
||||
style.scrollbar.ymaximum = 12
|
||||
style.scrollbar.thumb_offset = 6
|
||||
|
||||
style.vbar.xmaximum = rrvslider_width
|
||||
style.vbar.top_gutter = rrvslider_radius
|
||||
style.vbar.bottom_gutter = rrvslider_radius
|
||||
style.vbar.thumb_offset = -rrvslider_radius
|
||||
|
||||
style.vbar.bottom_bar = Frame(theme.OneOrTwoColor(rrvslider_full, widget), 0, rrvslider_radius * 2)
|
||||
style.vbar.top_bar = Frame(theme.OneOrTwoColor(rrvslider_empty, widget), 0, rrvslider_radius * 2)
|
||||
style.vbar.thumb = theme.OneOrTwoColor(rrvslider_thumb, widget)
|
||||
|
||||
style.vbar.hover_bottom_bar = Frame(theme.OneOrTwoColor(rrvslider_full, widget_hover), 0, rrvslider_radius * 2)
|
||||
style.vbar.hover_top_bar = Frame(theme.OneOrTwoColor(rrvslider_empty, widget_hover), 0, rrvslider_radius * 2)
|
||||
style.vbar.hover_thumb = theme.OneOrTwoColor(rrvslider_thumb, widget_hover)
|
||||
|
||||
style.vscrollbar.clear()
|
||||
style.vscrollbar.bar_invert = True
|
||||
style.vscrollbar.top_bar = Frame(theme.OneOrTwoColor(rrvscrollbar, widget), 0, 6)
|
||||
style.vscrollbar.bottom_bar = Frame(theme.OneOrTwoColor(rrvscrollbar, widget), 0, 6)
|
||||
style.vscrollbar.hover_top_bar = Frame(theme.OneOrTwoColor(rrvscrollbar, widget_hover), 0, 6)
|
||||
style.vscrollbar.hover_bottom_bar = Frame(theme.OneOrTwoColor(rrvscrollbar, widget_hover), 0, 6)
|
||||
style.vscrollbar.thumb = Frame(theme.OneOrTwoColor(rrvscrollbar_thumb, widget), 0, 6)
|
||||
style.vscrollbar.hover_thumb = Frame(theme.OneOrTwoColor(rrvscrollbar_thumb, widget_hover), 0, 6)
|
||||
style.vscrollbar.top_gutter = 6
|
||||
style.vscrollbar.bottom_gutter = 6
|
||||
style.vscrollbar.xmaximum = 12
|
||||
style.vscrollbar.thumb_offset = 6
|
||||
|
||||
style.prefs_slider.xmaximum=widget_width
|
||||
del style.prefs_slider.ymaximum
|
||||
|
||||
if centered:
|
||||
style.prefs_slider.xpos = 0.5
|
||||
style.prefs_slider.xanchor = 0.5
|
||||
else:
|
||||
style.prefs_slider.xpos = 1.0
|
||||
style.prefs_slider.xanchor = 1.0
|
||||
|
||||
style.soundtest_button.xminimum = 0
|
||||
|
||||
# Joystick
|
||||
|
||||
style.prefs_joystick.xmaximum = 600
|
||||
style.prefs_joystick.xpos = 0.5
|
||||
style.prefs_joystick.xanchor = 0.5
|
||||
style.prefs_js_button.background = RoundRect(widget, True)
|
||||
style.prefs_js_button.hover_background = RoundRect(widget_hover, True)
|
||||
style.prefs_js_button_text.drop_shadow = None
|
||||
style.prefs_js_button_text.size = small
|
||||
style.prefs_js_button.xminimum = 450
|
||||
|
||||
rrframe(style.js_frame)
|
||||
del style.js_frame.yminimum
|
||||
style.js_frame.ypadding = .05
|
||||
style.js_frame.xpadding = rrslider_radius
|
||||
style.js_frame.xmargin = .05
|
||||
style.js_frame.ypos = .1
|
||||
style.js_frame.yanchor = 0
|
||||
|
||||
style.js_function_label.xpos = 0.5
|
||||
style.js_function_label.xanchor = 0.5
|
||||
|
||||
style.js_prompt_label.xpos = 0.5
|
||||
style.js_prompt_label.xanchor = 0.5
|
||||
|
||||
# Yes/No
|
||||
|
||||
rrframe(style.yesno_frame)
|
||||
del style.yesno_frame.yminimum
|
||||
style.yesno_frame.ypadding = .05
|
||||
style.yesno_frame.xpadding = rrslider_radius
|
||||
style.yesno_frame.xmargin = .05
|
||||
style.yesno_frame.ypos = .1
|
||||
style.yesno_frame.yanchor = 0
|
||||
|
||||
style.yesno_label.color = label
|
||||
style.yesno_label.drop_shadow = None
|
||||
|
||||
# File Picker
|
||||
|
||||
rrframe(style.file_picker_frame)
|
||||
style.file_picker_frame.xmargin = 6
|
||||
style.file_picker_frame.ymargin = 6
|
||||
|
||||
style.file_picker_frame_vbox.box_spacing = 4
|
||||
style.file_picker_nav_button.xminimum = 0
|
||||
|
||||
style.file_picker_navbox.box_spacing = spacing
|
||||
del style.file_picker_navbox.xpos
|
||||
|
||||
style.file_picker_entry.background = RoundRect(widget, less_rounded)
|
||||
style.file_picker_entry.hover_background = RoundRect(widget_hover, less_rounded)
|
||||
style.file_picker_entry.xpadding = _roundrect_radius
|
||||
style.file_picker_entry.xmargin = 2
|
||||
|
||||
style.file_picker_text.size = small
|
||||
style.file_picker_text.drop_shadow = None
|
||||
style.file_picker_text.color = widget_text
|
||||
style.file_picker_new.color = widget_selected
|
||||
|
||||
style.file_picker_old.minwidth = 40
|
||||
style.file_picker_new.minwidth = 40
|
||||
|
||||
style.file_picker_old.text_align = 1.0
|
||||
style.file_picker_new.text_align = 1.0
|
||||
|
||||
if config.script_version is None or config.script_version > (6, 0, 0):
|
||||
style.file_picker_text.insensitive_color = disabled_text
|
||||
style.file_picker_entry.insensitive_background = RoundRect(disabled, less_rounded)
|
||||
|
||||
|
||||
config.file_quick_access_pages = 8
|
||||
|
||||
# In-game.
|
||||
|
||||
if rounded_window:
|
||||
|
||||
style.window.background = RoundRect(window, less_rounded)
|
||||
style.window.xpadding = 6
|
||||
style.window.ypadding = 6
|
||||
style.window.xmargin = 6
|
||||
style.window.ymargin = 6
|
||||
|
||||
else:
|
||||
|
||||
style.window.background = Solid(window)
|
||||
style.window.xpadding = 6
|
||||
style.window.ypadding = 6
|
||||
style.window.xmargin = 0
|
||||
style.window.ymargin = 0
|
||||
|
||||
|
||||
style.default.size = size
|
||||
style.default.drop_shadow = None
|
||||
|
||||
rrframe(style.frame)
|
||||
style.frame.xpadding = 6
|
||||
style.frame.ypadding = 6
|
||||
style.frame.xmargin = 6
|
||||
style.frame.ymargin = 6
|
||||
|
||||
if button_menu:
|
||||
_button_menu()
|
||||
|
||||
if launcher:
|
||||
style.launcher_mid_vbox.xpos = 80
|
||||
style.launcher_mid_vbox.ypos = 50
|
||||
|
||||
style.launcher_bottom_vbox.xpos = 80
|
||||
style.launcher_bottom_vbox.ypos = 360
|
||||
style.launcher_bottom_vbox.yanchor = 1.0
|
||||
|
||||
style.launcher_button.xpos = 20
|
||||
style.launcher_button.xminimum = 240
|
||||
|
||||
style.launcher_title_label.color = label
|
||||
style.launcher_title_label.size = 28
|
||||
|
||||
style.launcher_text.xpos = 140
|
||||
style.launcher_text.xanchor = 0.5
|
||||
style.launcher_text.xmaximum = 240
|
||||
style.launcher_text.color = label
|
||||
style.launcher_text.text_align = 0.5
|
||||
|
||||
|
||||
style.launcher_label.xpos = 140
|
||||
style.launcher_label.xanchor = 0.5
|
||||
style.launcher_label.xmaximum = 240
|
||||
style.launcher_label.color = label
|
||||
style.launcher_label.text_align = 0.5
|
||||
|
||||
style.launcher_input.xpos = 140
|
||||
style.launcher_input.xanchor = 0.5
|
||||
style.launcher_input.xmaximum = 240
|
||||
style.launcher_input.color = widget
|
||||
style.launcher_input.text_align = 0.5
|
||||
|
||||
store._launcher_per_page = 9
|
||||
|
||||
theme.roundrect = theme_roundrect
|
||||
|
||||
def theme_roundrect_red(**params):
|
||||
"""
|
||||
This sets up a red/pink variant of the roundrect theme.
|
||||
"""
|
||||
|
||||
args = dict(widget=(150, 50, 50, 255),
|
||||
widget_hover=(200, 50, 50, 255),
|
||||
widget_text=(255, 225, 225, 255),
|
||||
frame=(225, 115, 115, 192),
|
||||
mm_root=Solid((255, 225, 225, 255)),
|
||||
gm_root=Solid((255, 225, 225, 255)),
|
||||
)
|
||||
|
||||
args.update(params)
|
||||
theme.roundrect(**args)
|
||||
|
||||
theme.roundrect_red = theme_roundrect_red
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
init python:
|
||||
|
||||
layout.provides('joystick_preferences')
|
||||
|
||||
style.js_frame = Style(style.menu_frame, help="frame used for changing a joystick binding")
|
||||
style.js_frame_box = Style(style.vbox, help="vbox used for changing a joystick binding")
|
||||
style.js_function_prompt = Style(style.prompt, help="the name of the joystick binding to change (window)")
|
||||
style.js_function_prompt_text = Style(style.prompt_text, help="the name of the joystick binding to change (text)")
|
||||
style.js_action_prompt = Style(style.prompt, help="prompting the user how to change a joystick binding (window)")
|
||||
style.js_action_prompt_text = Style(style.prompt_text, help="prompting the user how to change a joystick binding (text)")
|
||||
|
||||
style.js_prefs_frame = Style(style.menu_frame, help="frame containing all joystick bindings")
|
||||
style.js_prefs_box = Style(style.vbox, help="box containing all joystick bindings")
|
||||
style.js_prefs_button = Style(style.button, help="button containing a joystick binding")
|
||||
style.js_prefs_button_text = Style(style.button_text, help="button containing a joystick binding (text)")
|
||||
|
||||
style.js_prefs_label = Style(style.label, help="joystick preferences label (window)")
|
||||
style.js_prefs_label_text = Style(style.label_text, help="joystick preferences label (text)")
|
||||
|
||||
style.js_frame.ypos = .1
|
||||
style.js_frame.ypadding = .05
|
||||
style.js_frame.xmargin = .1
|
||||
style.js_frame_box.box_spacing = 30
|
||||
|
||||
style.js_prefs_frame.xpos = 10
|
||||
style.js_prefs_frame.ypos = 10
|
||||
|
||||
style.js_prefs_button.xminimum = 0.5
|
||||
style.js_prefs_box.box_first_spacing = 10
|
||||
|
||||
config.joystick_keys = [
|
||||
(u'Left', 'joy_left'),
|
||||
(u'Right', 'joy_right'),
|
||||
(u'Up', 'joy_up'),
|
||||
(u'Down', 'joy_down'),
|
||||
(u'Select/Dismiss', 'joy_dismiss'),
|
||||
(u'Rollback', 'joy_rollback'),
|
||||
(u'Hold to Skip', 'joy_holdskip'),
|
||||
(u'Toggle Skip', 'joy_toggleskip'),
|
||||
(u'Hide Text', 'joy_hide'),
|
||||
(u'Menu', 'joy_menu'),
|
||||
]
|
||||
|
||||
def _joystick_select_binding():
|
||||
|
||||
for label, key in config.joystick_keys:
|
||||
|
||||
def my_clicked(label=label, key=key):
|
||||
return (label, key)
|
||||
|
||||
layout.button(_(label) + " - " + _(_preferences.joymap.get(key, u"Not Assigned")), "prefs_js", clicked=my_clicked, index=label)
|
||||
|
||||
def _joystick_get_binding():
|
||||
ui.saybehavior()
|
||||
ui.add(renpy.display.joystick.JoyBehavior())
|
||||
|
||||
def _joystick_take_binding(binding, key):
|
||||
|
||||
if not isinstance(binding, basestring):
|
||||
if key in _preferences.joymap:
|
||||
del _preferences.joymap[key]
|
||||
else:
|
||||
_preferences.joymap[key] = binding
|
||||
|
||||
|
||||
def _joystick_preferences():
|
||||
|
||||
def set_binding(label, key):
|
||||
layout.navigation(None)
|
||||
|
||||
ui.window(style='js_frame')
|
||||
ui.vbox(style='js_frame_box')
|
||||
layout.prompt(_(u"Joystick Mapping") + " - " + _(label), "js_function")
|
||||
layout.prompt(u'Move the joystick or press a joystick button to create the mapping. Click the mouse to remove the mapping.', 'js_action')
|
||||
ui.close()
|
||||
|
||||
_joystick_get_binding()
|
||||
binding = ui.interact()
|
||||
_joystick_take_binding(binding, key)
|
||||
|
||||
return True
|
||||
|
||||
ui.window(style='js_prefs_frame')
|
||||
ui.vbox(style='js_prefs_box')
|
||||
|
||||
layout.label("Joystick Configuration", "js_prefs")
|
||||
|
||||
for label, key in config.joystick_keys:
|
||||
|
||||
def clicked(label=label, key=key):
|
||||
return renpy.invoke_in_new_context(set_binding, label, key)
|
||||
|
||||
layout.button(_(label) + " - " + _(_preferences.joymap.get(key, u"Not Assigned")), "js_prefs", clicked=clicked, index=label)
|
||||
|
||||
ui.close()
|
||||
|
||||
label joystick_preferences_screen:
|
||||
|
||||
while True:
|
||||
python:
|
||||
layout.navigation("joystick_preferences")
|
||||
_joystick_preferences()
|
||||
ui.interact()
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,339 @@
|
||||
init python:
|
||||
|
||||
layout.provides('load_save')
|
||||
|
||||
# Define styles
|
||||
style.file_picker_entry = Style(style.large_button, help="used to select a file to load or save")
|
||||
style.file_picker_entry_box = Style(style.hbox, help="the box inside a file picker entry")
|
||||
|
||||
style.file_picker_text = Style(style.large_button_text, help="text inside a file picker entry")
|
||||
style.file_picker_empty_slot = Style(style.file_picker_text, help="text inside an empty file picker entry slot")
|
||||
style.file_picker_extra_info = Style(style.file_picker_text)
|
||||
style.file_picker_new = Style(style.file_picker_text)
|
||||
style.file_picker_old = Style(style.file_picker_text)
|
||||
|
||||
style.file_picker_frame = Style(style.menu_frame, help="the frame enclosing the entire file picker")
|
||||
style.file_picker_frame_box = Style(style.vbox, help="the box containing the navbox and the grid of file picker entries")
|
||||
|
||||
style.file_picker_navbox = Style(style.hbox, help="the box containing navigation buttons")
|
||||
|
||||
style.file_picker_nav_button = Style(style.small_button, help="a file picker navigation button")
|
||||
style.file_picker_nav_button_text = Style(style.small_button_text, help="file picker navigation button text")
|
||||
|
||||
style.file_picker_grid = Style(style.default, help="a grid containing file picker navigation buttons")
|
||||
|
||||
# Adjust styles.
|
||||
style.file_picker_entry.xminimum = 0.5
|
||||
|
||||
style.file_picker_frame.xmargin = 6
|
||||
style.file_picker_frame.ymargin = 6
|
||||
|
||||
style.file_picker_frame_box.box_spacing = 4
|
||||
style.file_picker_entry_box.box_spacing = 4
|
||||
|
||||
# The number of columns per page of files.
|
||||
config.file_page_cols = 2
|
||||
|
||||
if config.screen_width <= 640:
|
||||
# The number of rows per page of files.
|
||||
config.file_page_rows = 4
|
||||
|
||||
# The number of quick access pages.
|
||||
config.file_quick_access_pages = 6
|
||||
else:
|
||||
config.file_page_rows = 5
|
||||
config.file_quick_access_pages = 8
|
||||
|
||||
# True if we want to disable the file pager.
|
||||
config.disable_file_pager = False
|
||||
|
||||
# True to suppress the display of thumbnails.
|
||||
config.disable_thumbnails = False
|
||||
|
||||
# The default thumbnail to use when no file exists.
|
||||
config.load_save_empty_thumbnail = None
|
||||
|
||||
# How we format time in a file entry.
|
||||
config.time_format = "%b %d, %H:%M"
|
||||
|
||||
# How we format a file entry.
|
||||
config.file_entry_format = "%(time)s\n%(save_name)s"
|
||||
|
||||
# True if we should prompt before loading a game.
|
||||
_load_prompt = True
|
||||
|
||||
# This is used to store scratch data that's used by the
|
||||
# library, but shouldn't be saved out as part of the savegame.
|
||||
__scratch = object()
|
||||
__scratch.file_picker_page = None
|
||||
|
||||
def _render_savefile(index, name, extra_info, screenshot, mtime, newest, clicked):
|
||||
|
||||
import time
|
||||
|
||||
ui.button(style=style.file_picker_entry[index],
|
||||
clicked=clicked,
|
||||
role=("selected_" if newest else ""))
|
||||
|
||||
ui.hbox(style=style.file_picker_entry_box[index])
|
||||
|
||||
if not config.disable_thumbnails:
|
||||
ui.add(screenshot)
|
||||
|
||||
if newest:
|
||||
ui.text(name + ". ", style=style.file_picker_new[index])
|
||||
else:
|
||||
ui.text(name + ". ", style=style.file_picker_old[index])
|
||||
|
||||
s = config.file_entry_format % dict(
|
||||
time=time.strftime(config.time_format,
|
||||
time.localtime(mtime)),
|
||||
save_name=extra_info)
|
||||
|
||||
ui.text(s, style=style.file_picker_extra_info[index])
|
||||
|
||||
ui.close()
|
||||
|
||||
def _render_new_slot(index, name, clicked):
|
||||
|
||||
ui.button(style=style.file_picker_entry[index],
|
||||
clicked=clicked)
|
||||
|
||||
|
||||
ui.hbox(style=style.file_picker_entry_box[index])
|
||||
|
||||
if not config.disable_thumbnails:
|
||||
|
||||
if config.load_save_empty_thumbnail:
|
||||
ui.add(config.load_save_empty_thumbnail)
|
||||
else:
|
||||
ui.null(width=config.thumbnail_width,
|
||||
height=config.thumbnail_height)
|
||||
|
||||
ui.text(name + ". ", style=style.file_picker_old[index])
|
||||
|
||||
ui.text(_(u"Empty Slot."), style=style.file_picker_empty_slot[index])
|
||||
ui.close()
|
||||
|
||||
|
||||
# Returns the names of the various pages that the file picker knows
|
||||
# about.
|
||||
def _file_picker_pages():
|
||||
|
||||
rv = [ ]
|
||||
|
||||
if config.has_autosave:
|
||||
rv.append(u"Auto")
|
||||
|
||||
if config.has_quicksave:
|
||||
rv.append(u"Quick")
|
||||
|
||||
for i in range(1, config.file_quick_access_pages + 1):
|
||||
rv.append(str(i))
|
||||
|
||||
return rv
|
||||
|
||||
|
||||
# This function is given a page, and should map it to the names
|
||||
# of the files on that page.
|
||||
def _file_picker_page_files(page):
|
||||
|
||||
per_page = config.file_page_cols * config.file_page_rows
|
||||
rv = [ ]
|
||||
|
||||
if config.has_autosave:
|
||||
if page == 0:
|
||||
for i in range(1, per_page + 1):
|
||||
rv.append(("auto-" + str(i), _(u"a") + str(i), True))
|
||||
|
||||
return rv
|
||||
else:
|
||||
page -= 1
|
||||
|
||||
if config.has_quicksave:
|
||||
if page == 0:
|
||||
for i in range(1, per_page + 1):
|
||||
rv.append(("quick-" + str(i), _(u"q") + str(i), True))
|
||||
|
||||
return rv
|
||||
else:
|
||||
page -= 1
|
||||
|
||||
for i in range(per_page * page + 1, per_page * page + 1 + per_page):
|
||||
rv.append(("%d" % i, "%d" % i, False))
|
||||
|
||||
return rv
|
||||
|
||||
# Given a filename, returns the page that filename is on.
|
||||
def _file_picker_file_page(filename):
|
||||
|
||||
per_page = config.file_page_cols * config.file_page_rows
|
||||
|
||||
base = 0
|
||||
|
||||
if config.has_autosave:
|
||||
if filename.startswith("auto-"):
|
||||
return base
|
||||
else:
|
||||
base += 1
|
||||
|
||||
if config.has_quicksave:
|
||||
if filename.startswith("quick-"):
|
||||
return base
|
||||
else:
|
||||
base += 1
|
||||
|
||||
return base + int((int(filename) - 1) / per_page)
|
||||
|
||||
# Processes a screenshot.
|
||||
def _file_picker_process_screenshot(s):
|
||||
return s
|
||||
|
||||
# This displays a file picker that can chose a save file from
|
||||
# the list of save files.
|
||||
def _file_picker(screen, save):
|
||||
|
||||
# The number of slots in a page.
|
||||
file_page_length = config.file_page_cols * config.file_page_rows
|
||||
|
||||
saved_games = renpy.list_saved_games(regexp=r'(auto-|quick-)?[0-9]+')
|
||||
|
||||
newest = None
|
||||
newest_mtime = None
|
||||
save_info = { }
|
||||
|
||||
for fn, extra_info, screenshot, mtime in saved_games:
|
||||
screenshot = _file_picker_process_screenshot(screenshot)
|
||||
save_info[fn] = (extra_info, screenshot, mtime)
|
||||
|
||||
if not fn.startswith("auto-") and mtime > newest_mtime:
|
||||
newest = fn
|
||||
newest_mtime = mtime
|
||||
|
||||
# The index of the first entry in the page.
|
||||
fpp = __scratch.file_picker_page
|
||||
|
||||
if fpp is None:
|
||||
|
||||
if newest:
|
||||
fpp = _file_picker_file_page(newest)
|
||||
else:
|
||||
fpp = _file_picker_file_page("1")
|
||||
|
||||
|
||||
while True:
|
||||
|
||||
if fpp < 0:
|
||||
fpp = 0
|
||||
|
||||
__scratch.file_picker_page = fpp
|
||||
|
||||
# Show navigation
|
||||
layout.navigation(screen)
|
||||
|
||||
ui.window(style='file_picker_frame')
|
||||
ui.vbox(style='file_picker_frame_box') # whole thing.
|
||||
|
||||
if not config.disable_file_pager:
|
||||
|
||||
# Draw the navigation.
|
||||
ui.hbox(style='file_picker_navbox') # nav buttons.
|
||||
|
||||
def tb(cond, label, clicked, selected):
|
||||
layout.button(label,
|
||||
"file_picker_nav",
|
||||
enabled=cond,
|
||||
clicked=clicked,
|
||||
selected=selected)
|
||||
|
||||
# Previous
|
||||
tb(fpp > 0, u'Previous', ui.returns(("fppdelta", -1)), selected=False)
|
||||
|
||||
# Quick Access
|
||||
for i, name in enumerate(_file_picker_pages()):
|
||||
tb(True, name, ui.returns(("fppset", i)), fpp == i)
|
||||
|
||||
# Next
|
||||
tb(True, u'Next', ui.returns(("fppdelta", +1)), False)
|
||||
|
||||
ui.close()
|
||||
|
||||
# This draws a single slot.
|
||||
def entry(name, filename, offset, ro):
|
||||
clicked = ui.returns(("return", filename))
|
||||
|
||||
if filename not in save_info:
|
||||
if (not save) or ro:
|
||||
clicked = None
|
||||
|
||||
_render_new_slot(offset, name, clicked)
|
||||
else:
|
||||
if save and ro:
|
||||
clicked = None
|
||||
|
||||
extra_info, screenshot, mtime = save_info[filename]
|
||||
_render_savefile(offset,
|
||||
name,
|
||||
extra_info,
|
||||
screenshot,
|
||||
mtime,
|
||||
newest == filename,
|
||||
clicked)
|
||||
|
||||
ui.grid(config.file_page_cols,
|
||||
config.file_page_rows,
|
||||
style='file_picker_grid',
|
||||
transpose=True) # slots
|
||||
|
||||
for i, (filename, name, ro) in enumerate(_file_picker_page_files(fpp)):
|
||||
entry(name, filename, i, ro)
|
||||
|
||||
ui.close() # slots
|
||||
ui.close() # whole thing
|
||||
|
||||
result = ui.interact()
|
||||
type, value = result
|
||||
|
||||
if type == "return":
|
||||
return value
|
||||
|
||||
if type == "fppdelta":
|
||||
fpp += value
|
||||
|
||||
if type == "fppset":
|
||||
fpp = value
|
||||
|
||||
|
||||
label save_screen:
|
||||
|
||||
python hide:
|
||||
while True:
|
||||
fn = _file_picker("save", True)
|
||||
|
||||
if renpy.can_load(fn):
|
||||
if not layout.yesno_prompt("save", u"Are you sure you want to overwrite your save?"):
|
||||
continue
|
||||
|
||||
renpy.save(fn, extra_info=store.save_name)
|
||||
|
||||
|
||||
label load_screen:
|
||||
|
||||
python hide:
|
||||
|
||||
while True:
|
||||
fn = _file_picker("load", False)
|
||||
|
||||
if _load_prompt:
|
||||
if not layout.yesno_prompt("load", u"Loading will lose unsaved progress.\nAre you sure you want to do this?"):
|
||||
continue
|
||||
|
||||
renpy.load(fn)
|
||||
|
||||
|
||||
|
||||
init python hide:
|
||||
def auto_save_extra_info():
|
||||
return save_name
|
||||
config.auto_save_extra_info = auto_save_extra_info
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
init python:
|
||||
|
||||
layout.provides('main_menu')
|
||||
|
||||
style.mm_menu_frame = Style(style.menu_frame, help="frame containing main menu")
|
||||
style.mm_menu_frame_box = Style(style.vbox, help="box containing main menu buttons")
|
||||
|
||||
style.mm_button = Style(style.button, help="main menu button")
|
||||
style.mm_button_text = Style(style.button_text, help="main menu button (text)")
|
||||
|
||||
style.mm_button.size_group = "mm"
|
||||
|
||||
style.mm_menu_frame.xpos = 5.0/6.0
|
||||
style.mm_menu_frame.xanchor = 0.5
|
||||
style.mm_menu_frame.ypos = 0.9
|
||||
style.mm_menu_frame.yanchor = 1.0
|
||||
|
||||
label main_menu_screen:
|
||||
|
||||
python hide:
|
||||
|
||||
# Ignore right-click while at the main menu.
|
||||
ui.keymap(game_menu=ui.returns(None))
|
||||
|
||||
# Show the background.
|
||||
ui.window(style='mm_root')
|
||||
ui.null()
|
||||
|
||||
ui.frame(style='mm_menu_frame')
|
||||
ui.vbox(style='mm_menu_frame_box')
|
||||
|
||||
for e in config.main_menu:
|
||||
|
||||
if len(e) == 3:
|
||||
label, clicked, enabled = e
|
||||
shown = "True"
|
||||
else:
|
||||
label, clicked, enabled, shown = e
|
||||
|
||||
if not eval(shown):
|
||||
continue
|
||||
|
||||
# This checks to see if clicked is a string. If so, we want clicked
|
||||
# to jump us out of the current context.
|
||||
if isinstance(clicked, basestring):
|
||||
clicked=ui.jumpsoutofcontext(clicked)
|
||||
|
||||
# Create each button.
|
||||
layout.button(label, "mm", enabled=eval(enabled), clicked=clicked)
|
||||
|
||||
ui.close()
|
||||
|
||||
ui.interact()
|
||||
|
||||
return
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
init python:
|
||||
|
||||
layout.provides('navigation')
|
||||
|
||||
style.gm_nav_frame = Style(style.menu_frame, help="game menu navigation frame")
|
||||
style.gm_nav_box = Style(style.vbox, help="box containing game menu navigation buttons")
|
||||
|
||||
style.gm_nav_button = Style(style.button, help="game menu navigation button")
|
||||
style.gm_nav_button_text = Style(style.button_text, help="game menu navigation button (text)")
|
||||
|
||||
style.gm_nav_button.size_group = "gm_nav_button"
|
||||
|
||||
style.gm_nav_frame.xpos = 5.0/6.0
|
||||
style.gm_nav_frame.xanchor = 0.5
|
||||
style.gm_nav_frame.ypos = 0.95
|
||||
style.gm_nav_frame.yanchor = 1.0
|
||||
|
||||
def _navigation(screen=None):
|
||||
|
||||
# Display the game menu background
|
||||
ui.window(style=style.gm_root[screen])
|
||||
ui.null()
|
||||
|
||||
if screen is None:
|
||||
return
|
||||
|
||||
# Display the navigation frame.
|
||||
ui.frame(style='gm_nav_frame')
|
||||
ui.vbox(focus='gm_nav', style='gm_nav_box')
|
||||
|
||||
for e in config.game_menu:
|
||||
|
||||
if len(e) == 4:
|
||||
key, label, clicked, enabled = e
|
||||
shown = "True"
|
||||
else:
|
||||
key, label, clicked, enabled, shown = e
|
||||
|
||||
if not eval(shown):
|
||||
continue
|
||||
|
||||
layout.button(label,
|
||||
"gm_nav",
|
||||
selected=(screen==key),
|
||||
enabled=eval(enabled),
|
||||
clicked=clicked)
|
||||
|
||||
ui.close()
|
||||
|
||||
layout.navigation = _navigation
|
||||
@@ -0,0 +1,83 @@
|
||||
init python:
|
||||
|
||||
layout.provides('preferences')
|
||||
|
||||
# Load the common code.
|
||||
renpy.load_module("_layout/classic_preferences_common")
|
||||
|
||||
# Create styles.
|
||||
style.prefs_column = Style(style.vbox, help="preference columns")
|
||||
style.prefs_left = Style(style.prefs_column, help="the left preference column")
|
||||
style.prefs_center = Style(style.prefs_column, help="the center preference column")
|
||||
style.prefs_right = Style(style.prefs_column, help="the right preference column")
|
||||
|
||||
# Customize styles.
|
||||
style.prefs_pref_frame.xfill = True
|
||||
style.prefs_column.xanchor = 0.5
|
||||
|
||||
if config.screen_width <= 640:
|
||||
style.prefs_pref_box.box_spacing = 6
|
||||
|
||||
style.prefs_column.xmaximum = 200
|
||||
style.prefs_column.box_spacing = 5
|
||||
style.prefs_frame.top_margin = 5
|
||||
|
||||
style.prefs_left.xpos = 110
|
||||
style.prefs_center.xpos = 320
|
||||
style.prefs_right.xpos = 530
|
||||
|
||||
style.prefs_slider.xmaximum = 160
|
||||
|
||||
else:
|
||||
style.prefs_pref_box.box_spacing = 12
|
||||
|
||||
style.prefs_column.xmaximum = 250
|
||||
style.prefs_column.box_spacing = 10
|
||||
style.prefs_frame.top_margin = 10
|
||||
|
||||
style.prefs_left.xpos = 137
|
||||
style.prefs_center.xpos = 400
|
||||
style.prefs_right.xpos = 663
|
||||
|
||||
style.prefs_slider.xmaximum = 200
|
||||
|
||||
style.prefs_pref_box.xfill = True
|
||||
style.prefs_volume_box.xfill = True
|
||||
style.prefs_pref_choicebox.xfill = True
|
||||
style.prefs_button.xalign = 1.0
|
||||
style.prefs_jump_button.xalign = 1.0
|
||||
style.prefs_slider.xalign = 1.0
|
||||
style.soundtest_button.xalign = 1.0
|
||||
|
||||
style.prefs_button.size_group = "prefs"
|
||||
style.prefs_jump_button.size_group = "prefs"
|
||||
|
||||
# Place preferences into groups.
|
||||
config.preferences['prefs_left'] = [
|
||||
config.all_preferences[u'Display'],
|
||||
config.all_preferences[u'Transitions'],
|
||||
config.all_preferences[u'Text Speed'],
|
||||
config.all_preferences[u'Joystick...'],
|
||||
]
|
||||
|
||||
config.preferences['prefs_center'] = [
|
||||
config.all_preferences[u'Skip'],
|
||||
config.all_preferences[u'Begin Skipping'],
|
||||
config.all_preferences[u'After Choices'],
|
||||
config.all_preferences[u'Auto-Forward Time'],
|
||||
]
|
||||
|
||||
config.preferences['prefs_right'] = [
|
||||
config.all_preferences[u'Music Volume'],
|
||||
config.all_preferences[u'Sound Volume'],
|
||||
config.all_preferences[u'Voice Volume'],
|
||||
]
|
||||
|
||||
|
||||
label preferences_screen:
|
||||
|
||||
python hide:
|
||||
_prefs_screen_run(config.preferences)
|
||||
|
||||
jump preferences_screen
|
||||
|
||||
@@ -0,0 +1,374 @@
|
||||
init python:
|
||||
|
||||
# Styles
|
||||
style.prefs_frame = Style(style.default, help="the frame containing all of the preferences")
|
||||
style.prefs_frame_box = Style(style.default, help="the box inside the frame containing all of the preferences")
|
||||
|
||||
style.prefs_pref_frame = Style(style.menu_frame, help="a frame containing a single preference")
|
||||
style.prefs_pref_box = Style(style.vbox, help="the box separating the preference label from the preference choices")
|
||||
style.prefs_pref_choicebox = Style(style.vbox, help="the box containing the preference choices")
|
||||
|
||||
style.prefs_label = Style(style.label, help="a preference label (window)")
|
||||
style.prefs_label_text = Style(style.label_text, help="a preference label (text)")
|
||||
|
||||
style.prefs_button = Style(style.radio_button, help="preference value button")
|
||||
style.prefs_button_text = Style(style.radio_button_text, help="preference value button (text)")
|
||||
|
||||
style.prefs_slider = Style(style.slider, help="preference value slider bar")
|
||||
|
||||
style.prefs_volume_box = Style(style.vbox, help="box containing a volume slider and soundtest button")
|
||||
style.prefs_volume_slider = Style(style.prefs_slider, help="volume slider bar")
|
||||
|
||||
style.soundtest_button = Style(style.small_button, help="soundtest button")
|
||||
style.soundtest_button_text = Style(style.small_button_text, help="soundtest button (text)")
|
||||
|
||||
style.prefs_jump = Style(style.prefs_pref_frame, help="jump preference frame")
|
||||
style.prefs_jump_button = Style(style.button, help="jump preference button")
|
||||
style.prefs_jump_button_text = Style(style.button_text, help="jump preference button (text)")
|
||||
|
||||
# This is a map from the name of the style that is applied to
|
||||
# a list of preferences that should be placed into a vbox
|
||||
# with that style.
|
||||
config.preferences = { }
|
||||
|
||||
# This is a map from preference name to that preference
|
||||
# object, that can be used in rearranging preferences.
|
||||
config.all_preferences = { }
|
||||
|
||||
# Should the soundtest button be before the volume slider?
|
||||
config.soundtest_before_volume = False
|
||||
|
||||
def _prefs_screen_run(prefs_map):
|
||||
|
||||
layout.navigation("preferences")
|
||||
|
||||
ui.window(style='prefs_frame')
|
||||
ui.fixed(style='prefs_frame_box')
|
||||
|
||||
for style, prefs in prefs_map.iteritems():
|
||||
|
||||
ui.vbox(style=style)
|
||||
for i in prefs:
|
||||
i.render()
|
||||
ui.close()
|
||||
|
||||
ui.close()
|
||||
|
||||
ui.interact()
|
||||
|
||||
class _Preference(object):
|
||||
"""
|
||||
This is a class that's used to represent a multiple-choice
|
||||
preference.
|
||||
"""
|
||||
|
||||
def __init__(self, name, field, values, base=_preferences):
|
||||
"""
|
||||
@param name: The name of this preference. It will be
|
||||
displayed to the user.
|
||||
|
||||
@param variable: The field on the base object
|
||||
that will be assigned the selected value. This field
|
||||
must exist.
|
||||
|
||||
@param values: A list of value name, value, condition
|
||||
triples. The value name is the name of this value that
|
||||
will be shown to the user. The value is the literal
|
||||
python value that will be assigned if this value is
|
||||
selected. The condition is a condition that will be
|
||||
evaluated to determine if this is a legal value. If no
|
||||
conditions are true, this preference will not be
|
||||
displayed to the user. A condition of None is always
|
||||
considered to be True.
|
||||
|
||||
@param base: The base object on which the variable is
|
||||
read from and set. This defaults to _preferences,
|
||||
the user preferences object.
|
||||
"""
|
||||
|
||||
self.name = name
|
||||
self.field = field
|
||||
self.values = values
|
||||
self.base = base
|
||||
|
||||
config.all_preferences[name] = self
|
||||
|
||||
|
||||
def render(self):
|
||||
values = [ (name, val) for name, val, cond in self.values
|
||||
if cond is None or renpy.eval(cond) ]
|
||||
|
||||
if not values:
|
||||
return
|
||||
|
||||
ui.window(style=style.prefs_pref_frame[self.name])
|
||||
ui.vbox(style=style.prefs_pref_box[self.name])
|
||||
|
||||
layout.label(self.name, "prefs")
|
||||
|
||||
cur = getattr(self.base, self.field)
|
||||
|
||||
ui.hbox(style=style.prefs_pref_choicebox[self.name])
|
||||
|
||||
for name, value in values:
|
||||
def clicked(value=value):
|
||||
setattr(self.base, self.field, value)
|
||||
return True
|
||||
|
||||
layout.button(name, "prefs",
|
||||
selected=(cur==value),
|
||||
clicked=clicked)
|
||||
|
||||
ui.close() # choicebox
|
||||
ui.close() # vbox
|
||||
|
||||
class _VolumePreference(object):
|
||||
"""
|
||||
This represents a preference that controls one of the
|
||||
volumes in the system. It is represented as a slider bar,
|
||||
and a button that can be pushed to play a sample sound on
|
||||
a channel.
|
||||
"""
|
||||
|
||||
def __init__(self, name, mixer, enable='True', sound='None', channel=0):
|
||||
"""
|
||||
@param name: The name of this preference, as shown to the user.
|
||||
|
||||
@param mixer: The mixer this preference controls.
|
||||
|
||||
@param enable: A string giving a python expression. If
|
||||
the expression is evaluates to false, this preference
|
||||
is not shown.
|
||||
|
||||
@param sound: A string that is evaluated to yield
|
||||
another string. The yielded string is expected to give
|
||||
a sound file, which is played as the sample sound. (We
|
||||
apologize for the convolution of this.)
|
||||
|
||||
@param channel: The number of the channel the sample
|
||||
sound is played on.
|
||||
"""
|
||||
|
||||
self.name = name
|
||||
self.mixer = mixer
|
||||
self.enable = enable
|
||||
self.sound = sound
|
||||
self.channel = channel
|
||||
|
||||
config.all_preferences[name] = self
|
||||
|
||||
def render(self):
|
||||
|
||||
if not eval(self.enable):
|
||||
return
|
||||
|
||||
sound = eval(self.sound)
|
||||
|
||||
ui.window(style=style.prefs_pref_frame[self.name])
|
||||
ui.vbox(style=style.prefs_pref_box[self.name])
|
||||
|
||||
layout.label(self.name, "prefs")
|
||||
|
||||
ui.vbox(style=style.prefs_volume_box[self.name])
|
||||
|
||||
if sound:
|
||||
def clicked():
|
||||
renpy.sound.play(sound, channel=self.channel)
|
||||
|
||||
if sound and config.soundtest_before_volume:
|
||||
layout.button(u"Test", "soundtest", clicked=clicked, index=self.name)
|
||||
|
||||
def changed(v):
|
||||
_preferences.set_volume(self.mixer, v / 128.0)
|
||||
|
||||
ui.bar(128,
|
||||
int(_preferences.get_volume(self.mixer) * 128),
|
||||
changed=changed,
|
||||
style=style.prefs_volume_slider[self.name])
|
||||
|
||||
if sound and not config.soundtest_before_volume:
|
||||
layout.button(u"Test", "soundtest", clicked=clicked, index=self.name)
|
||||
|
||||
ui.close()
|
||||
ui.close()
|
||||
|
||||
class _SliderPreference(object):
|
||||
"""
|
||||
A class that represents a preference that is controlled by a
|
||||
slider.
|
||||
"""
|
||||
|
||||
def __init__(self, name, field, range, enable='True', base=_preferences):
|
||||
"""
|
||||
@param name: The name of this preference, that is shown to the user.
|
||||
|
||||
@param range: An integer giving the maximum value of
|
||||
this slider. The slider goes from 0 to range.
|
||||
|
||||
@param get: A function that's called to get the
|
||||
initial value of the slider. It's called with no
|
||||
arguments, and should return an integet between 0 and
|
||||
range, inclusive.
|
||||
|
||||
@param set: A function that's called when the value of
|
||||
the slider is set by the user. It is called with a
|
||||
single integer, in the range 0 to range, inclusive.
|
||||
|
||||
@param enable: A string giving a python expression. If
|
||||
the expression is evaluates to false, this preference
|
||||
is not shown.
|
||||
"""
|
||||
|
||||
self.name = name
|
||||
self.field = field
|
||||
self.range = range
|
||||
self.enable = enable
|
||||
self.base = base
|
||||
|
||||
config.all_preferences[name] = self
|
||||
|
||||
def get(self):
|
||||
value = getattr(self.base, self.field)
|
||||
if value == 0:
|
||||
value = self.range
|
||||
else:
|
||||
value -= 1
|
||||
|
||||
return value
|
||||
|
||||
def set(self, value):
|
||||
value += 1
|
||||
if value == self.range + 1:
|
||||
value = 0
|
||||
|
||||
setattr(self.base, self.field, value)
|
||||
|
||||
def render(self):
|
||||
|
||||
if not eval(self.enable):
|
||||
return
|
||||
|
||||
ui.window(style=style.prefs_pref_frame[self.name])
|
||||
ui.vbox(style=style.prefs_pref_box[self.name])
|
||||
|
||||
layout.label(self.name, "prefs")
|
||||
|
||||
def changed(v):
|
||||
self.set(v)
|
||||
|
||||
ui.bar(self.range,
|
||||
self.get(),
|
||||
changed=changed,
|
||||
style=style.prefs_slider[self.name])
|
||||
|
||||
ui.close()
|
||||
|
||||
|
||||
class _JumpPreference(object):
|
||||
|
||||
def __init__(self, name, target, condition="True", show="True"):
|
||||
self.name = name
|
||||
self.target = target
|
||||
self.condition = condition
|
||||
self.show = show
|
||||
|
||||
config.all_preferences[name] = self
|
||||
|
||||
def render(self):
|
||||
|
||||
if not eval(self.show):
|
||||
return
|
||||
|
||||
ui.window(style=style.prefs_jump[self.name])
|
||||
|
||||
if eval(self.condition):
|
||||
clicked=ui.jumps(self.target)
|
||||
else:
|
||||
clicked=None
|
||||
|
||||
layout.button(self.name, 'prefs_jump', clicked=clicked)
|
||||
|
||||
def _remove_preference(name):
|
||||
"""
|
||||
Removes the preference with the given name from the
|
||||
preferences menu.
|
||||
"""
|
||||
|
||||
pref = config.all_preferences.get(name, None)
|
||||
if not pref:
|
||||
return
|
||||
|
||||
for k, v in config.preferences.iteritems():
|
||||
if pref in v:
|
||||
v.remove(pref)
|
||||
|
||||
init python hide:
|
||||
|
||||
# Enablers for some preferences.
|
||||
config.sample_sound = None
|
||||
config.sample_voice = None
|
||||
config.has_transitions = True
|
||||
config.has_cps = True
|
||||
config.has_afm = True
|
||||
config.has_skipping = True
|
||||
config.has_skip_after_choice = True
|
||||
config.always_has_joystick = False
|
||||
config.has_joystick = True
|
||||
|
||||
|
||||
# Left
|
||||
|
||||
_Preference(u'Display', 'fullscreen', [
|
||||
(u'Window', False, None),
|
||||
(u'Fullscreen', True, None),
|
||||
])
|
||||
|
||||
_Preference(u'Transitions', 'transitions', [
|
||||
(u'All', 2, 'config.has_transitions'),
|
||||
(u'Some', 1, 'config.has_transitions and default_transition'),
|
||||
(u'None', 0, 'config.has_transitions'),
|
||||
])
|
||||
|
||||
# Center
|
||||
|
||||
_Preference(u'Skip', 'skip_unseen', [
|
||||
(u'Seen Messages', False, 'config.allow_skipping and config.has_skipping'),
|
||||
(u'All Messages', True, 'config.allow_skipping and config.has_skipping'),
|
||||
])
|
||||
|
||||
_JumpPreference(u'Begin Skipping',
|
||||
'_return_skipping',
|
||||
'not main_menu',
|
||||
'config.allow_skipping and config.has_skipping')
|
||||
|
||||
|
||||
_Preference(u'After Choices', 'skip_after_choices', [
|
||||
(u'Stop Skipping', False, 'config.allow_skipping and config.has_skip_after_choice'),
|
||||
(u'Keep Skipping', True, 'config.allow_skipping and config.has_skip_after_choice'),
|
||||
])
|
||||
|
||||
config.old_names['Keep Skipping'] = 'Continue Skipping'
|
||||
|
||||
_SliderPreference(u'Text Speed', "text_cps", 150, 'config.has_cps')
|
||||
_SliderPreference(u'Auto-Forward Time', "afm_time", 40, 'config.has_afm')
|
||||
|
||||
# Right
|
||||
|
||||
_VolumePreference(u"Music Volume",
|
||||
'music',
|
||||
'config.has_music')
|
||||
_VolumePreference(u"Sound Volume",
|
||||
'sfx',
|
||||
'config.has_sound',
|
||||
'config.sample_sound')
|
||||
_VolumePreference(u'Voice Volume',
|
||||
'voice',
|
||||
'config.has_voice',
|
||||
'config.sample_voice',
|
||||
2)
|
||||
|
||||
_JumpPreference(u'Joystick...',
|
||||
'joystick_preferences_screen',
|
||||
'renpy.display.joystick.enabled or config.always_has_joystick',
|
||||
'config.has_joystick')
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
init python hide:
|
||||
|
||||
layout.provides('yesno_prompt')
|
||||
|
||||
# Define styles
|
||||
style.yesno_frame = Style(style.menu_frame, help="frame containing a yes/no prompt and yes/no buttons")
|
||||
style.yesno_frame_vbox = Style(style.vbox, help="box separating yes/no prompt from yes/no buttons")
|
||||
|
||||
style.yesno_prompt = Style(style.prompt, help="a yes/no prompt")
|
||||
style.yesno_prompt_text = Style(style.prompt_text, help="a yes/no prompt (text)")
|
||||
|
||||
style.yesno_button_hbox = Style(style.hbox, help="the box separating yes and no buttons")
|
||||
style.yesno_button = Style(style.button, help="a yes or no button")
|
||||
style.yesno_button_text = Style(style.button_text, help="a yes or no button (text)")
|
||||
|
||||
# Alter styles.
|
||||
style.yesno_frame.xfill = True
|
||||
style.yesno_frame.xmargin = .05
|
||||
style.yesno_frame.ypos = .1
|
||||
style.yesno_frame.yanchor = 0
|
||||
style.yesno_frame.ypadding = .05
|
||||
|
||||
style.yesno_frame_vbox.xalign = 0.5
|
||||
style.yesno_frame_vbox.yalign = 0.5
|
||||
style.yesno_frame_vbox.box_spacing = 30
|
||||
|
||||
style.yesno_button_hbox.xalign = 0.5
|
||||
style.yesno_button_hbox.spacing = 100
|
||||
|
||||
style.yesno_button.size_group = "yesno"
|
||||
|
||||
def yesno_prompt(screen, message):
|
||||
renpy.transition(config.intra_transition)
|
||||
|
||||
layout.navigation(screen)
|
||||
|
||||
ui.window(style='yesno_frame')
|
||||
ui.vbox(style='yesno_frame_vbox')
|
||||
|
||||
layout.prompt(message, "yesno")
|
||||
|
||||
ui.hbox(style='yesno_button_hbox')
|
||||
|
||||
# The extra nulls are because we want equal whitespace surrounding
|
||||
# the two buttons. It should work as long as we have xfill=True
|
||||
layout.button(u"Yes", 'yesno', clicked=ui.returns(True))
|
||||
layout.button(u"No", 'yesno', clicked=ui.returns(False))
|
||||
|
||||
ui.close()
|
||||
ui.close()
|
||||
|
||||
rv = ui.interact()
|
||||
renpy.transition(config.intra_transition)
|
||||
return rv
|
||||
|
||||
layout.yesno_prompt = yesno_prompt
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
init python:
|
||||
|
||||
layout.provides('main_menu')
|
||||
|
||||
style.mm_menu_frame = Style(style.menu_frame, help="frame containing main menu")
|
||||
style.mm_outer_box = Style(style.vbox, help="outer box containing main menu buttons")
|
||||
style.mm_inner_box = Style(style.hbox, help="inner box containing main menu buttons")
|
||||
|
||||
style.mm_button = Style(style.button, help="main menu button")
|
||||
style.mm_button_text = Style(style.button_text, help="main menu button (text)")
|
||||
|
||||
style.mm_menu_frame.xalign = 0.5
|
||||
style.mm_menu_frame.yalign = 0.98
|
||||
style.mm_inner_box.xalign = 0.5
|
||||
|
||||
config.main_menu_per_group = 2
|
||||
|
||||
|
||||
label main_menu_screen:
|
||||
|
||||
python hide:
|
||||
# Ignore right-click while at the main menu.
|
||||
ui.keymap(game_menu=ui.returns(None))
|
||||
|
||||
# Show the background.
|
||||
ui.window(style='mm_root')
|
||||
ui.null()
|
||||
|
||||
ui.frame(style='mm_menu_frame')
|
||||
ui.vbox(style='mm_outer_box')
|
||||
|
||||
inner_open = False
|
||||
|
||||
for i, e in enumerate(config.main_menu):
|
||||
|
||||
if len(e) == 3:
|
||||
label, clicked, enabled = e
|
||||
shown = "True"
|
||||
else:
|
||||
label, clicked, enabled, shown = e
|
||||
|
||||
if not eval(shown):
|
||||
continue
|
||||
|
||||
if i % config.main_menu_per_group == 0:
|
||||
if inner_open:
|
||||
ui.close()
|
||||
|
||||
ui.hbox(style='mm_inner_box')
|
||||
inner_open = True
|
||||
|
||||
# This checks to see if clicked is a string. If so, we want clicked
|
||||
# to jump us out of the current context.
|
||||
if isinstance(clicked, basestring):
|
||||
clicked=ui.jumpsoutofcontext(clicked)
|
||||
|
||||
# Create each button.
|
||||
layout.button(label, "mm", enabled=eval(enabled), clicked=clicked)
|
||||
|
||||
if inner_open:
|
||||
ui.close() # inner box
|
||||
|
||||
ui.close() # outer box
|
||||
|
||||
ui.interact()
|
||||
|
||||
return
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
init python:
|
||||
|
||||
layout.provides('navigation')
|
||||
|
||||
style.gm_nav_frame = Style(style.menu_frame, help="game menu navigation frame")
|
||||
style.gm_nav_inner_box = Style(style.hbox, help="inner box containing game menu navigation buttons")
|
||||
style.gm_nav_outer_box = Style(style.vbox, help="outer box containing game menu navigation buttons")
|
||||
|
||||
style.gm_nav_button = Style(style.button, help="game menu navigation button")
|
||||
style.gm_nav_button_text = Style(style.button_text, help="game menu navigation button (text)")
|
||||
|
||||
style.gm_nav_button.size_group = "gm_nav_button"
|
||||
|
||||
style.gm_nav_frame.xalign = 0.5
|
||||
style.gm_nav_frame.ypos = 0.98
|
||||
style.gm_nav_frame.yanchor = 1.0
|
||||
|
||||
style.gm_nav_inner_box.xalign = 0.5
|
||||
|
||||
config.navigation_per_group = 4
|
||||
|
||||
def navigation(screen=None):
|
||||
|
||||
# Display the game menu background
|
||||
ui.window(style=style.gm_root[screen])
|
||||
ui.null()
|
||||
|
||||
if screen is None:
|
||||
return
|
||||
|
||||
# Display the navigation frame.
|
||||
ui.frame(style='gm_nav_frame')
|
||||
ui.vbox(focus='gm_nav', style='gm_nav_outer_box')
|
||||
|
||||
box_open = False
|
||||
|
||||
for i, e in enumerate(config.game_menu):
|
||||
|
||||
if len(e) == 4:
|
||||
key, label, clicked, enabled = e
|
||||
shown = "True"
|
||||
else:
|
||||
key, label, clicked, enabled, shown = e
|
||||
|
||||
if not eval(shown):
|
||||
continue
|
||||
|
||||
if i % config.navigation_per_group == 0:
|
||||
if box_open:
|
||||
ui.close()
|
||||
|
||||
ui.hbox(style='gm_nav_inner_box')
|
||||
box_open = True
|
||||
|
||||
layout.button(label,
|
||||
"gm_nav",
|
||||
selected=(screen==key),
|
||||
enabled=eval(enabled),
|
||||
clicked=clicked)
|
||||
|
||||
if box_open:
|
||||
ui.close() # inner box.
|
||||
|
||||
ui.close() # outer box.
|
||||
|
||||
layout.navigation = navigation
|
||||
@@ -0,0 +1,98 @@
|
||||
init python:
|
||||
|
||||
class _ImageMapper(object):
|
||||
|
||||
def __init__(self, screen, ground, idle, hover, selected_idle, selected_hover, hotspots):
|
||||
|
||||
self.idle = idle
|
||||
self.hover = hover
|
||||
self.selected_idle = selected_idle
|
||||
self.selected_hover = selected_hover
|
||||
|
||||
self.hotspots = { }
|
||||
for (x1, y1, x2, y2, name) in hotspots:
|
||||
self.hotspots[name] = (x1, y1, x2, y2)
|
||||
|
||||
# Display the layout navigation only if there are no
|
||||
# game menu buttons defined.
|
||||
for i in config.game_menu:
|
||||
if i[1] in self.hotspots:
|
||||
break
|
||||
else:
|
||||
layout.navigation(screen)
|
||||
|
||||
ui.fixed(style='imagemap')
|
||||
ui.image(ground)
|
||||
|
||||
# Display any navigation buttons that exist.
|
||||
for e in config.game_menu:
|
||||
screen_ = e[0]
|
||||
name = e[1]
|
||||
act = e[2]
|
||||
enable = e[3]
|
||||
|
||||
if not eval(enable):
|
||||
continue
|
||||
|
||||
self.button(name, act, screen == screen_)
|
||||
|
||||
def button(self, name, clicked, selected):
|
||||
|
||||
if name not in self.hotspots:
|
||||
return None
|
||||
|
||||
x1, y1, x2, y2 = self.hotspots[name]
|
||||
|
||||
if clicked is None:
|
||||
return (x1, y1, x2, y2)
|
||||
|
||||
if selected:
|
||||
idle = self.selected_idle
|
||||
hover = self.selected_hover
|
||||
else:
|
||||
idle = self.idle
|
||||
hover = self.hover
|
||||
|
||||
ui.imagebutton(
|
||||
LiveCrop((x1, y1, (x2 - x1), (y2 - y1)), idle),
|
||||
LiveCrop((x1, y1, (x2 - x1), (y2 - y1)), hover),
|
||||
xpos=x1,
|
||||
ypos=y1,
|
||||
xanchor=0,
|
||||
yanchor=0,
|
||||
clicked=clicked,
|
||||
focus_mask=True,
|
||||
style='imagemap_button',
|
||||
)
|
||||
|
||||
return (x1, y1, x2, y2)
|
||||
|
||||
|
||||
def bar(self, name, range, value, changed):
|
||||
|
||||
if name not in self.hotspots:
|
||||
return
|
||||
|
||||
x1, y1, x2, y2 = self.hotspots[name]
|
||||
|
||||
ui.bar(
|
||||
range,
|
||||
value,
|
||||
changed=changed,
|
||||
left_gutter=0,
|
||||
right_gutter=0,
|
||||
left_bar=LiveCrop((x1, y1, (x2 - x1), (y2 - y1)), self.selected_idle),
|
||||
right_bar=LiveCrop((x1, y1, (x2 - x1), (y2 - y1)), self.idle),
|
||||
hover_left_bar=LiveCrop((x1, y1, (x2 - x1), (y2 - y1)), self.selected_hover),
|
||||
hover_right_bar=LiveCrop((x1, y1, (x2 - x1), (y2 - y1)), self.hover),
|
||||
bar_resizing=False,
|
||||
xpos=x1,
|
||||
ypos=y1,
|
||||
xmaximum=(x2-x1),
|
||||
ymaximum=(y2-y1),
|
||||
thumb=None,
|
||||
thumb_shadow=None,
|
||||
thumb_offset=0)
|
||||
|
||||
def close(self):
|
||||
ui.close()
|
||||
@@ -0,0 +1,334 @@
|
||||
init python:
|
||||
|
||||
layout.provides('load_save')
|
||||
renpy.load_module("_layout/imagemap_common")
|
||||
|
||||
# The ground image.
|
||||
config.load_save_ground = None
|
||||
|
||||
# The idle image.
|
||||
config.load_save_idle = None
|
||||
|
||||
# The hover image.
|
||||
config.load_save_hover = None
|
||||
|
||||
# The selected idle image.
|
||||
config.load_save_selected_idle = None
|
||||
|
||||
# The selected hover image.
|
||||
config.load_save_selected_hover = None
|
||||
|
||||
# The hotspots. Each hotspot is defined by a tuple giving:
|
||||
# - The x-coordinate of the left side.
|
||||
# - The y-coordinate of the top side.
|
||||
# - The x-coordinate of the right side.
|
||||
# - The y-coordinate of the bottoms side.
|
||||
# - The name of the button or slider this is equivalent to.
|
||||
config.load_save_hotspots = None
|
||||
|
||||
# Define styles
|
||||
style.file_picker_text = Style(style.large_button_text, help="text inside a file picker entry")
|
||||
style.file_picker_empty_slot = Style(style.file_picker_text, help="text inside an empty file picker entry slot")
|
||||
style.file_picker_text_window = Style(style.default, help="a window containing the file picker text.")
|
||||
style.file_picker_ss_window = Style(style.default, help="a window containing the screenshot.")
|
||||
|
||||
# Should we disable thumbnails?
|
||||
config.disable_thumbnails = False
|
||||
|
||||
# The default thumbnail to use when no file exists.
|
||||
config.load_save_empty_thumbnail = None
|
||||
|
||||
# How we format time in a file entry.
|
||||
config.time_format = "%b %d, %H:%M"
|
||||
|
||||
# How we format a file entry.
|
||||
config.file_entry_format = "%(time)s\n%(save_name)s"
|
||||
|
||||
# True if we should prompt before loading a game.
|
||||
_load_prompt = True
|
||||
|
||||
# This is used to store scratch data that's used by the
|
||||
# library, but shouldn't be saved out as part of the savegame.
|
||||
__scratch = object()
|
||||
__scratch.file_picker_page = None
|
||||
__scratch.initialized = False
|
||||
__scratch.per_page = 0
|
||||
__scratch.pages = 0
|
||||
__scratch.has_autosave = False
|
||||
__scratch.has_quicksave = False
|
||||
|
||||
def _render_savefile(ime, index, name, extra_info, screenshot, mtime, newest, clicked):
|
||||
|
||||
import time
|
||||
|
||||
(x1, y1, x2, y2) = ime.button("slot_%d" % index, clicked, newest)
|
||||
|
||||
ui.fixed(xpos=x1, ypos=y1, xmaximum=x2-x1, ymaximum=y2-y1)
|
||||
|
||||
if not config.disable_thumbnails:
|
||||
ui.window(style=style.file_picker_ss_window[index])
|
||||
ui.add(screenshot)
|
||||
|
||||
s = name + ". " + config.file_entry_format % dict(
|
||||
time=time.strftime(config.time_format,
|
||||
time.localtime(mtime)),
|
||||
save_name=extra_info)
|
||||
|
||||
ui.window(style=style.file_picker_text_window[index])
|
||||
ui.text(s, style=style.file_picker_text[index])
|
||||
|
||||
ui.close()
|
||||
|
||||
def _render_new_slot(ime, index, name, clicked):
|
||||
|
||||
(x1, y1, x2, y2) = ime.button("slot_%d" % index, clicked, False)
|
||||
|
||||
ui.fixed(xpos=x1, ypos=y1, xmaximum=x2-x1, ymaximum=y2-y1)
|
||||
|
||||
if not config.disable_thumbnails:
|
||||
|
||||
if config.load_save_empty_thumbnail:
|
||||
ui.window(style=style.file_picker_ss_window[index])
|
||||
ui.add(config.load_save_empty_thumbnail)
|
||||
|
||||
ui.window(style=style.file_picker_text_window[index])
|
||||
ui.text(name + ". " + _(u"Empty Slot.") + "\n", style=style.file_picker_empty_slot[index])
|
||||
|
||||
ui.close()
|
||||
|
||||
|
||||
# This function is given a page, and should map it to the names
|
||||
# of the files on that page.
|
||||
def _file_picker_page_files(page):
|
||||
|
||||
per_page = __scratch.per_page
|
||||
rv = [ ]
|
||||
|
||||
if __scratch.has_autosave:
|
||||
if page == 0:
|
||||
for i in range(1, per_page + 1):
|
||||
rv.append(("auto-" + str(i), _(u"a") + str(i), True))
|
||||
|
||||
return rv
|
||||
else:
|
||||
page -= 1
|
||||
|
||||
if __scratch.has_quicksave:
|
||||
if page == 0:
|
||||
for i in range(1, per_page + 1):
|
||||
rv.append(("quick-" + str(i), _(u"q") + str(i), True))
|
||||
|
||||
return rv
|
||||
else:
|
||||
page -= 1
|
||||
|
||||
for i in range(per_page * page + 1, per_page * page + 1 + per_page):
|
||||
rv.append(("%d" % i, "%d" % i, False))
|
||||
|
||||
return rv
|
||||
|
||||
# Given a filename, returns the page that filename is on.
|
||||
def _file_picker_file_page(filename):
|
||||
|
||||
per_page = __scratch.per_page
|
||||
|
||||
base = 0
|
||||
|
||||
if __scratch.has_autosave:
|
||||
if filename.startswith("auto-"):
|
||||
return base
|
||||
else:
|
||||
base += 1
|
||||
|
||||
if __scratch.has_quicksave:
|
||||
if filename.startswith("quick-"):
|
||||
return base
|
||||
else:
|
||||
base += 1
|
||||
|
||||
return base + int((int(filename) - 1) / per_page)
|
||||
|
||||
# Processes a screenshot.
|
||||
def _file_picker_process_screenshot(s):
|
||||
return s
|
||||
|
||||
# Initialize the scratch information.
|
||||
def _file_picker_init():
|
||||
|
||||
hotspots = set()
|
||||
|
||||
for (x1, y1, x2, y2, name) in config.load_save_hotspots:
|
||||
hotspots.add(name)
|
||||
|
||||
__scratch.has_autosave = ("page_auto" in hotspots)
|
||||
__scratch.has_quicksave = ("page_quick" in hotspots)
|
||||
|
||||
__scratch.per_page = 0
|
||||
|
||||
while ("slot_%d" % __scratch.per_page) in hotspots:
|
||||
__scratch.per_page += 1
|
||||
|
||||
__scratch.pages = 1
|
||||
|
||||
while ("page_%d" % __scratch.pages) in hotspots:
|
||||
__scratch.pages += 1
|
||||
|
||||
__scratch.pages -= 1
|
||||
|
||||
def _file_picker_pages():
|
||||
|
||||
rv = [ ]
|
||||
|
||||
if config.has_autosave:
|
||||
rv.append("page_auto")
|
||||
|
||||
if config.has_quicksave:
|
||||
rv.append("page_quick")
|
||||
|
||||
for i in range(1, __scratch.pages + 1):
|
||||
rv.append("page_%d" % i)
|
||||
|
||||
return rv
|
||||
|
||||
|
||||
# This displays a file picker that can chose a save file from
|
||||
# the list of save files.
|
||||
def _file_picker(screen, save):
|
||||
|
||||
if not __scratch.initialized:
|
||||
__scratch.initialized = True
|
||||
_file_picker_init()
|
||||
|
||||
# The number of slots in a page.
|
||||
file_page_length = __scratch.per_page
|
||||
|
||||
saved_games = renpy.list_saved_games(regexp=r'(auto-|quick-)?[0-9]+')
|
||||
|
||||
newest = None
|
||||
newest_mtime = None
|
||||
save_info = { }
|
||||
|
||||
for fn, extra_info, screenshot, mtime in saved_games:
|
||||
screenshot = _file_picker_process_screenshot(screenshot)
|
||||
save_info[fn] = (extra_info, screenshot, mtime)
|
||||
|
||||
if not fn.startswith("auto-") and mtime > newest_mtime:
|
||||
newest = fn
|
||||
newest_mtime = mtime
|
||||
|
||||
# The index of the first entry in the page.
|
||||
fpp = __scratch.file_picker_page
|
||||
|
||||
if fpp is None:
|
||||
|
||||
if newest:
|
||||
fpp = _file_picker_file_page(newest)
|
||||
else:
|
||||
fpp = _file_picker_file_page("1")
|
||||
|
||||
while True:
|
||||
|
||||
if fpp < 0:
|
||||
fpp = 0
|
||||
|
||||
__scratch.file_picker_page = fpp
|
||||
|
||||
ime = _ImageMapper(
|
||||
screen,
|
||||
config.load_save_ground,
|
||||
config.load_save_idle,
|
||||
config.load_save_hover,
|
||||
config.load_save_selected_idle,
|
||||
config.load_save_selected_hover,
|
||||
config.load_save_hotspots)
|
||||
|
||||
|
||||
def tb(enabled, label, clicked, selected):
|
||||
|
||||
if not enabled:
|
||||
return
|
||||
|
||||
ime.button(label, clicked, selected)
|
||||
|
||||
# Previous
|
||||
tb(fpp > 0, 'previous', ui.returns(("fppdelta", -1)), selected=False)
|
||||
|
||||
# Quick Access
|
||||
for i, name in enumerate(_file_picker_pages()):
|
||||
tb(True, name, ui.returns(("fppset", i)), fpp == i)
|
||||
|
||||
# Next
|
||||
tb(True, 'next', ui.returns(("fppdelta", +1)), False)
|
||||
|
||||
# This draws a single slot.
|
||||
def entry(name, filename, offset, ro):
|
||||
clicked = ui.returns(("return", filename))
|
||||
|
||||
if filename not in save_info:
|
||||
if (not save) or ro:
|
||||
clicked = None
|
||||
|
||||
_render_new_slot(ime, offset, name, clicked)
|
||||
|
||||
else:
|
||||
if save and ro:
|
||||
clicked = None
|
||||
|
||||
extra_info, screenshot, mtime = save_info[filename]
|
||||
_render_savefile(ime,
|
||||
offset,
|
||||
name,
|
||||
extra_info,
|
||||
screenshot,
|
||||
mtime,
|
||||
newest == filename,
|
||||
clicked)
|
||||
|
||||
for i, (filename, name, ro) in enumerate(_file_picker_page_files(fpp)):
|
||||
entry(name, filename, i, ro)
|
||||
|
||||
ime.close()
|
||||
|
||||
result = ui.interact()
|
||||
type, value = result
|
||||
|
||||
if type == "return":
|
||||
return value
|
||||
|
||||
if type == "fppdelta":
|
||||
fpp += value
|
||||
|
||||
if type == "fppset":
|
||||
fpp = value
|
||||
|
||||
|
||||
label save_screen:
|
||||
|
||||
python hide:
|
||||
while True:
|
||||
fn = _file_picker("save", True)
|
||||
|
||||
if renpy.can_load(fn):
|
||||
if not layout.yesno_prompt("save", u"Are you sure you want to overwrite your save?"):
|
||||
continue
|
||||
|
||||
renpy.save(fn, extra_info=store.save_name)
|
||||
|
||||
|
||||
label load_screen:
|
||||
|
||||
python hide:
|
||||
while True:
|
||||
fn = _file_picker("load", False)
|
||||
|
||||
if _load_prompt:
|
||||
if not layout.yesno_prompt("load", u"Loading will lose unsaved progress.\nAre you sure you want to do this?"):
|
||||
continue
|
||||
|
||||
renpy.load(fn)
|
||||
|
||||
init python hide:
|
||||
def auto_save_extra_info():
|
||||
return save_name
|
||||
config.auto_save_extra_info = auto_save_extra_info
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
init python:
|
||||
|
||||
layout.provides('main_menu')
|
||||
|
||||
# The ground image.
|
||||
config.main_menu_ground = None
|
||||
|
||||
# The selected image.
|
||||
config.main_menu_selected = None
|
||||
|
||||
# The hotspots. Each hotspot is defined by a tuple giving:
|
||||
# - The x-coordinate of the left side.
|
||||
# - The y-coordinate of the top side.
|
||||
# - The x-coordinate of the right side.
|
||||
# - The y-coordinate of the bottoms side.
|
||||
# - Either the (untranslated) name of the main menu button this hotspot
|
||||
# is equivalent to, or, a label in the program to jump to when this
|
||||
# hotspot is clicked.
|
||||
config.main_menu_hotspots = [ ]
|
||||
|
||||
label main_menu_screen:
|
||||
|
||||
python hide:
|
||||
|
||||
# Ignore right-click while at the main menu.
|
||||
ui.keymap(game_menu=ui.returns(None))
|
||||
|
||||
# Show the background.
|
||||
ui.window(style='mm_root')
|
||||
ui.null()
|
||||
|
||||
rv = renpy.imagemap(
|
||||
config.main_menu_ground,
|
||||
config.main_menu_selected,
|
||||
config.main_menu_hotspots)
|
||||
|
||||
for e in config.main_menu:
|
||||
name = e[0]
|
||||
act = e[1]
|
||||
enable = e[2]
|
||||
|
||||
if name == rv:
|
||||
|
||||
if isinstance(act, basestring):
|
||||
act = ui.jumpsoutofcontext(act)
|
||||
act()
|
||||
|
||||
break
|
||||
else:
|
||||
ui.jumpsoutofcontext(rv)()
|
||||
|
||||
jump main_menu_screen
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
init python:
|
||||
|
||||
layout.provides('navigation')
|
||||
|
||||
# The ground image.
|
||||
config.navigation_ground = None
|
||||
|
||||
# The idle image.
|
||||
config.navigation_idle = None
|
||||
|
||||
# The hover image.
|
||||
config.navigation_hover = None
|
||||
|
||||
# The selected idle image.
|
||||
config.navigation_selected_idle = None
|
||||
|
||||
# The selected hover image.
|
||||
config.navigation_selected_hover = None
|
||||
|
||||
# The hotspots. Each hotspot is defined by a tuple giving:
|
||||
# - The x-coordinate of the left side.
|
||||
# - The y-coordinate of the top side.
|
||||
# - The x-coordinate of the right side.
|
||||
# - The y-coordinate of the bottoms side.
|
||||
# - The name of the game menu button this is equivalent to.
|
||||
config.navigation_hotspots = None
|
||||
|
||||
def _navigation(screen=None):
|
||||
|
||||
# Display the game menu background
|
||||
ui.window(style=style.gm_root[screen])
|
||||
ui.null()
|
||||
|
||||
if screen is None:
|
||||
return
|
||||
|
||||
# A map from button name to game menu information.
|
||||
gm = dict()
|
||||
|
||||
for e in config.game_menu:
|
||||
screen_ = e[0]
|
||||
name_ = e[1]
|
||||
act = e[2]
|
||||
enable = e[3]
|
||||
|
||||
gm[name_] = (screen_, act, enable)
|
||||
|
||||
ui.fixed(style='imagemap')
|
||||
ui.image(config.navigation_ground)
|
||||
|
||||
for (x0, y0, x1, y1, name) in config.navigation_hotspots:
|
||||
|
||||
if name not in gm:
|
||||
raise Exception("%r was used in a game menu hotspot, but isn't the name of a game menu button." % name)
|
||||
|
||||
screen_, act, enable = gm[name]
|
||||
|
||||
if not eval(enable):
|
||||
continue
|
||||
|
||||
if screen_ == screen:
|
||||
idle = config.navigation_selected_idle
|
||||
hover = config.navigation_selected_hover
|
||||
else:
|
||||
idle = config.navigation_idle
|
||||
hover = config.navigation_hover
|
||||
|
||||
ui.imagebutton(
|
||||
LiveCrop((x0, y0, x1-x0, y1-y0), idle),
|
||||
LiveCrop((x0, y0, x1-x0, y1-y0), hover),
|
||||
clicked=act,
|
||||
style='imagemap_button',
|
||||
xpos=x0,
|
||||
ypos=y0,
|
||||
xanchor=0,
|
||||
yanchor=0,
|
||||
focus_mask=True,
|
||||
)
|
||||
|
||||
ui.close()
|
||||
|
||||
layout.navigation = _navigation
|
||||
@@ -0,0 +1,141 @@
|
||||
init python:
|
||||
|
||||
layout.provides('preferences')
|
||||
renpy.load_module("_layout/imagemap_common")
|
||||
|
||||
# The ground image.
|
||||
config.preferences_ground = None
|
||||
|
||||
# The idle image.
|
||||
config.preferences_idle = None
|
||||
|
||||
# The hover image.
|
||||
config.preferences_hover = None
|
||||
|
||||
# The selected idle image.
|
||||
config.preferences_selected_idle = None
|
||||
|
||||
# The selected hover image.
|
||||
config.preferences_selected_hover = None
|
||||
|
||||
# The hotspots. Each hotspot is defined by a tuple giving:
|
||||
# - The x-coordinate of the left side.
|
||||
# - The y-coordinate of the top side.
|
||||
# - The x-coordinate of the right side.
|
||||
# - The y-coordinate of the bottoms side.
|
||||
# - The name of the button or slider this is equivalent to.
|
||||
config.preferences_hotspots = None
|
||||
|
||||
config.sample_sound = None
|
||||
config.sample_voice = None
|
||||
config.always_has_joystick = False
|
||||
|
||||
def __set(base, field, value):
|
||||
setattr(base, field, value)
|
||||
return True
|
||||
|
||||
__curried_set = renpy.curry(__set)
|
||||
|
||||
|
||||
def __show_preferences():
|
||||
|
||||
ime = _ImageMapper(
|
||||
"prefs",
|
||||
config.preferences_ground,
|
||||
config.preferences_idle,
|
||||
config.preferences_hover,
|
||||
config.preferences_selected_idle,
|
||||
config.preferences_selected_hover,
|
||||
config.preferences_hotspots)
|
||||
|
||||
def pref(name, pref, value):
|
||||
ime.button(
|
||||
name,
|
||||
__curried_set(_preferences, pref, value),
|
||||
getattr(_preferences, pref) == value)
|
||||
|
||||
pref("Window", "fullscreen", False)
|
||||
pref("Fullscreen", "fullscreen", True)
|
||||
|
||||
pref("All", "transitions", 2)
|
||||
pref("Some", "transitions", 1)
|
||||
pref("None", "transitions", 0)
|
||||
|
||||
pref("Seen Messages", "skip_unseen", False)
|
||||
pref("All Messages", "skip_unseen", True)
|
||||
|
||||
if not main_menu:
|
||||
ime.button("Begin Skipping", ui.jumps("_return_skipping"), False)
|
||||
|
||||
pref("Stop Skipping", "skip_after_choices", False)
|
||||
pref("Keep Skipping", "skip_after_choices", True)
|
||||
|
||||
if renpy.display.joystick.enabled or config.always_has_joystick:
|
||||
ime.button("Joystick", ui.jumps("joystick_preferences_screen"), False)
|
||||
|
||||
def play_sound():
|
||||
renpy.sound.play(config.sample_sound)
|
||||
|
||||
ime.button("Sound Test", play_sound, False)
|
||||
|
||||
def play_voice():
|
||||
renpy.sound.play(config.sample_sound, channel=2)
|
||||
|
||||
ime.button("Voice Test", play_voice, False)
|
||||
|
||||
v = _preferences.text_cps
|
||||
if v == 0:
|
||||
v = 150
|
||||
else:
|
||||
v = v - 1
|
||||
|
||||
def set_text_cps(v):
|
||||
if v == 150:
|
||||
v = 0
|
||||
else:
|
||||
v = v + 1
|
||||
|
||||
_preferences.text_cps = v
|
||||
|
||||
ime.bar("Text Speed", 150, v, set_text_cps)
|
||||
|
||||
v = _preferences.afm_time
|
||||
if v == 0:
|
||||
v = 40
|
||||
else:
|
||||
v = v - 1
|
||||
|
||||
def set_afm_time(v):
|
||||
if v == 40:
|
||||
v = 0
|
||||
else:
|
||||
v = v + 1
|
||||
|
||||
_preferences.afm_time = v
|
||||
|
||||
ime.bar("Auto-Forward Time", 40, v, set_afm_time)
|
||||
|
||||
def set_music(v):
|
||||
_preferences.set_volume('music', v / 128.0)
|
||||
def set_sound(v):
|
||||
_preferences.set_volume('sfx', v / 128.0)
|
||||
def set_voice(v):
|
||||
_preferences.set_volume('voice', v / 128.0)
|
||||
|
||||
ime.bar("Music Volume", 128, int(_preferences.get_volume('music') * 128), set_music)
|
||||
ime.bar("Sound Volume", 128, int(_preferences.get_volume('sfx') * 128), set_sound)
|
||||
ime.bar("Voice Volume", 128, int(_preferences.get_volume('voice') * 128), set_voice)
|
||||
|
||||
ime.close()
|
||||
ui.interact()
|
||||
|
||||
label preferences_screen:
|
||||
|
||||
while True:
|
||||
$ __show_preferences()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
init python hide:
|
||||
|
||||
layout.provides('yesno_prompt')
|
||||
|
||||
renpy.load_module("_layout/imagemap_common")
|
||||
|
||||
# Define styles
|
||||
style.yesno_prompt = Style(style.prompt, help="a yes/no prompt")
|
||||
style.yesno_prompt_text = Style(style.prompt_text, help="a yes/no prompt (text)")
|
||||
|
||||
# Configuration variables
|
||||
config.yesno_prompt_ground = None
|
||||
config.yesno_prompt_idle = None
|
||||
config.yesno_prompt_hover = None
|
||||
config.yesno_prompt_hotspots = None
|
||||
|
||||
def yesno_prompt(screen, message):
|
||||
renpy.transition(config.intra_transition)
|
||||
|
||||
ime = _ImageMapper(
|
||||
screen,
|
||||
config.yesno_prompt_ground,
|
||||
config.yesno_prompt_idle,
|
||||
config.yesno_prompt_hover,
|
||||
config.yesno_prompt_idle,
|
||||
config.yesno_prompt_hover,
|
||||
config.yesno_prompt_hotspots)
|
||||
|
||||
ime.button("Yes", ui.returns(True), False)
|
||||
ime.button("No", ui.returns(False), False)
|
||||
|
||||
ime.close()
|
||||
|
||||
layout.prompt(message, "yesno")
|
||||
|
||||
rv = ui.interact()
|
||||
renpy.transition(config.intra_transition)
|
||||
return rv
|
||||
|
||||
layout.yesno_prompt = yesno_prompt
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
init python:
|
||||
|
||||
layout.provides('preferences')
|
||||
|
||||
# Load the common code.
|
||||
renpy.load_module("_layout/classic_preferences_common")
|
||||
|
||||
# Create styles.
|
||||
style.prefs_column = Style(style.vbox, help="the single preferences column")
|
||||
|
||||
style.prefs_frame.set_parent(style.menu_frame)
|
||||
style.prefs_pref_frame.set_parent(style.default)
|
||||
|
||||
# Adjust styles.
|
||||
style.prefs_frame_box.box_layout = 'vertical'
|
||||
|
||||
style.prefs_frame.xalign = 0.0
|
||||
style.prefs_frame.ypos = 10
|
||||
style.prefs_frame.xmargin = 10
|
||||
|
||||
style.prefs_slider.xmaximum = 200
|
||||
style.prefs_slider.xalign = 1.0
|
||||
|
||||
style.prefs_volume_slider.xmaximum = 200
|
||||
style.prefs_volume_slider.xalign = 1.0
|
||||
style.prefs_volume_box.xalign = 1.0
|
||||
style.prefs_volume_box.box_layout = 'horizontal'
|
||||
|
||||
style.prefs_pref_box.xfill = True
|
||||
style.prefs_pref_box.box_layout = 'horizontal'
|
||||
style.prefs_pref_choicebox.box_layout = 'horizontal'
|
||||
style.prefs_pref_choicebox.xalign = 1.0
|
||||
|
||||
style.prefs_jump.xfill = True
|
||||
|
||||
style.prefs_column.box_spacing = 5
|
||||
|
||||
style.soundtest_button.xalign = 1.0
|
||||
style.prefs_jump_button.xalign = 1.0
|
||||
|
||||
config.translations["Fullscreen 16:9"] = "16:9"
|
||||
config.translations["Fullscreen 16:10"] = "16:10"
|
||||
|
||||
config.soundtest_before_volume = True
|
||||
|
||||
|
||||
# Place preferences into groups.
|
||||
config.preferences['prefs_column'] = [
|
||||
config.all_preferences[u'Display'],
|
||||
config.all_preferences[u'Transitions'],
|
||||
config.all_preferences[u'Skip'],
|
||||
config.all_preferences[u'Begin Skipping'],
|
||||
config.all_preferences[u'After Choices'],
|
||||
config.all_preferences[u'Text Speed'],
|
||||
config.all_preferences[u'Auto-Forward Time'],
|
||||
config.all_preferences[u'Music Volume'],
|
||||
config.all_preferences[u'Sound Volume'],
|
||||
config.all_preferences[u'Voice Volume'],
|
||||
config.all_preferences[u'Joystick...'],
|
||||
]
|
||||
|
||||
|
||||
label preferences_screen:
|
||||
|
||||
$ _prefs_screen_run(config.preferences)
|
||||
|
||||
jump preferences_screen
|
||||
|
||||
@@ -0,0 +1,224 @@
|
||||
init python:
|
||||
|
||||
layout.provides('load_save')
|
||||
|
||||
# Store some global information that won't be saved.
|
||||
__session = object()
|
||||
__session.scrollbar_position = None
|
||||
|
||||
# Should we prompt to load?
|
||||
_load_prompt = True
|
||||
|
||||
# The number of normal save slots.
|
||||
config.load_save_slots = 50
|
||||
|
||||
# The number of autosave slots.
|
||||
config.load_save_auto_slots = 5
|
||||
|
||||
# The number of quicksave slots.
|
||||
config.load_save_quick_slots = 5
|
||||
|
||||
# How we format time in a file entry.
|
||||
config.time_format = "%b %d, %H:%M"
|
||||
|
||||
# How we format a file entry.
|
||||
config.file_entry_format = "%(time)s\n%(save_name)s"
|
||||
|
||||
# Set the default size of thumbnails.
|
||||
config.thumbnail_width = 320
|
||||
config.thumbnail_height = 240
|
||||
|
||||
# The default empty slot thumbnail.
|
||||
config.load_save_empty_thumbnail = None
|
||||
|
||||
# Styles.
|
||||
style.file_picker_frame = Style(style.frame, help="frame containing the file picker")
|
||||
style.file_picker_side = Style(style.default, help="ui.side containing the file picker and the scrollbars")
|
||||
style.file_picker_viewport = Style(style.viewport, help="viewport containing the file picker entries")
|
||||
style.file_picker_box = Style(style.vbox, help="box containing the file picker entries")
|
||||
style.file_picker_entry = Style(style.large_button, help="the buttons containing information about each file")
|
||||
style.file_picker_text = Style(style.large_button_text, help="the text inside a file picker entry.")
|
||||
style.file_picker_scrollbar = Style(style.vscrollbar, help="the text inside a file picker entry.")
|
||||
|
||||
style.thumbnail_frame = Style(style.frame, help="the style of the frame containing a thumbnail")
|
||||
|
||||
|
||||
# Position things correctly.
|
||||
style.file_picker_frame.xmaximum = 0.5
|
||||
style.file_picker_frame.xmargin = 6
|
||||
style.file_picker_frame.ymargin = 6
|
||||
style.file_picker_frame.yfill = True
|
||||
|
||||
style.file_picker_entry.xfill = True
|
||||
style.file_picker_entry.yminimum = 58
|
||||
|
||||
style.thumbnail_frame.ymargin = 6
|
||||
style.thumbnail_frame.xpos = 0.75
|
||||
style.thumbnail_frame.xanchor = 0.5
|
||||
|
||||
def _file_picker_thumbnail(st, at):
|
||||
if __session.thumbnail:
|
||||
rv = __session.thumbnail
|
||||
elif config.load_save_empty_thumbnail:
|
||||
rv = config.load_save_empty_thumbnail
|
||||
else:
|
||||
rv = Null(width=config.thumbnail_width, height=config.thumbnail_height)
|
||||
|
||||
return rv, None
|
||||
|
||||
|
||||
def _file_picker(screen):
|
||||
|
||||
@renpy.curry
|
||||
def hovered(thumbnail):
|
||||
if __session.thumbnail is not thumbnail:
|
||||
__session.thumbnail = thumbnail
|
||||
renpy.restart_interaction()
|
||||
|
||||
@renpy.curry
|
||||
def unhovered(thumbnail):
|
||||
if __session.thumbnail is thumbnail:
|
||||
__session.thumbnail = None
|
||||
renpy.restart_interaction()
|
||||
|
||||
__session.thumbnail = None
|
||||
|
||||
layout.navigation(screen)
|
||||
|
||||
newest = None
|
||||
newest_time = None
|
||||
|
||||
info = { }
|
||||
|
||||
for name, extra_info, thumbnail, time in renpy.list_saved_games():
|
||||
|
||||
info[name] = (extra_info, thumbnail, time)
|
||||
|
||||
if not name[0] in "0123456789":
|
||||
continue
|
||||
|
||||
if time > newest_time:
|
||||
newest = name
|
||||
newest_time = time
|
||||
|
||||
slots = [ ]
|
||||
|
||||
for i in range(1, config.load_save_slots + 1):
|
||||
slots.append((str(i), str(i)))
|
||||
|
||||
if config.has_quicksave:
|
||||
for i in range(1, config.load_save_quick_slots + 1):
|
||||
slots.append(('quick-'+ str(i), _(u'q') + str(i)))
|
||||
|
||||
if config.has_autosave:
|
||||
for i in range(1, config.load_save_auto_slots + 1):
|
||||
slots.append(('auto-' + str(i), _(u'a') + str(i)))
|
||||
|
||||
ui.frame(style=style.file_picker_frame)
|
||||
ui.side(['c', 'r'], style=style.file_picker_side)
|
||||
|
||||
|
||||
|
||||
if __session.scrollbar_position is None:
|
||||
if newest is None:
|
||||
yoffset = 0
|
||||
else:
|
||||
yoffset = 1.0 * (int(newest) - 1) / len(slots)
|
||||
value = 0
|
||||
|
||||
else:
|
||||
value = __session.scrollbar_position
|
||||
yoffset = None
|
||||
|
||||
adj = ui.adjustment(value=value)
|
||||
ui.viewport(yadjustment=adj, offsets=(0, yoffset), style=style.file_picker_viewport, mousewheel=True)
|
||||
|
||||
ui.vbox(style=style.file_picker_box, focus=renpy.time.time())
|
||||
|
||||
|
||||
for i, (fn, n) in enumerate(slots):
|
||||
|
||||
clicked = ui.returns(fn)
|
||||
|
||||
if screen == "save" and fn.startswith("auto-"):
|
||||
clicked = None
|
||||
|
||||
if screen == "load" and fn not in info:
|
||||
clicked = None
|
||||
|
||||
if fn in info:
|
||||
extra_info, thumbnail, time = info[fn]
|
||||
|
||||
ui.button(style=style.file_picker_entry[i],
|
||||
clicked=clicked,
|
||||
hovered=hovered(thumbnail),
|
||||
unhovered=unhovered(thumbnail),
|
||||
role = "selected_" if (fn == newest) else "")
|
||||
|
||||
s = config.file_entry_format % dict(
|
||||
time=renpy.time.strftime(
|
||||
config.time_format,
|
||||
renpy.time.localtime(time)),
|
||||
save_name=extra_info)
|
||||
|
||||
ui.text(n + ". " + s, style=style.file_picker_text[i])
|
||||
|
||||
else:
|
||||
ui.button(style=style.file_picker_entry[i],
|
||||
clicked=clicked,
|
||||
role = "selected_" if (fn == newest) else "")
|
||||
|
||||
ui.text(n + ". " + _(u"Empty Slot."),
|
||||
style=style.file_picker_text[i])
|
||||
|
||||
ui.close() # vbox/viewport
|
||||
|
||||
ui.bar(adjustment=adj, style=style.file_picker_scrollbar)
|
||||
|
||||
ui.close() # side/window
|
||||
|
||||
# Thumbnail.
|
||||
ui.frame(style=style.thumbnail_frame)
|
||||
ui.add(DynamicDisplayable(_file_picker_thumbnail))
|
||||
|
||||
try:
|
||||
rv = ui.interact()
|
||||
finally:
|
||||
__session.scrollbar_position = adj.value
|
||||
__session.thumbnail = None
|
||||
|
||||
return rv
|
||||
|
||||
|
||||
label save_screen:
|
||||
|
||||
python hide:
|
||||
while True:
|
||||
fn = _file_picker("save")
|
||||
|
||||
if renpy.can_load(fn):
|
||||
if not layout.yesno_prompt("save", u"Are you sure you want to overwrite your save?"):
|
||||
continue
|
||||
|
||||
renpy.save(fn, extra_info=store.save_name)
|
||||
|
||||
|
||||
label load_screen:
|
||||
|
||||
python hide:
|
||||
|
||||
while True:
|
||||
fn = _file_picker("load")
|
||||
|
||||
if _load_prompt:
|
||||
if not layout.yesno_prompt("load", u"Loading will lose unsaved progress.\nAre you sure you want to do this?"):
|
||||
continue
|
||||
|
||||
renpy.load(fn)
|
||||
|
||||
|
||||
init python hide:
|
||||
def auto_save_extra_info():
|
||||
return save_name
|
||||
config.auto_save_extra_info = auto_save_extra_info
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
init python:
|
||||
|
||||
layout.provides('preferences')
|
||||
|
||||
# Load the common code.
|
||||
renpy.load_module("_layout/classic_preferences_common")
|
||||
|
||||
# Create styles.
|
||||
style.prefs_column = Style(style.vbox, help="columns of preferences")
|
||||
style.prefs_left = Style(style.prefs_column, help="the left preference column")
|
||||
style.prefs_right = Style(style.prefs_column, help="the right preference column")
|
||||
|
||||
style.prefs_left.xmaximum = 520
|
||||
style.prefs_right.xmaximum = 250
|
||||
|
||||
style.prefs_left.xpos = 271
|
||||
style.prefs_left.xanchor = 0.5
|
||||
style.prefs_left.ypos = 10
|
||||
|
||||
style.prefs_right.xpos = 667
|
||||
style.prefs_right.xanchor = 0.5
|
||||
style.prefs_right.ypos = 10
|
||||
|
||||
style.prefs_slider.xmaximum = 400
|
||||
style.prefs_slider.xalign = 1.0
|
||||
|
||||
style.prefs_volume_slider.xmaximum = 200
|
||||
style.prefs_volume_slider.xalign = 1.0
|
||||
|
||||
style.prefs_pref_box.xfill = True
|
||||
style.prefs_pref_choicebox.box_layout = 'horizontal'
|
||||
style.prefs_pref_choicebox.xalign = 1.0
|
||||
style.prefs_volume_box.xalign = 1.0
|
||||
|
||||
style.prefs_jump.xfill = True
|
||||
|
||||
style.prefs_column.box_spacing = 5
|
||||
|
||||
style.prefs_button.set_parent(style.small_button)
|
||||
style.prefs_button_text.set_parent(style.small_button_text)
|
||||
|
||||
style.soundtest_button.xalign = 1.0
|
||||
style.prefs_jump_button.xalign = 1.0
|
||||
|
||||
|
||||
config.sample_voice = "18005551212.ogg"
|
||||
|
||||
config.translations["Fullscreen 16:9"] = "16:9"
|
||||
config.translations["Fullscreen 16:10"] = "16:10"
|
||||
|
||||
|
||||
|
||||
|
||||
# Place preferences into groups.
|
||||
config.preferences['prefs_left'] = [
|
||||
config.all_preferences[u'Display'],
|
||||
config.all_preferences[u'Transitions'],
|
||||
config.all_preferences[u'Skip'],
|
||||
config.all_preferences[u'Begin Skipping'],
|
||||
config.all_preferences[u'After Choices'],
|
||||
config.all_preferences[u'Text Speed'],
|
||||
config.all_preferences[u'Auto-Forward Time'],
|
||||
]
|
||||
|
||||
config.preferences['prefs_right'] = [
|
||||
config.all_preferences[u'Music Volume'],
|
||||
config.all_preferences[u'Sound Volume'],
|
||||
config.all_preferences[u'Voice Volume'],
|
||||
config.all_preferences[u'Joystick...'],
|
||||
]
|
||||
|
||||
|
||||
label preferences_screen:
|
||||
|
||||
$ _prefs_screen_run(config.preferences)
|
||||
|
||||
jump preferences_screen
|
||||
|
||||
|
After Width: | Height: | Size: 171 B |
|
After Width: | Height: | Size: 340 B |
|
After Width: | Height: | Size: 175 B |
|
After Width: | Height: | Size: 386 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 279 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 897 B |
|
After Width: | Height: | Size: 476 B |
|
After Width: | Height: | Size: 867 B |
|
After Width: | Height: | Size: 1014 B |
|
After Width: | Height: | Size: 391 B |
|
After Width: | Height: | Size: 1017 B |
|
After Width: | Height: | Size: 529 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 374 B |
|
After Width: | Height: | Size: 693 B |
@@ -1,60 +0,0 @@
|
||||
# This file contains a number of definitions of standard
|
||||
# locations and transitions. We've moved them into the common
|
||||
# directory so that it's easy for an updated version of all of these
|
||||
# definitions.
|
||||
|
||||
init -1:
|
||||
|
||||
# Positions ##############################################################
|
||||
|
||||
# These are positions that can be used inside at clauses. We set
|
||||
# them up here so that they can be used throughout the program.
|
||||
$ left = Position(xpos=0.0, xanchor='left')
|
||||
$ center = Position()
|
||||
$ right = Position(xpos=1.0, xanchor='right')
|
||||
|
||||
# Offscreen positions for use with the move transition. Images at
|
||||
# these positions are still shown (and consume
|
||||
# resources)... remember to hide the image after the transition.
|
||||
$ offscreenleft = Position(xpos=0.0, xanchor='right')
|
||||
$ offscreenright = Position(xpos=1.0, xanchor='left')
|
||||
|
||||
# Transitions ############################################################
|
||||
|
||||
# Simple transitions.
|
||||
$ fade = Fade(.5, 0, .5) # Fade to black and back.
|
||||
$ dissolve = Dissolve(0.5)
|
||||
$ pixellate = Pixellate(1.0, 5)
|
||||
|
||||
# Various uses of CropMove.
|
||||
$ wiperight = CropMove(1.0, "wiperight")
|
||||
$ wipeleft = CropMove(1.0, "wipeleft")
|
||||
$ wipeup = CropMove(1.0, "wipeup")
|
||||
$ wipedown = CropMove(1.0, "wipedown")
|
||||
|
||||
$ slideright = CropMove(1.0, "slideright")
|
||||
$ slideleft = CropMove(1.0, "slideleft")
|
||||
$ slideup = CropMove(1.0, "slideup")
|
||||
$ slidedown = CropMove(1.0, "slidedown")
|
||||
|
||||
$ slideawayright = CropMove(1.0, "slideawayright")
|
||||
$ slideawayleft = CropMove(1.0, "slideawayleft")
|
||||
$ slideawayup = CropMove(1.0, "slideawayup")
|
||||
$ slideawaydown = CropMove(1.0, "slideawaydown")
|
||||
|
||||
$ irisout = CropMove(1.0, "irisout")
|
||||
$ irisin = CropMove(1.0, "irisin")
|
||||
|
||||
# This moves changed images to their new locations
|
||||
$ move = MoveTransition(0.5)
|
||||
|
||||
# These shake the screen up and down for a quarter second.
|
||||
$ vpunch = Move((0, 10), (0, -10), .10, bounce=True, repeat=True, delay=.25)
|
||||
$ hpunch = Move((15, 0), (-15, 0), .10, bounce=True, repeat=True, delay=.25)
|
||||
|
||||
# These use the ImageDissolve to do some nifty effects.
|
||||
$ blinds = ImageDissolve(im.Tile("blindstile.png"), 1.0, 8)
|
||||
$ squares = ImageDissolve(im.Tile("squarestile.png"), 1.0, 256)
|
||||
|
||||
image black = Solid((0, 0, 0, 255))
|
||||
|
||||
@@ -1,437 +0,0 @@
|
||||
# This file contains code for the game menu, and associated
|
||||
# functionality that looks an awful lot like it.
|
||||
|
||||
init -499:
|
||||
python:
|
||||
|
||||
######################################################################
|
||||
# First up, we define a bunch of configuration variable, which the
|
||||
# user can change.
|
||||
|
||||
# The contents of the game menu choices.
|
||||
library.game_menu = [
|
||||
( "return", "Return", ui.jumps("_return"), 'True'),
|
||||
( "prefs", "Preferences", ui.jumps("_prefs_screen"), 'True' ),
|
||||
( "save", "Save Game", ui.jumps("_save_screen"), 'not renpy.context().main_menu' ),
|
||||
( "load", "Load Game", ui.jumps("_load_screen"), 'True'),
|
||||
( "mainmenu", "Main Menu", lambda : _mainmenu_prompt(), 'not renpy.context().main_menu' ),
|
||||
( "quit", "Quit", lambda : _quit_prompt("quit"), 'True' ),
|
||||
]
|
||||
|
||||
# The number of columns of files to show at once.
|
||||
library.file_page_cols = 2
|
||||
|
||||
# The number of rows of files to show at once.
|
||||
library.file_page_rows = 5
|
||||
|
||||
# The number of pages to add quick access buttons for.
|
||||
library.file_quick_access_pages = 5
|
||||
|
||||
# A small amount of padding.
|
||||
library.padding = 2
|
||||
|
||||
# The width of a thumbnail.
|
||||
library.thumbnail_width = 66
|
||||
|
||||
# The height of a thumbnail.
|
||||
library.thumbnail_height = 50
|
||||
|
||||
# Sound played when entering the library without clicking a
|
||||
# button.
|
||||
library.enter_sound = None
|
||||
|
||||
# Sound played when leaving the library without clicking a
|
||||
# button.
|
||||
library.exit_sound = None
|
||||
|
||||
# Transition that occurs when entering the game menu.
|
||||
library.enter_transition = None
|
||||
|
||||
# Transition that occurs when leaving the game menu.
|
||||
library.exit_transition = None
|
||||
|
||||
# This lets us disable the file pager. (So we only have one
|
||||
# page of files.)
|
||||
library.disable_file_pager = False
|
||||
|
||||
# This lets us disable the thumbnails in the file pager.
|
||||
library.disable_thumbnails = False
|
||||
|
||||
# If True, we will be prompted before loading a game. (This can
|
||||
# be changed from inside the game code, so that one can load from
|
||||
# the first few screens but not after that.)
|
||||
_load_prompt = True
|
||||
|
||||
######################################################################
|
||||
# Next, support code.
|
||||
|
||||
# This is used to store scratch data that's used by the
|
||||
# library, but shouldn't be saved out as part of the savegame.
|
||||
_scratch = object()
|
||||
|
||||
# This returns a window containing the game menu navigation
|
||||
# buttons, set up to jump to the appropriate screen sections.
|
||||
#
|
||||
# This can be overridden by user code. It's called with the
|
||||
# name of the selected screen... one of "mainmenu", "prefs",
|
||||
# "save", "load", or "quit", at least for the default game
|
||||
# menu. If None, then it's an indication that none of the
|
||||
# nav buttons should be shown.
|
||||
def _game_nav(screen, buttons=True):
|
||||
|
||||
ui.add(renpy.Keymap(toggle_fullscreen = renpy.toggle_fullscreen))
|
||||
ui.add(renpy.Keymap(game_menu=ui.jumps("_noisy_return")))
|
||||
|
||||
ui.window(style='gm_root_window')
|
||||
ui.null()
|
||||
|
||||
if not screen:
|
||||
return
|
||||
|
||||
ui.window(style='gm_nav_window')
|
||||
ui.vbox(focus='gm_nav')
|
||||
|
||||
for key, label, clicked, enabled in library.game_menu:
|
||||
|
||||
disabled = False
|
||||
|
||||
if not eval(enabled):
|
||||
disabled = True
|
||||
clicked = None
|
||||
|
||||
_button_factory(label, "gm_nav",
|
||||
selected=(key==screen),
|
||||
disabled=disabled,
|
||||
clicked=clicked)
|
||||
|
||||
ui.close()
|
||||
|
||||
# This is called from the game menu to interact with the
|
||||
# user. It suppresses all of the underlays and overlays.
|
||||
def _game_interact():
|
||||
|
||||
return ui.interact(suppress_underlay=True,
|
||||
suppress_overlay=True)
|
||||
|
||||
# This renders an empty slot in the file picker.
|
||||
def _render_new_slot(name, save):
|
||||
|
||||
if save:
|
||||
clicked=ui.returns(("return", (name, False)))
|
||||
enable_hover = True
|
||||
else:
|
||||
clicked = None
|
||||
enable_hover = True
|
||||
|
||||
ui.button(style='file_picker_entry',
|
||||
clicked=clicked,
|
||||
enable_hover=enable_hover)
|
||||
|
||||
ui.hbox(padding=library.padding)
|
||||
|
||||
if not library.disable_thumbnails:
|
||||
ui.null(width=library.thumbnail_width,
|
||||
height=library.thumbnail_height)
|
||||
|
||||
ui.text(name + ". ", style='file_picker_old')
|
||||
ui.text(_("Empty Slot."), style='file_picker_empty_slot')
|
||||
ui.close()
|
||||
|
||||
# This renders a slot with a file in it, in the file picker.
|
||||
def _render_savefile(name, info, newest):
|
||||
|
||||
image, extra = info
|
||||
|
||||
ui.button(style='file_picker_entry',
|
||||
clicked=ui.returns(("return", (name, True))))
|
||||
|
||||
ui.hbox(padding=library.padding)
|
||||
|
||||
if not library.disable_thumbnails:
|
||||
ui.add(image)
|
||||
|
||||
if name == newest:
|
||||
ui.text(name + ". ", style='file_picker_new')
|
||||
else:
|
||||
ui.text(name + ". ", style='file_picker_old')
|
||||
|
||||
|
||||
ui.text(extra, style='file_picker_extra_info')
|
||||
|
||||
ui.close()
|
||||
|
||||
_scratch.file_picker_index = None
|
||||
|
||||
# This displays a file picker that can chose a save file from
|
||||
# the list of save files.
|
||||
def _file_picker(selected, save):
|
||||
|
||||
# The number of slots in a page.
|
||||
file_page_length = library.file_page_cols * library.file_page_rows
|
||||
|
||||
saves, newest = renpy.saved_games()
|
||||
|
||||
# The index of the first entry in the page.
|
||||
fpi = _scratch.file_picker_index
|
||||
|
||||
if fpi is None:
|
||||
fpi = 0
|
||||
|
||||
if newest:
|
||||
fpi = (int(newest) - 1) // file_page_length * file_page_length
|
||||
|
||||
if fpi < 0:
|
||||
fpi = 0
|
||||
|
||||
|
||||
while True:
|
||||
|
||||
if fpi < 0:
|
||||
fpi = 0
|
||||
|
||||
_scratch.file_picker_index = fpi
|
||||
|
||||
# Show Navigation
|
||||
_game_nav(selected)
|
||||
|
||||
ui.window(style='file_picker_window')
|
||||
ui.vbox() # whole thing.
|
||||
|
||||
if not library.disable_file_pager:
|
||||
|
||||
# Draw the navigation.
|
||||
ui.hbox(padding=library.padding * 10, style='file_picker_navbox') # nav buttons.
|
||||
|
||||
def tb(cond, label, clicked):
|
||||
_button_factory(label, "file_picker_nav", disabled=not cond, clicked=clicked)
|
||||
|
||||
# Previous
|
||||
tb(fpi > 0, _('Previous'), ui.returns(("fpidelta", -1)))
|
||||
|
||||
# Quick Access
|
||||
for i in range(0, library.file_quick_access_pages):
|
||||
target = i * file_page_length
|
||||
tb(fpi != target, str(i + 1), ui.returns(("fpiset", target)))
|
||||
|
||||
# Next
|
||||
tb(True, _('Next'), ui.returns(("fpidelta", +1)))
|
||||
|
||||
# Done with nav buttons.
|
||||
ui.close()
|
||||
|
||||
# This draws a single slot.
|
||||
def entry(offset):
|
||||
i = fpi + offset
|
||||
|
||||
name = str(i + 1)
|
||||
|
||||
if name not in saves:
|
||||
_render_new_slot(name, save)
|
||||
else:
|
||||
_render_savefile(name, saves[name], newest)
|
||||
|
||||
# Actually draw a slot.
|
||||
ui.grid(library.file_page_cols,
|
||||
library.file_page_rows,
|
||||
style='file_picker_grid',
|
||||
transpose=True) # slots
|
||||
|
||||
for i in range(0, file_page_length):
|
||||
entry(i)
|
||||
|
||||
ui.close() # slots
|
||||
|
||||
ui.close() # whole thing
|
||||
|
||||
result = _game_interact()
|
||||
type, value = result
|
||||
|
||||
if type == "return":
|
||||
return value
|
||||
|
||||
if type == "fpidelta":
|
||||
fpi += value * file_page_length
|
||||
|
||||
if type == "fpiset":
|
||||
fpi = value
|
||||
|
||||
|
||||
# This renders a yes/no prompt, as part of the game menu. If
|
||||
# screen is None, then it omits the game menu navigation.
|
||||
def _yesno_prompt(screen, message, nav=True):
|
||||
|
||||
_game_nav(screen)
|
||||
|
||||
ui.window(style='yesno_window')
|
||||
ui.vbox(library.padding * 10, xpos=0.5, xanchor='center', ypos=0.5, yanchor='center')
|
||||
|
||||
_label_factory(message, "yesno", xpos=0.5, xanchor='center')
|
||||
|
||||
ui.grid(5, 1, xfill=True)
|
||||
|
||||
# The extra nulls are because we want equal whitespace surrounding
|
||||
# the two buttons. It should work as long as we have xfill=True
|
||||
ui.null()
|
||||
_button_factory("Yes", 'yesno', clicked=ui.returns(True), xpos=0.5, xanchor='center')
|
||||
ui.null()
|
||||
_button_factory("No", 'yesno', clicked=ui.returns(False), xpos=0.5, xanchor='center')
|
||||
ui.null()
|
||||
|
||||
ui.close()
|
||||
ui.close()
|
||||
|
||||
return _game_interact()
|
||||
|
||||
def _show_exception(title, message):
|
||||
ui.window(style='error_window')
|
||||
ui.vbox()
|
||||
|
||||
ui.text(title, style='error_title')
|
||||
ui.text("")
|
||||
ui.text(message, style='error_body')
|
||||
ui.text("")
|
||||
ui.text(_("Please click to continue."), style='error_body')
|
||||
|
||||
ui.close()
|
||||
|
||||
ui.saybehavior()
|
||||
|
||||
ui.interact()
|
||||
|
||||
def _quit_prompt(screen="quit"):
|
||||
|
||||
def prompt():
|
||||
return _yesno_prompt(screen, "Are you sure you want to quit the game?")
|
||||
|
||||
if renpy.invoke_in_new_context(prompt):
|
||||
renpy.quit()
|
||||
else:
|
||||
return
|
||||
|
||||
def _mainmenu_prompt(screen="mainmenu"):
|
||||
|
||||
def prompt():
|
||||
return _yesno_prompt(screen, "Are you sure you want to return to the main menu?\nThis will end your game.")
|
||||
|
||||
if renpy.invoke_in_new_context(prompt):
|
||||
renpy.full_restart()
|
||||
else:
|
||||
return
|
||||
|
||||
|
||||
|
||||
##############################################################################
|
||||
# The actual menus begin around here.
|
||||
|
||||
# First up, we have the code that is common to all of the entry points into
|
||||
# the game.
|
||||
|
||||
# This is the code that executes when entering a menu context.
|
||||
label _enter_menu:
|
||||
scene
|
||||
$ renpy.movie_stop()
|
||||
$ renpy.take_screenshot((library.thumbnail_width, library.thumbnail_height))
|
||||
|
||||
# This may be changed, if we are already in the main menu.
|
||||
$ renpy.context().main_menu = False
|
||||
|
||||
return
|
||||
|
||||
# Factored this all into one place, to make our lives a bit easier.
|
||||
label _enter_game_menu:
|
||||
call _enter_menu from _call__enter_menu_2
|
||||
|
||||
if library.enter_transition:
|
||||
$ renpy.transition(library.enter_transition)
|
||||
|
||||
if renpy.has_label("enter_game_menu"):
|
||||
call expression "enter_game_menu" from _call_enter_game_menu_1
|
||||
|
||||
return
|
||||
|
||||
##############################################################################
|
||||
# Now, we have the actual entry points into the various menu screens.
|
||||
|
||||
# Entry points from the game into menu-space.
|
||||
label _game_menu:
|
||||
label _game_menu_save:
|
||||
call _enter_game_menu from _call__enter_game_menu_1
|
||||
jump _save_screen
|
||||
|
||||
label _game_menu_load:
|
||||
call _enter_game_menu from _call__enter_game_menu_2
|
||||
jump _load_screen
|
||||
|
||||
label _game_menu_preferences:
|
||||
call _enter_game_menu from _call__enter_game_menu_3
|
||||
jump _prefs_screen
|
||||
|
||||
label _confirm_quit:
|
||||
call _enter_menu from _call__enter_menu_3
|
||||
$ _quit_prompt(None)
|
||||
return
|
||||
|
||||
|
||||
##############################################################################
|
||||
# Finally, we have the actual menu screens that are shown to the user.
|
||||
|
||||
label _load_screen:
|
||||
|
||||
python hide:
|
||||
|
||||
fn, exists = _file_picker("load", False )
|
||||
|
||||
if not renpy.context().main_menu and _load_prompt:
|
||||
if _yesno_prompt("load", "Loading a new game will end your current game.\nAre you sure you want to do this?"):
|
||||
renpy.load(fn)
|
||||
else:
|
||||
renpy.load(fn)
|
||||
|
||||
jump _load_screen
|
||||
|
||||
label _save_screen:
|
||||
$ _fn, _exists = _file_picker("save", True)
|
||||
|
||||
if not _exists or _yesno_prompt("save", "Are you sure you want to overwrite your save?"):
|
||||
python hide:
|
||||
|
||||
if save_name:
|
||||
full_save_name = "\n" + save_name
|
||||
else:
|
||||
full_save_name = ""
|
||||
|
||||
try:
|
||||
renpy.save(_fn, renpy.time.strftime("%b %d, %H:%M") +
|
||||
full_save_name)
|
||||
|
||||
except Exception, e:
|
||||
|
||||
if config.debug:
|
||||
raise
|
||||
|
||||
message = ( _("The error message was:\n\n") +
|
||||
e.__class__.__name__ + ": " + unicode(e) + "\n\n" +
|
||||
_("You may want to try saving in a different slot, or playing for a while and trying again later."))
|
||||
|
||||
_show_exception(_("Save Failed."), message)
|
||||
|
||||
|
||||
jump _save_screen
|
||||
|
||||
label _quit:
|
||||
$ renpy.quit()
|
||||
|
||||
# Make some noise, then return.
|
||||
label _noisy_return:
|
||||
$ renpy.play(library.exit_sound)
|
||||
|
||||
# Return to the game.
|
||||
label _return:
|
||||
|
||||
if renpy.context().main_menu:
|
||||
jump _main_menu
|
||||
|
||||
if library.exit_transition:
|
||||
$ renpy.transition(library.exit_transition)
|
||||
|
||||
return
|
||||
@@ -1,200 +0,0 @@
|
||||
# This file consists of renpy functions that aren't expected to be
|
||||
# touched by the user too much. We reserve the _ prefix for names
|
||||
# defined in the library.
|
||||
|
||||
# It's strongly reccomended that you don't edit this file, as future
|
||||
# releases of Ren'Py will probably change this file to include more
|
||||
# functionality.
|
||||
|
||||
# It's also strongly recommended that you leave this file in the
|
||||
# game directory, so its functionality is included in your game.
|
||||
|
||||
|
||||
|
||||
init -500:
|
||||
python:
|
||||
|
||||
# These are settings that the user can tweak to control the
|
||||
# look of the main menu and the load/save/escape screens.
|
||||
|
||||
# Used to store library settings.
|
||||
library = object()
|
||||
|
||||
# The minimum version of the module we work with. Don't change
|
||||
# this unless you know what you're doing.
|
||||
library.module_version = 4008002
|
||||
|
||||
# Should we warn the user if the module is missing or has a bad
|
||||
# version?
|
||||
library.module_warning = False
|
||||
|
||||
# Used to translate strings in the library.
|
||||
library.translations = { }
|
||||
|
||||
# True if the skip indicator should be shown.
|
||||
library.skip_indicator = True
|
||||
|
||||
# This is updated to give the user an idea of where a save is
|
||||
# taking place.
|
||||
save_name = ''
|
||||
|
||||
def _button_factory(label,
|
||||
type=None,
|
||||
selected=None,
|
||||
disabled=False,
|
||||
clicked=None,
|
||||
**properties):
|
||||
"""
|
||||
This function is called to create the various buttons used
|
||||
in the game menu. By overriding this function, one can
|
||||
(for example) replace the default textbuttons with image buttons.
|
||||
When it is called, it's expected to add a button to the screen.
|
||||
|
||||
@param label: The label of this button, before translation.
|
||||
|
||||
@param type: The type of the button. One of "mm" (main menu),
|
||||
"gm_nav" (game menu), "file_picker_nav", "yesno", or "prefs".
|
||||
|
||||
@param selected: True if the button is selected, False if not,
|
||||
or None if it doesn't matter.
|
||||
|
||||
@param disabled: True if the button is disabled, False if not.
|
||||
|
||||
@param clicked: A function that should be executed when the
|
||||
button is clicked.
|
||||
|
||||
@param properties: Addtional layout properties.
|
||||
"""
|
||||
|
||||
style = type
|
||||
|
||||
if selected and not disabled:
|
||||
style += "_selected"
|
||||
|
||||
if disabled:
|
||||
clicked = None
|
||||
|
||||
style = style + "_button"
|
||||
text_style = style + "_text"
|
||||
|
||||
ui.textbutton(_(label), style=style, text_style=text_style, clicked=clicked, **properties)
|
||||
|
||||
def _label_factory(label, type, **properties):
|
||||
"""
|
||||
This function is called to create a new label. It can be
|
||||
overridden by the user to change how these labels are created.
|
||||
|
||||
@param label: The label of the box.
|
||||
|
||||
@param type: "prefs" or "yesno".
|
||||
|
||||
@param properties: This may contain position properties.
|
||||
"""
|
||||
|
||||
ui.text(_(label), style=type + "_label", **properties)
|
||||
|
||||
# The function that's used to translate strings in the game menu.
|
||||
def _(s):
|
||||
"""
|
||||
Translates s into another language or something.
|
||||
"""
|
||||
|
||||
if s in library.translations:
|
||||
return library.translations[s]
|
||||
else:
|
||||
return s
|
||||
|
||||
# Are the windows currently hidden?
|
||||
_windows_hidden = False
|
||||
|
||||
# Set up the default keymap.
|
||||
python hide:
|
||||
|
||||
# Called to make a screenshot happen.
|
||||
def screenshot():
|
||||
renpy.screenshot("screenshot.bmp")
|
||||
|
||||
def invoke_game_menu():
|
||||
renpy.play(library.enter_sound)
|
||||
renpy.call_in_new_context('_game_menu')
|
||||
|
||||
def toggle_skipping():
|
||||
config.skipping = not config.skipping
|
||||
|
||||
# The default keymap.
|
||||
km = renpy.Keymap(
|
||||
rollback = renpy.rollback,
|
||||
screenshot = screenshot,
|
||||
toggle_fullscreen = renpy.toggle_fullscreen,
|
||||
toggle_music = renpy.toggle_music,
|
||||
toggle_skip = toggle_skipping,
|
||||
game_menu = invoke_game_menu,
|
||||
hide_windows = renpy.curried_call_in_new_context("_hide_windows")
|
||||
)
|
||||
|
||||
config.underlay = [ km ]
|
||||
|
||||
|
||||
# The skip indicator.
|
||||
python hide:
|
||||
|
||||
def skip_indicator():
|
||||
|
||||
if config.allow_skipping and library.skip_indicator:
|
||||
|
||||
ui.conditional("config.skipping")
|
||||
ui.text(_("Skip Mode"), style='skip_indicator')
|
||||
|
||||
config.overlay_functions.append(skip_indicator)
|
||||
|
||||
return
|
||||
|
||||
label _hide_windows:
|
||||
|
||||
if _windows_hidden:
|
||||
return
|
||||
|
||||
python:
|
||||
_windows_hidden = True
|
||||
ui.saybehavior()
|
||||
ui.interact(suppress_overlay=True)
|
||||
_windows_hidden = False
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Code for the game menu.
|
||||
|
||||
|
||||
|
||||
# This code here handles check for the correct version of the Ren'Py module.
|
||||
|
||||
label _check_module:
|
||||
|
||||
if not library.module_warning:
|
||||
return
|
||||
|
||||
python hide:
|
||||
module_info = _("While Ren'Py games are playable without the _renpy module, some features may be disabled. For more information, read the module/README.txt file or go to http://www.bishoujo.us/renpy/.")
|
||||
|
||||
if renpy.module_version() == 0:
|
||||
_show_exception(_("_renpy module not found."),
|
||||
_("The _renpy module could not be loaded on your system.") + "\n\n" + module_info)
|
||||
elif renpy.module_version() < library.module_version:
|
||||
_show_exception(_("Old _renpy module found."),
|
||||
_("An old version (%d) of the Ren'Py module was found on your system, while this game requires version %d.") % (renpy.module_version(), library.module_version) + "\n\n" + module_info)
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
# Random nice things to have.
|
||||
init:
|
||||
$ centered = Character(None, what_style="centered_text", window_style="centered_window")
|
||||
image text = renpy.ParameterizedText(style="centered_text")
|
||||
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
# This file contains code fo the main menu, and anything else that
|
||||
# happens upon initial execution of a Ren'Py program.
|
||||
|
||||
init -498:
|
||||
python hide:
|
||||
|
||||
# The contents of the main menu.
|
||||
library.main_menu = [
|
||||
( "Start Game", "start" ),
|
||||
( "Continue Game", ui.jumps("_load_screen") ),
|
||||
( "Preferences", ui.jumps("_prefs_screen") ),
|
||||
( "Quit Game", ui.jumps("_quit") ),
|
||||
]
|
||||
|
||||
# This is the true starting point of the program. Sssh... Don't
|
||||
# tell anyone.
|
||||
label _start:
|
||||
|
||||
call _check_module from _call__check_module_1
|
||||
|
||||
if renpy.has_label("splashscreen") and not _restart:
|
||||
call expression "splashscreen" from _call_splashscreen_1
|
||||
|
||||
# Clean out any residual scene from the splashscreen.
|
||||
scene
|
||||
|
||||
$ renpy.call_in_new_context("_enter_main_menu")
|
||||
|
||||
# Should never happen... but might as well do something
|
||||
jump start
|
||||
|
||||
# At this point, we've been switched into a new context. So we
|
||||
# initialize it.
|
||||
label _enter_main_menu:
|
||||
|
||||
call _enter_menu from _call__enter_menu_1
|
||||
|
||||
$ renpy.context().main_menu = True
|
||||
|
||||
# This is called to show the main menu to the user.
|
||||
label _main_menu:
|
||||
|
||||
# Let the user completely override the main menu. (But please note
|
||||
# it still lives in the menu context, rather than the game context.)
|
||||
if renpy.has_label("main_menu"):
|
||||
jump expression "main_menu"
|
||||
|
||||
# This is the default main menu, which we get if the user hasn't
|
||||
# defined his own, or if that function calls this explicitly.
|
||||
label _library_main_menu:
|
||||
|
||||
scene
|
||||
|
||||
python hide:
|
||||
|
||||
ui.add(renpy.Keymap(toggle_fullscreen = renpy.toggle_fullscreen))
|
||||
ui.keymousebehavior()
|
||||
|
||||
ui.window(style='mm_root_window')
|
||||
ui.fixed()
|
||||
|
||||
ui.window(style='mm_menu_window')
|
||||
ui.vbox()
|
||||
|
||||
for text, clicked in library.main_menu:
|
||||
|
||||
if isinstance(clicked, basestring):
|
||||
clicked = ui.jumpsoutofcontext(clicked)
|
||||
|
||||
_button_factory(text, "mm", clicked=clicked)
|
||||
|
||||
ui.close()
|
||||
ui.close()
|
||||
|
||||
store._result = ui.interact(suppress_overlay = True,
|
||||
suppress_underlay = True)
|
||||
|
||||
# Computed jump to the appropriate label.
|
||||
jump _main_menu
|
||||
@@ -1,128 +0,0 @@
|
||||
# This file contains code to manage the playing of music. It's here,
|
||||
# in an rpy file, because we now optionally let the user override all
|
||||
# of this to implement his or her own music system, using calls to
|
||||
# various functions found in audio.
|
||||
|
||||
init -1000:
|
||||
python hide:
|
||||
|
||||
# config.debug_sound = True
|
||||
|
||||
# This becomes renpy.music_start.
|
||||
def music_start(filename, loops=-1, fadeout=None):
|
||||
"""
|
||||
This starts music playing. If a music track is already
|
||||
playing, this pauses that music track in favor of this
|
||||
one.
|
||||
|
||||
@param filename: The file that the music will be played from.
|
||||
This is relative to the game directory, and must be a real
|
||||
file (so it cannot be stored in an archive).
|
||||
|
||||
@param loops: The number of times the music will loop
|
||||
after it finishes playing for the first time. This is
|
||||
made somewhat less accurate by rollback and loading. If
|
||||
this number is less than zero, the song will loop
|
||||
forever.
|
||||
|
||||
@param fadeout: If this parameter is not None, it is
|
||||
interpreted as a time in seconds, which gives how long
|
||||
it will take to fade out the currently playing music.
|
||||
"""
|
||||
|
||||
if loops >= 0:
|
||||
loops += 1
|
||||
|
||||
ctx = renpy.context()
|
||||
ctx._music_name = filename
|
||||
ctx._music_loops = loops
|
||||
|
||||
if fadeout and audio.music_enabled() and not config.skipping:
|
||||
audio.music_fadeout(fadeout)
|
||||
|
||||
def music_stop(fadeout=None):
|
||||
"""
|
||||
This stops the currently playing music track.
|
||||
|
||||
@param fadeout: If this parameter is not None, it is
|
||||
interpreted as a time in seconds, which gives how long
|
||||
it will take to fade out the currently playing music.
|
||||
"""
|
||||
|
||||
ctx = renpy.context()
|
||||
ctx._music_name = None
|
||||
ctx._music_loops = None
|
||||
|
||||
if fadeout and audio.music_enabled() and not config.skipping:
|
||||
audio.music_fadeout(fadeout)
|
||||
|
||||
renpy.music_start = music_start
|
||||
renpy.music_stop = music_stop
|
||||
|
||||
# This is called once for each interaction, to ensure that the
|
||||
# music is appropriate for that interaction.
|
||||
def music_interact():
|
||||
|
||||
if not audio.music_enabled():
|
||||
return
|
||||
|
||||
ctx = renpy.context()
|
||||
|
||||
if not hasattr(ctx, '_music_name'):
|
||||
ctx._music_name = None
|
||||
ctx._music_loops = None
|
||||
|
||||
playing, queued = audio.music_filenames()
|
||||
|
||||
# If music is disabled, ensure that it is stopped.
|
||||
if not _preferences.music:
|
||||
if playing:
|
||||
audio.music_stop()
|
||||
|
||||
return
|
||||
|
||||
# If we do not match what is playing, stop what's currently
|
||||
# playing and get ready to play something else.
|
||||
if ctx._music_name != playing:
|
||||
|
||||
# If we're not playing anything, immediately start the
|
||||
# new track by calling music_end_event.
|
||||
if not playing:
|
||||
config.music_end_event()
|
||||
|
||||
# Otherwise, we will start a fade to the new music if no
|
||||
# such fade is already in progress, and we're not skipping.
|
||||
elif not audio.music_fading() and not config.skipping:
|
||||
audio.music_fadeout(config.fade_music)
|
||||
|
||||
# This is called whenever a track of music ends, or also from the
|
||||
# above when we want to start a new track when nothing else is
|
||||
# playing.
|
||||
def music_end_event():
|
||||
|
||||
if not _preferences.music:
|
||||
return
|
||||
|
||||
ctx = renpy.context()
|
||||
playing, queued = audio.music_filenames()
|
||||
|
||||
if not hasattr(ctx, '_music_name'):
|
||||
ctx._music_name = None
|
||||
ctx._music_loops = None
|
||||
|
||||
if not ctx._music_name:
|
||||
return
|
||||
|
||||
if not playing and ctx._music_loops:
|
||||
ctx._music_loops -= 1
|
||||
audio.music_play(ctx._music_name)
|
||||
|
||||
if not queued and ctx._music_loops:
|
||||
ctx._music_loops -= 1
|
||||
audio.music_queue(ctx._music_name)
|
||||
|
||||
config.interact_callbacks.append(music_interact)
|
||||
config.music_end_event = music_end_event
|
||||
|
||||
|
||||
|
||||
@@ -1,241 +0,0 @@
|
||||
# This file contains the code to implement the Ren'Py preferences
|
||||
# screen.
|
||||
|
||||
init -450:
|
||||
python:
|
||||
|
||||
# This is a map from the name of the style that is applied to
|
||||
# a list of preferences that should be placed into a vbox
|
||||
# with that style.
|
||||
library.preferences = { }
|
||||
|
||||
class _Preference(object):
|
||||
"""
|
||||
This is a class that's used to represent a preference that
|
||||
may be shown to the user.
|
||||
"""
|
||||
|
||||
def __init__(self, name, field, values, base=_preferences):
|
||||
"""
|
||||
@param name: The name of this preference. It will be
|
||||
displayed to the user.
|
||||
|
||||
@param variable: The field on the base object
|
||||
that will be assigned the selected value. This field
|
||||
must exist.
|
||||
|
||||
@param values: A list of value name, value, condition
|
||||
triples. The value name is the name of this value that
|
||||
will be shown to the user. The value is the literal
|
||||
python value that will be assigned if this value is
|
||||
selected. The condition is a condition that will be
|
||||
evaluated to determine if this is a legal value. If no
|
||||
conditions are true, this preference will not be
|
||||
displayed to the user. A condition of None is always
|
||||
considered to be True.
|
||||
|
||||
@param base: The base object on which the variable is
|
||||
read from and set. This defaults to _preferences,
|
||||
the user preferences object.
|
||||
"""
|
||||
|
||||
self.name = name
|
||||
self.field = field
|
||||
self.values = values
|
||||
self.base = base
|
||||
|
||||
def render_preference(self):
|
||||
values = [ (name, val) for name, val, cond in self.values
|
||||
if cond is None or renpy.eval(cond) ]
|
||||
|
||||
if not values:
|
||||
return
|
||||
|
||||
ui.window(style='prefs_pref')
|
||||
ui.vbox()
|
||||
|
||||
_label_factory(self.name, "prefs")
|
||||
|
||||
cur = getattr(self.base, self.field)
|
||||
|
||||
for name, value in values:
|
||||
|
||||
def clicked(value=value):
|
||||
setattr(self.base, self.field, value)
|
||||
return True
|
||||
|
||||
_button_factory(name, "prefs",
|
||||
selected=cur==value,
|
||||
clicked=clicked)
|
||||
|
||||
ui.close()
|
||||
|
||||
class _PreferenceSpinner(object):
|
||||
"""
|
||||
This is a class that's used to represent a preference
|
||||
spinner, which is a preference that can be incremented
|
||||
and decremented, when shown to the user.
|
||||
"""
|
||||
|
||||
def __init__(self, name, field, minimum, maximum, delta,
|
||||
cond = "True", render = lambda x : str(x),
|
||||
base=_preferences):
|
||||
"""
|
||||
@param name: The name of this preference, that is presented
|
||||
to the user.
|
||||
|
||||
@param field: The name of the field on the base object
|
||||
that is updated by this spinner.
|
||||
|
||||
@param minimum: The minimum value that this spinner can set
|
||||
the value to.
|
||||
|
||||
@param maximum: The maximum value that this spinner can set
|
||||
the value to.
|
||||
|
||||
@param delta: The delta by which this spinner is
|
||||
incremented or decremented.
|
||||
|
||||
@param cond: If this condition is not true, this spinner is
|
||||
not shown.
|
||||
|
||||
@param render: This function is called with the value of
|
||||
the field, and is expected to render that value to a
|
||||
string.
|
||||
|
||||
@param base: The base object that this spinner updates
|
||||
the field on. It defaults to _preferences, the preferences
|
||||
object.
|
||||
"""
|
||||
|
||||
self.name = name
|
||||
self.field = field
|
||||
self.minimum = minimum
|
||||
self.maximum = maximum
|
||||
self.delta = delta
|
||||
self.cond = cond
|
||||
self.render = render
|
||||
self.base = base
|
||||
|
||||
def render_preference(self):
|
||||
|
||||
if not renpy.eval(self.cond):
|
||||
return
|
||||
|
||||
ui.window(style='prefs_pref')
|
||||
ui.vbox()
|
||||
|
||||
_label_factory(self.name, "prefs")
|
||||
|
||||
cur = getattr(self.base, self.field)
|
||||
|
||||
|
||||
def minus_clicked():
|
||||
value = cur - self.delta
|
||||
value = max(self.minimum, value)
|
||||
setattr(self.base, self.field, value)
|
||||
return True
|
||||
|
||||
def plus_clicked():
|
||||
value = cur + self.delta
|
||||
value = min(self.maximum, value)
|
||||
setattr(self.base, self.field, value)
|
||||
return True
|
||||
|
||||
ui.hbox(style='prefs_spinner')
|
||||
_button_factory("-", "prefs_spinner", clicked=minus_clicked)
|
||||
_label_factory(self.render(cur), "prefs_spinner")
|
||||
_button_factory("+", "prefs_spinner", clicked=plus_clicked)
|
||||
ui.close()
|
||||
|
||||
ui.close()
|
||||
|
||||
|
||||
|
||||
|
||||
python hide:
|
||||
|
||||
# Enablers for some preferences.
|
||||
library.has_music = True
|
||||
library.has_sound = True
|
||||
library.has_transitions = True
|
||||
library.has_cps = True
|
||||
|
||||
|
||||
p1 = _Preference('Display', 'fullscreen', [
|
||||
('Window', False, None),
|
||||
('Fullscreen', True, None),
|
||||
])
|
||||
|
||||
p2 = _Preference('Music', 'music', [
|
||||
('Enabled', True, 'library.has_music'),
|
||||
('Disabled', False, 'library.has_music'),
|
||||
])
|
||||
|
||||
p3 = _Preference('Sound Effects', 'sound', [
|
||||
('Enabled', True, 'library.has_sound'),
|
||||
('Disabled', False, 'library.has_sound'),
|
||||
])
|
||||
|
||||
|
||||
library.preferences['prefs_left'] = [ p1, p2, p3 ]
|
||||
|
||||
p4 = _Preference('TAB and CTRL Skip', 'skip_unseen', [
|
||||
('Seen Messages', False, 'config.allow_skipping'),
|
||||
('All Messages', True, 'config.allow_skipping'),
|
||||
])
|
||||
|
||||
p5 = _Preference('Transitions', 'transitions', [
|
||||
('All', 2, 'library.has_transitions'),
|
||||
('Some', 1, 'library.has_transitions and default_transition'),
|
||||
('None', 0, 'library.has_transitions'),
|
||||
])
|
||||
|
||||
# p6 = _Preference('Text Display', 'fast_text', [
|
||||
# ('Fast', True, 'config.annoying_text_cps'),
|
||||
# ('Slow', False, 'config.annoying_text_cps'),
|
||||
# ])
|
||||
|
||||
def cps_render(n):
|
||||
if n == 0:
|
||||
return "Infinite"
|
||||
else:
|
||||
return str(n)
|
||||
|
||||
p6 = _PreferenceSpinner('Text Speed (CPS)', 'text_cps',
|
||||
0, 500, 10, 'library.has_cps',
|
||||
render=cps_render)
|
||||
|
||||
|
||||
library.preferences['prefs_right'] = [ p4, p5, p6 ]
|
||||
|
||||
label _prefs_screen:
|
||||
|
||||
python hide:
|
||||
|
||||
_game_nav("prefs")
|
||||
|
||||
ui.window(style='prefs_window')
|
||||
ui.fixed()
|
||||
|
||||
|
||||
for style, prefs in library.preferences.iteritems():
|
||||
|
||||
ui.vbox(library.padding * 3, style=style)
|
||||
for i in prefs:
|
||||
i.render_preference()
|
||||
ui.close()
|
||||
|
||||
ui.close()
|
||||
|
||||
_game_interact()
|
||||
|
||||
jump _prefs_screen
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 606 B |
@@ -1,474 +0,0 @@
|
||||
# This file is responsible for creating and defining the default styles
|
||||
# used by the system.
|
||||
|
||||
# This file should be considered part of the Ren'Py library, and not
|
||||
# something that needs to be modified by the user. Instead, just update
|
||||
# the appropriate style property in an init: block in your script.
|
||||
#
|
||||
# For example, to change the default window backgrounds to a
|
||||
# transparent dark red, add:
|
||||
#
|
||||
# init:
|
||||
# $ style.window.background = renpy.Solid((128, 0, 0, 128)
|
||||
#
|
||||
# to your script. No need to mess around here, it will just make your
|
||||
# life harder when a new version of Ren'Py is released.
|
||||
|
||||
init -1000:
|
||||
python hide:
|
||||
|
||||
style.create('default', None,
|
||||
'The default style that all styles inherit from.')
|
||||
|
||||
dark_cyan = (0, 192, 255, 255)
|
||||
bright_cyan = (0, 255, 255, 255)
|
||||
|
||||
dark_red = (255, 128, 128, 255)
|
||||
bright_red = (255, 64, 64, 255)
|
||||
|
||||
green = (0, 128, 0, 255)
|
||||
|
||||
# Magic.
|
||||
style.default.enable_hover = True
|
||||
|
||||
# Text properties.
|
||||
style.default.font = "Vera.ttf"
|
||||
style.default.antialias = True
|
||||
style.default.size = 22
|
||||
style.default.color = (255, 255, 255, 255)
|
||||
style.default.bold = False
|
||||
style.default.italic = False
|
||||
style.default.underline = False
|
||||
style.default.drop_shadow = (1, 1)
|
||||
style.default.drop_shadow_color = (0, 0, 0, 128)
|
||||
style.default.minwidth = 0
|
||||
style.default.textalign = 0
|
||||
style.default.text_y_fudge = 0
|
||||
style.default.first_indent = 0
|
||||
style.default.rest_indent = 0
|
||||
style.default.line_spacing = 0
|
||||
|
||||
# Window properties.
|
||||
style.default.background = None
|
||||
style.default.xpadding = 0
|
||||
style.default.ypadding = 0
|
||||
style.default.xmargin = 0
|
||||
style.default.ymargin = 0
|
||||
style.default.xfill = False
|
||||
style.default.yfill = False
|
||||
style.default.xminimum = 0 # Includes margins and padding.
|
||||
style.default.yminimum = 0 # Includes margins and padding.
|
||||
|
||||
# Placement properties.
|
||||
style.default.xpos = 0
|
||||
style.default.ypos = 0
|
||||
style.default.xanchor = 'left'
|
||||
style.default.yanchor = 'top'
|
||||
style.default.xmaximum = None
|
||||
style.default.ymaximum = None
|
||||
|
||||
# Sound properties.
|
||||
style.default.sound = None
|
||||
|
||||
# The base style for the large windows.
|
||||
style.create('window', 'default',
|
||||
'(window, placement) The base style for the windows that contain dialogue, thoughts, and menus.')
|
||||
|
||||
style.window.background = Solid((0, 0, 128, 128))
|
||||
style.window.xpadding = 10
|
||||
style.window.ypadding = 5
|
||||
style.window.xmargin = 10
|
||||
style.window.ymargin = 5
|
||||
style.window.xfill = True
|
||||
style.window.yfill = False
|
||||
style.window.xminimum = 0 # Includes margins and padding.
|
||||
style.window.yminimum = 150 # Includes margins and padding.
|
||||
|
||||
style.window.xpos = 0.5
|
||||
style.window.ypos = 1.0
|
||||
style.window.xanchor = 'center'
|
||||
style.window.yanchor = 'bottom'
|
||||
|
||||
# This style controls the default placement of images on the screen.
|
||||
|
||||
style.create('image_placement', 'default',
|
||||
'This style is used to control the default placement of images on the screen.')
|
||||
|
||||
style.image_placement.xpos = 0.5
|
||||
style.image_placement.ypos = 1.0
|
||||
style.image_placement.xanchor = 'center'
|
||||
style.image_placement.yanchor = 'bottom'
|
||||
|
||||
# Styles that are used for dialogue.
|
||||
|
||||
style.create('say_label', 'default',
|
||||
"""(text) The style that is used by default for
|
||||
the label of dialogue. The label is used to
|
||||
indicate who is saying something.""")
|
||||
|
||||
style.say_label.bold = True
|
||||
|
||||
style.create('say_dialogue', 'default',
|
||||
"""(text) The style that is used by default for
|
||||
the text of dialogue.""")
|
||||
|
||||
style.create('say_thought', 'default',
|
||||
"""(text) The label that is used by default for
|
||||
the text of thoughts or narration, when no
|
||||
speaker is given.""")
|
||||
|
||||
style.create('say_window', 'window',
|
||||
'(window, position) The default style for windows containing dialogue and thoughts.')
|
||||
|
||||
|
||||
# Styles that are used for menus.
|
||||
|
||||
style.create('menu', 'default',
|
||||
"(position) The style that is used for the vbox containing a menu.")
|
||||
|
||||
style.create('menu_caption', 'default',
|
||||
"(text) The style that is used to render a menu caption.")
|
||||
|
||||
style.create('menu_choice', 'default',
|
||||
"""(text, hover) The style that is used to render
|
||||
the text of a menu choice.""")
|
||||
|
||||
style.create('menu_choice_button', 'default',
|
||||
"""(window, hover, sound) The style that is used
|
||||
to render the button containing a menu choice.""")
|
||||
|
||||
style.menu_choice.hover_color = (255, 255, 0, 255) # yellow
|
||||
style.menu_choice.activate_color = (255, 255, 0, 255) # yellow
|
||||
style.menu_choice.idle_color = (0, 255, 255, 255) # cyan
|
||||
|
||||
style.create('menu_window', 'window',
|
||||
'(window, position) The default style for windows containing a menu.')
|
||||
|
||||
# Styles that are used by input widgets.
|
||||
style.create('input_text', 'default',
|
||||
'(text) The style used for the text of an input box.')
|
||||
|
||||
style.input_text.color = (255, 255, 0, 255)
|
||||
|
||||
style.create('input_prompt', 'default',
|
||||
'(text) The style used for the prompt of an input box.')
|
||||
|
||||
style.create('input_window', 'window',
|
||||
'(window, position) The style used for the window of an input box.')
|
||||
|
||||
# Styles used by centered.
|
||||
style.create('centered_window', 'default',
|
||||
'(window) The style that is used for a "window" containing centered text.')
|
||||
|
||||
style.create('centered_text', 'default',
|
||||
'(text) The style used for centered text.')
|
||||
|
||||
style.centered_window.xpos = 0.5
|
||||
style.centered_window.xanchor = 'center'
|
||||
style.centered_window.xfill = False
|
||||
|
||||
style.centered_window.ypos = 0.5
|
||||
style.centered_window.yanchor = 'center'
|
||||
style.centered_window.yfill = False
|
||||
|
||||
style.centered_window.xpadding = 10
|
||||
|
||||
style.centered_text.textalign = 0.5
|
||||
style.centered_text.xpos = 0.5
|
||||
style.centered_text.ypos = 0.5
|
||||
style.centered_text.xanchor = 'center'
|
||||
style.centered_text.yanchor = 'center'
|
||||
|
||||
# Styles that are used by imagemaps
|
||||
style.create('imagemap', 'image_placement',
|
||||
'(position) The style that is used for imagemaps.')
|
||||
|
||||
style.create('imagemap_button', 'default',
|
||||
'(window, sound, hover) The style that is used for buttons inside imagemaps.')
|
||||
|
||||
# Styles that are used by imagebutttons.
|
||||
style.create('image_button', 'default',
|
||||
'(window, sound, hover) The default style used for image buttons.')
|
||||
|
||||
style.create('image_button_image', 'default',
|
||||
'The default style used for images inside image buttons.')
|
||||
|
||||
|
||||
# Styles that are used by all other Buttons.
|
||||
style.create('button', 'default',
|
||||
'(window, sound, hover) The default style used for buttons in the main and game menus.')
|
||||
|
||||
style.button.xpos = 0.5
|
||||
style.button.xanchor = 'center'
|
||||
|
||||
style.create('button_text', 'default',
|
||||
'(text, hover) The default style used for the label of a button.')
|
||||
|
||||
style.button_text.xpos = 0.5
|
||||
style.button_text.xanchor = 'center'
|
||||
style.button_text.size = 24
|
||||
style.button_text.color = dark_cyan
|
||||
style.button_text.hover_color = bright_cyan
|
||||
style.button_text.activate_color = bright_cyan
|
||||
style.button_text.insensitive_color = (192, 192, 192, 255)
|
||||
style.button_text.drop_shadow = (2, 2)
|
||||
|
||||
# Selected button.
|
||||
style.create('selected_button', 'button',
|
||||
'(window, hover) The style that is used for a selected button (for example, the active screen or a chosen preference).')
|
||||
|
||||
style.create('selected_button_text', 'button_text',
|
||||
'(text, hover) The style that is used for the label of a selected button.')
|
||||
|
||||
style.selected_button_text.color = dark_red
|
||||
style.selected_button_text.hover_color = bright_red
|
||||
style.selected_button_text.activate_color = bright_red
|
||||
|
||||
# Bar.
|
||||
style.create('bar', 'default',
|
||||
'(bar) The style that is used by default for bars.')
|
||||
|
||||
style.bar.left_bar = Solid(bright_cyan)
|
||||
style.bar.right_bar = Solid((0, 0, 0, 128))
|
||||
|
||||
# Styles that are used when laying out the main menu.
|
||||
style.create('mm_root_window', 'default',
|
||||
'(window) The style used for the root window of the main menu. This is primarily used to set a background for the main menu.')
|
||||
|
||||
style.mm_root_window.background = Solid((0, 0, 0, 255))
|
||||
style.mm_root_window.xfill = True
|
||||
style.mm_root_window.yfill = True
|
||||
|
||||
style.create('mm_menu_window', 'default',
|
||||
'(window, position) A window that contains the choices in the main menu. Change this to change the placement of these choices on the main menu screen.')
|
||||
|
||||
style.mm_menu_window.xpos = 0.9
|
||||
style.mm_menu_window.xanchor = 'right'
|
||||
style.mm_menu_window.ypos = 0.9
|
||||
style.mm_menu_window.yanchor = 'bottom'
|
||||
|
||||
style.create('mm_button', 'button',
|
||||
'(window, hover) The style that is used on buttons that are part of the main menu.')
|
||||
|
||||
style.create('mm_button_text', 'button_text',
|
||||
'(text, hover) The style that is used for the labels of buttons that are part of the main menu.')
|
||||
|
||||
# Styles that are used to lay out the game menu.
|
||||
|
||||
style.create('gm_root_window', 'default',
|
||||
'(window) The style used for the root window of the game menu. This is primarily used to change the background of the game menu.')
|
||||
|
||||
style.gm_root_window.background = Solid((0, 0, 0, 255))
|
||||
style.gm_root_window.xfill = True
|
||||
style.gm_root_window.yfill = True
|
||||
|
||||
style.create('gm_nav_window', 'default',
|
||||
'(window, position) The style used by a window containing buttons that allow the user to navigate through the different screens of the game menu.')
|
||||
|
||||
style.gm_nav_window.xpos = 0.9
|
||||
style.gm_nav_window.xanchor = 'right'
|
||||
style.gm_nav_window.ypos = 0.95
|
||||
style.gm_nav_window.yanchor = 'bottom'
|
||||
|
||||
|
||||
style.create('gm_nav_button', 'button',
|
||||
'(window, hover) The style of an unselected game menu navigation button.')
|
||||
|
||||
style.create('gm_nav_button_text', 'button_text',
|
||||
'(text, hover) The style of the text of an unselected game menu navigation button.')
|
||||
|
||||
style.create('gm_nav_selected_button', 'selected_button',
|
||||
'(window, hover) The style of a selected game menu navigation button.')
|
||||
|
||||
style.create('gm_nav_selected_button_text', 'selected_button_text',
|
||||
'(text, hover) The style of the text of a selected game menu navigation button.')
|
||||
|
||||
style.create('file_picker_window', 'default',
|
||||
'(window, position) A window containing the file picker that is used to choose slots for loading and saving.')
|
||||
|
||||
style.file_picker_window.xpos = 0
|
||||
style.file_picker_window.xanchor = 'left'
|
||||
style.file_picker_window.ypos = 0
|
||||
style.file_picker_window.yanchor = 'top'
|
||||
style.file_picker_window.xpadding = 5
|
||||
|
||||
|
||||
style.create('file_picker_navbox', 'default',
|
||||
'(position) The position of the naviation (next/previous) buttons in the file picker.')
|
||||
|
||||
style.file_picker_navbox.xmargin = 10
|
||||
|
||||
style.create('file_picker_nav_button', 'button',
|
||||
'(window, hover) The style that is used for enabled file picker navigation buttons.')
|
||||
|
||||
style.create('file_picker_nav_button_text', 'button_text',
|
||||
'(text) The style that is used for the label of enabled file picker navigation buttons.')
|
||||
|
||||
|
||||
style.create('file_picker_grid', 'default',
|
||||
'(position) The style of the grid containing the file picker entries.')
|
||||
|
||||
style.file_picker_grid.xfill = True
|
||||
|
||||
style.create('file_picker_entry', 'button',
|
||||
'(window, hover) The style that is used for each of the slots in the file picker.')
|
||||
|
||||
style.file_picker_entry.xpadding = 5
|
||||
style.file_picker_entry.ypadding = 2
|
||||
style.file_picker_entry.xmargin = 5
|
||||
style.file_picker_entry.xfill = True
|
||||
style.file_picker_entry.ymargin = 2
|
||||
|
||||
style.file_picker_entry.background = Solid((255, 255, 255, 255))
|
||||
style.file_picker_entry.hover_background = Solid((255, 255, 192, 255))
|
||||
style.file_picker_entry.activate_background = Solid((255, 255, 192, 255))
|
||||
|
||||
style.create('file_picker_text', 'default',
|
||||
'(text) A base style for all text that is displayed in the file picker.')
|
||||
|
||||
style.file_picker_text.size = 18
|
||||
style.file_picker_text.color = dark_cyan
|
||||
style.file_picker_text.hover_color = bright_cyan
|
||||
|
||||
style.create('file_picker_new', 'file_picker_text',
|
||||
'(text) The style that is applied to the new indicator in the file picker.')
|
||||
|
||||
style.create('file_picker_old', 'file_picker_text',
|
||||
'(text) The style that is applied to the old indicator in the file pciker.')
|
||||
|
||||
style.file_picker_new.hover_color = bright_red
|
||||
style.file_picker_new.activate_color = bright_red
|
||||
style.file_picker_new.idle_color = dark_red
|
||||
style.file_picker_new.minwidth = 30
|
||||
style.file_picker_old.minwidth = 30
|
||||
|
||||
style.create('file_picker_extra_info', 'file_picker_text',
|
||||
'(text) The style that is applied to extra info in the file picker. The extra info is the save time, and the save_name if one exists.')
|
||||
|
||||
style.create('file_picker_empty_slot', 'file_picker_text',
|
||||
'(text) The style that is used for the empty slot indicator in the file picker.')
|
||||
|
||||
style.create('yesno_label', 'default',
|
||||
'(text, position) The style used for the prompt in a yes/no dialog.')
|
||||
|
||||
style.yesno_label.color = green
|
||||
style.yesno_label.textalign = 0.5
|
||||
|
||||
style.create('yesno_button', 'button',
|
||||
'(window, hover) The style of yes/no buttons.')
|
||||
|
||||
style.create('yesno_button_text', 'button_text',
|
||||
'(window, hover) The style of yes/no button text.')
|
||||
|
||||
style.create('yesno_window', 'default',
|
||||
'(window) The style of a window containing a yes/no dialogue.')
|
||||
|
||||
style.yesno_window.xfill = True
|
||||
style.yesno_window.yminimum = 0.5
|
||||
style.yesno_window.xmargin = .1
|
||||
|
||||
# Preferences
|
||||
|
||||
|
||||
style.create('prefs_pref', 'default',
|
||||
'(window, position) A window containing an individual preference.')
|
||||
|
||||
style.prefs_pref.xpos = 0.5
|
||||
style.prefs_pref.xanchor = 'center'
|
||||
style.prefs_pref.bottom_margin = 10
|
||||
|
||||
style.create('prefs_label', 'default',
|
||||
'(text, position) The style that is applied to the label of a block of preferences.')
|
||||
|
||||
style.prefs_label.xpos = 0.5
|
||||
style.prefs_label.xanchor = "center"
|
||||
style.prefs_label.color = green
|
||||
|
||||
style.create('prefs_button', 'button',
|
||||
'(window, hover) The style of an unselected preferences button.')
|
||||
|
||||
style.prefs_button.xpos = 0.5
|
||||
style.prefs_button.xanchor = 'center'
|
||||
|
||||
style.create('prefs_button_text', 'button_text',
|
||||
'(text, hover) The style of the text of an unselected preferences button.')
|
||||
|
||||
style.create('prefs_selected_button', 'selected_button',
|
||||
'(window, hover) The style of a selected preferences button.')
|
||||
|
||||
style.prefs_selected_button.xpos = 0.5
|
||||
style.prefs_selected_button.xanchor = 'center'
|
||||
|
||||
style.create('prefs_selected_button_text', 'selected_button_text',
|
||||
'(text, hover) The style of the text of a selected preferences button.')
|
||||
|
||||
style.create('prefs_window', 'default',
|
||||
'(window, position) A window containing all preferences.')
|
||||
|
||||
style.prefs_window.xfill=True
|
||||
style.prefs_window.ypadding = 0.05
|
||||
|
||||
style.create('prefs_left', 'default',
|
||||
'(position) The position of the left column of preferences.')
|
||||
|
||||
style.prefs_left.xanchor = 'center'
|
||||
style.prefs_left.xpos = 0.25
|
||||
|
||||
style.create('prefs_right', 'default',
|
||||
'(position) The position of the left column of preferences.')
|
||||
|
||||
style.prefs_right.xanchor = 'center'
|
||||
style.prefs_right.xpos = 0.75
|
||||
|
||||
style.create('prefs_spinner', 'default',
|
||||
'(position) The position of the prefs spinner.')
|
||||
|
||||
style.prefs_spinner.xpos = 0.5
|
||||
style.prefs_spinner.xanchor = 'center'
|
||||
|
||||
style.create('prefs_spinner_label', 'prefs_label',
|
||||
'(text) This is the style that displays the value of a preference spinner.')
|
||||
|
||||
style.prefs_spinner_label.minwidth = 100
|
||||
style.prefs_spinner_label.textalign = 0.5
|
||||
|
||||
style.create('prefs_spinner_button', 'prefs_button',
|
||||
'(window, hover) The style of the + or - buttons in a preference spinner.')
|
||||
|
||||
style.create('prefs_spinner_button_text', 'prefs_button_text',
|
||||
'(text, hover) The style of the text of the + and - buttons in a preference spinner.')
|
||||
|
||||
|
||||
|
||||
|
||||
# The skip indicator.
|
||||
|
||||
style.create('skip_indicator', 'default',
|
||||
'(text, position) The style of the text that is used to indicate that skipping is in progress.')
|
||||
|
||||
style.skip_indicator.xpos = 10
|
||||
style.skip_indicator.ypos = 10
|
||||
|
||||
|
||||
# Styles used by internal error messages.
|
||||
|
||||
style.create('error_window', 'default',
|
||||
'(window) The style of the window containing internal error messages.')
|
||||
|
||||
style.error_window.background = Solid((220, 220, 255, 255))
|
||||
style.error_window.xfill = True
|
||||
style.error_window.yfill = True
|
||||
style.error_window.xpadding = 20
|
||||
style.error_window.ypadding = 20
|
||||
|
||||
|
||||
style.create('error_title', 'default',
|
||||
'(text) The style of the text containing the title of an error message.')
|
||||
|
||||
style.error_title.color = (255, 128, 128, 255)
|
||||
|
||||
style.create('error_body', 'default',
|
||||
'(text) The style of the body of an error message.')
|
||||
|
||||
style.error_body.color = (128, 128, 255, 255)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
dist/console.exe
|
||||
@@ -1,160 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os.path
|
||||
|
||||
import codecs
|
||||
import optparse
|
||||
import traceback
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
# Extra things used for distribution.
|
||||
import encodings.utf_8
|
||||
import encodings.zlib_codec
|
||||
import encodings.unicode_escape
|
||||
import encodings.string_escape
|
||||
import encodings.raw_unicode_escape
|
||||
|
||||
dirname = os.path.dirname(sys.argv[0])
|
||||
|
||||
if dirname:
|
||||
os.chdir(dirname)
|
||||
|
||||
# Add the path to the module.
|
||||
sys.path.append("module")
|
||||
|
||||
def main():
|
||||
|
||||
name = os.path.basename(sys.argv[0])
|
||||
|
||||
if name.find(".") != -1:
|
||||
name = name[:name.find(".")]
|
||||
|
||||
if name.find("_") != -1:
|
||||
name = name[name.find("_") + 1:]
|
||||
|
||||
if os.path.isdir(name):
|
||||
game = name
|
||||
else:
|
||||
game = "game"
|
||||
|
||||
op = optparse.OptionParser()
|
||||
op.add_option('--game', dest='game', default=game,
|
||||
help='The directory the game is in.')
|
||||
|
||||
op.add_option('--python', dest='python', default=None,
|
||||
help='Run the argument in the python interpreter.')
|
||||
|
||||
op.add_option('--lint', dest='lint', default=False, action='store_true',
|
||||
help='Run a number of expensive tests, to try to detect errors in the script.')
|
||||
|
||||
op.add_option('--leak', dest='leak', action='store_true', default=False,
|
||||
help='When the game exits, dumps a profile of memory usage.')
|
||||
|
||||
options, args = op.parse_args()
|
||||
|
||||
if options.python:
|
||||
execfile(options.python)
|
||||
sys.exit(0)
|
||||
|
||||
if not options.lint:
|
||||
import renpy.display.presplash
|
||||
renpy.display.presplash.start(options.game)
|
||||
|
||||
# Load up all of Ren'Py, in the right order.
|
||||
import renpy
|
||||
|
||||
try:
|
||||
renpy.main.main(options.game, lint=options.lint)
|
||||
|
||||
except Exception, e:
|
||||
|
||||
f = file("traceback.txt", "wU")
|
||||
|
||||
f.write(codecs.BOM_UTF8)
|
||||
|
||||
print >>f, "I'm sorry, but an exception occured while executing your Ren'Py"
|
||||
print >>f, "script."
|
||||
print >>f
|
||||
|
||||
type, value, tb = sys.exc_info()
|
||||
|
||||
|
||||
print >>f, type.__name__ + ":",
|
||||
print >>f, unicode(e).encode('utf-8')
|
||||
print >>f
|
||||
print >>f, renpy.game.exception_info
|
||||
|
||||
print >>f
|
||||
print >>f, "-- Full Traceback ------------------------------------------------------------"
|
||||
print >>f
|
||||
|
||||
traceback.print_tb(tb, None, sys.stdout)
|
||||
traceback.print_tb(tb, None, f)
|
||||
|
||||
print >>f, type.__name__ + ":",
|
||||
print type.__name__ + ":",
|
||||
|
||||
print >>f, unicode(e).encode('utf-8')
|
||||
print unicode(e).encode('utf-8')
|
||||
|
||||
print
|
||||
print >>f
|
||||
|
||||
print renpy.game.exception_info
|
||||
print >>f, renpy.game.exception_info
|
||||
|
||||
print >>f
|
||||
print >>f, "Ren'Py Version:", renpy.version
|
||||
|
||||
f.close()
|
||||
|
||||
try:
|
||||
os.startfile('traceback.txt')
|
||||
except:
|
||||
pass
|
||||
|
||||
if options.leak:
|
||||
memory_profile()
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
def memory_profile():
|
||||
|
||||
import renpy
|
||||
|
||||
print "Memory Profile"
|
||||
print
|
||||
print "Showing all objects in memory at program termination."
|
||||
print
|
||||
|
||||
import gc
|
||||
gc.collect()
|
||||
|
||||
objs = gc.get_objects()
|
||||
|
||||
c = { } # count
|
||||
dead_renders = 0
|
||||
|
||||
for i in objs:
|
||||
t = type(i)
|
||||
c[t] = c.get(t, 0) + 1
|
||||
|
||||
if isinstance(i, renpy.display.render.Render):
|
||||
if i.dead:
|
||||
dead_renders += 1
|
||||
|
||||
|
||||
results = [ (count, ty) for ty, count in c.iteritems() ]
|
||||
results.sort()
|
||||
|
||||
for count, ty in results:
|
||||
print count, str(ty)
|
||||
|
||||
if dead_renders:
|
||||
print
|
||||
print "*** found", dead_renders, "dead Renders. ***"
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,822 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# Perforce Defect Tracking Integration Project
|
||||
# <http://www.ravenbrook.com/project/p4dti/>
|
||||
#
|
||||
# COVERAGE.PY -- COVERAGE TESTING
|
||||
#
|
||||
# Gareth Rees, Ravenbrook Limited, 2001-12-04
|
||||
# Ned Batchelder, 2004-12-12
|
||||
# http://nedbatchelder.com/code/modules/coverage.html
|
||||
#
|
||||
#
|
||||
# 1. INTRODUCTION
|
||||
#
|
||||
# This module provides coverage testing for Python code.
|
||||
#
|
||||
# The intended readership is all Python developers.
|
||||
#
|
||||
# This document is not confidential.
|
||||
#
|
||||
# See [GDR 2001-12-04a] for the command-line interface, programmatic
|
||||
# interface and limitations. See [GDR 2001-12-04b] for requirements and
|
||||
# design.
|
||||
|
||||
"""Usage:
|
||||
|
||||
coverage.py -x MODULE.py [ARG1 ARG2 ...]
|
||||
Execute module, passing the given command-line arguments, collecting
|
||||
coverage data.
|
||||
|
||||
coverage.py -e
|
||||
Erase collected coverage data.
|
||||
|
||||
coverage.py -r [-m] FILE1 FILE2 ...
|
||||
Report on the statement coverage for the given files. With the -m
|
||||
option, show line numbers of the statements that weren't executed.
|
||||
|
||||
coverage.py -a [-d dir] FILE1 FILE2 ...
|
||||
Make annotated copies of the given files, marking statements that
|
||||
are executed with > and statements that are missed with !. With
|
||||
the -d option, make the copies in that directory. Without the -d
|
||||
option, make each copy in the same directory as the original.
|
||||
|
||||
Coverage data is saved in the file .coverage by default. Set the
|
||||
COVERAGE_FILE environment variable to save it somewhere else."""
|
||||
|
||||
__version__ = "2.2.20041231" # see detailed history at the end of this file.
|
||||
|
||||
import compiler
|
||||
import compiler.visitor
|
||||
import os
|
||||
import re
|
||||
import string
|
||||
import sys
|
||||
import types
|
||||
|
||||
|
||||
# 2. IMPLEMENTATION
|
||||
#
|
||||
# This uses the "singleton" pattern.
|
||||
#
|
||||
# The word "morf" means a module object (from which the source file can
|
||||
# be deduced by suitable manipulation of the __file__ attribute) or a
|
||||
# filename.
|
||||
#
|
||||
# When we generate a coverage report we have to canonicalize every
|
||||
# filename in the coverage dictionary just in case it refers to the
|
||||
# module we are reporting on. It seems a shame to throw away this
|
||||
# information so the data in the coverage dictionary is transferred to
|
||||
# the 'cexecuted' dictionary under the canonical filenames.
|
||||
#
|
||||
# The coverage dictionary is called "c" and the trace function "t". The
|
||||
# reason for these short names is that Python looks up variables by name
|
||||
# at runtime and so execution time depends on the length of variables!
|
||||
# In the bottleneck of this application it's appropriate to abbreviate
|
||||
# names to increase speed.
|
||||
|
||||
# A dictionary with an entry for (Python source file name, line number
|
||||
# in that file) if that line has been executed.
|
||||
c = {}
|
||||
|
||||
# t(f, x, y). This method is passed to sys.settrace as a trace
|
||||
# function. See [van Rossum 2001-07-20b, 9.2] for an explanation of
|
||||
# sys.settrace and the arguments and return value of the trace function.
|
||||
# See [van Rossum 2001-07-20a, 3.2] for a description of frame and code
|
||||
# objects.
|
||||
|
||||
def t(f, w, a):
|
||||
if w == 'line':
|
||||
c[(f.f_code.co_filename, f.f_lineno)] = 1
|
||||
return t
|
||||
|
||||
class StatementFindingAstVisitor(compiler.visitor.ASTVisitor):
|
||||
def __init__(self, statements, excluded, suite_spots):
|
||||
compiler.visitor.ASTVisitor.__init__(self)
|
||||
self.statements = statements
|
||||
self.excluded = excluded
|
||||
self.suite_spots = suite_spots
|
||||
self.excluding_suite = 0
|
||||
|
||||
def doRecursive(self, node):
|
||||
self.recordNodeLine(node)
|
||||
for n in node.getChildNodes():
|
||||
self.dispatch(n)
|
||||
|
||||
visitStmt = visitModule = doRecursive
|
||||
|
||||
def doCode(self, node):
|
||||
if hasattr(node, 'decorators') and node.decorators:
|
||||
self.dispatch(node.decorators)
|
||||
self.doSuite(node, node.code)
|
||||
|
||||
visitFunction = visitClass = doCode
|
||||
|
||||
def getFirstLine(self, node):
|
||||
# Find the first line in the tree node.
|
||||
lineno = node.lineno
|
||||
for n in node.getChildNodes():
|
||||
f = self.getFirstLine(n)
|
||||
if lineno and f:
|
||||
lineno = min(lineno, f)
|
||||
else:
|
||||
lineno = lineno or f
|
||||
return lineno
|
||||
|
||||
def getLastLine(self, node):
|
||||
# Find the first line in the tree node.
|
||||
lineno = node.lineno
|
||||
for n in node.getChildNodes():
|
||||
lineno = max(lineno, self.getLastLine(n))
|
||||
return lineno
|
||||
|
||||
def doStatement(self, node):
|
||||
self.recordLine(self.getFirstLine(node))
|
||||
|
||||
visitAssert = visitAssign = visitAssTuple = visitDiscard = visitPrint = \
|
||||
visitPrintnl = visitRaise = visitSubscript = \
|
||||
visitDecorators = \
|
||||
doStatement
|
||||
|
||||
def recordNodeLine(self, node):
|
||||
return self.recordLine(node.lineno)
|
||||
|
||||
def recordLine(self, lineno):
|
||||
# Returns a bool, whether the line is included or excluded.
|
||||
if lineno:
|
||||
# Multi-line tests introducing suites have to get charged to their
|
||||
# keyword.
|
||||
if lineno in self.suite_spots:
|
||||
lineno = self.suite_spots[lineno][0]
|
||||
# If we're inside an exluded suite, record that this line was
|
||||
# excluded.
|
||||
if self.excluding_suite:
|
||||
self.excluded[lineno] = 1
|
||||
return 0
|
||||
# If this line is excluded, or suite_spots maps this line to
|
||||
# another line that is exlcuded, then we're excluded.
|
||||
elif self.excluded.has_key(lineno) or \
|
||||
self.suite_spots.has_key(lineno) and \
|
||||
self.excluded.has_key(self.suite_spots[lineno][1]):
|
||||
return 0
|
||||
# Otherwise, this is an executable line.
|
||||
else:
|
||||
self.statements[lineno] = 1
|
||||
return 1
|
||||
return 0
|
||||
|
||||
default = recordNodeLine
|
||||
|
||||
def recordAndDispatch(self, node):
|
||||
self.recordNodeLine(node)
|
||||
self.dispatch(node)
|
||||
|
||||
def doSuite(self, intro, body, exclude=0):
|
||||
exsuite = self.excluding_suite
|
||||
if exclude or (intro and not self.recordNodeLine(intro)):
|
||||
self.excluding_suite = 1
|
||||
self.recordAndDispatch(body)
|
||||
self.excluding_suite = exsuite
|
||||
|
||||
def doPlainWordSuite(self, prevsuite, suite):
|
||||
# Finding the exclude lines for else's is tricky, because they aren't
|
||||
# present in the compiler parse tree. Look at the previous suite,
|
||||
# and find its last line. If any line between there and the else's
|
||||
# first line are excluded, then we exclude the else.
|
||||
lastprev = self.getLastLine(prevsuite)
|
||||
firstelse = self.getFirstLine(suite)
|
||||
for l in range(lastprev+1, firstelse):
|
||||
if self.suite_spots.has_key(l):
|
||||
self.doSuite(None, suite, exclude=self.excluded.has_key(l))
|
||||
break
|
||||
else:
|
||||
self.doSuite(None, suite)
|
||||
|
||||
def doElse(self, prevsuite, node):
|
||||
if node.else_:
|
||||
self.doPlainWordSuite(prevsuite, node.else_)
|
||||
|
||||
def visitFor(self, node):
|
||||
self.doSuite(node, node.body)
|
||||
self.doElse(node.body, node)
|
||||
|
||||
def visitIf(self, node):
|
||||
# The first test has to be handled separately from the rest.
|
||||
# The first test is credited to the line with the "if", but the others
|
||||
# are credited to the line with the test for the elif.
|
||||
self.doSuite(node, node.tests[0][1])
|
||||
for t, n in node.tests[1:]:
|
||||
self.doSuite(t, n)
|
||||
self.doElse(node.tests[-1][1], node)
|
||||
|
||||
def visitWhile(self, node):
|
||||
self.doSuite(node, node.body)
|
||||
self.doElse(node.body, node)
|
||||
|
||||
def visitTryExcept(self, node):
|
||||
self.doSuite(node, node.body)
|
||||
for i in range(len(node.handlers)):
|
||||
a, b, h = node.handlers[i]
|
||||
if not a:
|
||||
# It's a plain "except:". Find the previous suite.
|
||||
if i > 0:
|
||||
prev = node.handlers[i-1][2]
|
||||
else:
|
||||
prev = node.body
|
||||
self.doPlainWordSuite(prev, h)
|
||||
else:
|
||||
self.doSuite(a, h)
|
||||
self.doElse(node.handlers[-1][2], node)
|
||||
|
||||
def visitTryFinally(self, node):
|
||||
self.doSuite(node, node.body)
|
||||
self.doPlainWordSuite(node.body, node.final)
|
||||
|
||||
def visitGlobal(self, node):
|
||||
# "global" statements don't execute like others (they don't call the
|
||||
# trace function), so don't record their line numbers.
|
||||
pass
|
||||
|
||||
the_coverage = None
|
||||
|
||||
class coverage:
|
||||
error = "coverage error"
|
||||
|
||||
# Name of the cache file (unless environment variable is set).
|
||||
cache_default = ".coverage"
|
||||
|
||||
# Environment variable naming the cache file.
|
||||
cache_env = "COVERAGE_FILE"
|
||||
|
||||
# A map from canonical Python source file name to a dictionary in
|
||||
# which there's an entry for each line number that has been
|
||||
# executed.
|
||||
cexecuted = {}
|
||||
|
||||
# Cache of results of calling the analysis2() method, so that you can
|
||||
# specify both -r and -a without doing double work.
|
||||
analysis_cache = {}
|
||||
|
||||
# Cache of results of calling the canonical_filename() method, to
|
||||
# avoid duplicating work.
|
||||
canonical_filename_cache = {}
|
||||
|
||||
def __init__(self):
|
||||
global the_coverage
|
||||
if the_coverage:
|
||||
raise self.error, "Only one coverage object allowed."
|
||||
self.usecache = 1
|
||||
self.cache = None
|
||||
self.exclude_re = ''
|
||||
|
||||
def help(self, error=None):
|
||||
if error:
|
||||
print error
|
||||
print
|
||||
print __doc__
|
||||
sys.exit(1)
|
||||
|
||||
def command_line(self):
|
||||
import getopt
|
||||
settings = {}
|
||||
optmap = {
|
||||
'-a': 'annotate',
|
||||
'-d:': 'directory=',
|
||||
'-e': 'erase',
|
||||
'-h': 'help',
|
||||
'-i': 'ignore-errors',
|
||||
'-m': 'show-missing',
|
||||
'-r': 'report',
|
||||
'-x': 'execute',
|
||||
}
|
||||
short_opts = string.join(map(lambda o: o[1:], optmap.keys()), '')
|
||||
long_opts = optmap.values()
|
||||
options, args = getopt.getopt(sys.argv[1:], short_opts,
|
||||
long_opts)
|
||||
for o, a in options:
|
||||
if optmap.has_key(o):
|
||||
settings[optmap[o]] = 1
|
||||
elif optmap.has_key(o + ':'):
|
||||
settings[optmap[o + ':']] = a
|
||||
elif o[2:] in long_opts:
|
||||
settings[o[2:]] = 1
|
||||
elif o[2:] + '=' in long_opts:
|
||||
settings[o[2:]] = a
|
||||
else:
|
||||
self.help("Unknown option: '%s'." % o)
|
||||
if settings.get('help'):
|
||||
self.help()
|
||||
for i in ['erase', 'execute']:
|
||||
for j in ['annotate', 'report']:
|
||||
if settings.get(i) and settings.get(j):
|
||||
self.help("You can't specify the '%s' and '%s' "
|
||||
"options at the same time." % (i, j))
|
||||
args_needed = (settings.get('execute')
|
||||
or settings.get('annotate')
|
||||
or settings.get('report'))
|
||||
action = settings.get('erase') or args_needed
|
||||
if not action:
|
||||
self.help("You must specify at least one of -e, -x, -r, or -a.")
|
||||
if not args_needed and args:
|
||||
self.help("Unexpected arguments %s." % args)
|
||||
|
||||
self.get_ready()
|
||||
self.exclude('#pragma[: ]+[nN][oO] [cC][oO][vV][eE][rR]')
|
||||
|
||||
if settings.get('erase'):
|
||||
self.erase()
|
||||
if settings.get('execute'):
|
||||
if not args:
|
||||
self.help("Nothing to do.")
|
||||
sys.argv = args
|
||||
self.start()
|
||||
import __main__
|
||||
sys.path[0] = os.path.dirname(sys.argv[0])
|
||||
execfile(sys.argv[0], __main__.__dict__)
|
||||
if not args:
|
||||
args = self.cexecuted.keys()
|
||||
ignore_errors = settings.get('ignore-errors')
|
||||
show_missing = settings.get('show-missing')
|
||||
directory = settings.get('directory=')
|
||||
if settings.get('report'):
|
||||
self.report(args, show_missing, ignore_errors)
|
||||
if settings.get('annotate'):
|
||||
self.annotate(args, directory, ignore_errors)
|
||||
|
||||
def use_cache(self, usecache):
|
||||
self.usecache = usecache
|
||||
|
||||
def get_ready(self):
|
||||
if self.usecache and not self.cache:
|
||||
self.cache = os.environ.get(self.cache_env, self.cache_default)
|
||||
self.restore()
|
||||
self.analysis_cache = {}
|
||||
|
||||
def start(self):
|
||||
self.get_ready()
|
||||
sys.settrace(t)
|
||||
|
||||
def stop(self):
|
||||
sys.settrace(None)
|
||||
|
||||
def erase(self):
|
||||
global c
|
||||
c = {}
|
||||
self.analysis_cache = {}
|
||||
self.cexecuted = {}
|
||||
if self.cache and os.path.exists(self.cache):
|
||||
os.remove(self.cache)
|
||||
self.exclude_re = ''
|
||||
|
||||
def exclude(self, re):
|
||||
if self.exclude_re:
|
||||
self.exclude_re += "|"
|
||||
self.exclude_re += "(" + re + ")"
|
||||
|
||||
# save(). Save coverage data to the coverage cache.
|
||||
|
||||
def save(self):
|
||||
if self.usecache and self.cache:
|
||||
self.canonicalize_filenames()
|
||||
cache = open(self.cache, 'wb')
|
||||
import marshal
|
||||
marshal.dump(self.cexecuted, cache)
|
||||
cache.close()
|
||||
|
||||
# restore(). Restore coverage data from the coverage cache (if it
|
||||
# exists).
|
||||
|
||||
def restore(self):
|
||||
global c
|
||||
c = {}
|
||||
self.cexecuted = {}
|
||||
assert self.usecache
|
||||
if not os.path.exists(self.cache):
|
||||
return
|
||||
try:
|
||||
cache = open(self.cache, 'rb')
|
||||
import marshal
|
||||
cexecuted = marshal.load(cache)
|
||||
cache.close()
|
||||
if isinstance(cexecuted, types.DictType):
|
||||
self.cexecuted = cexecuted
|
||||
except:
|
||||
pass
|
||||
|
||||
# canonical_filename(filename). Return a canonical filename for the
|
||||
# file (that is, an absolute path with no redundant components and
|
||||
# normalized case). See [GDR 2001-12-04b, 3.3].
|
||||
|
||||
def canonical_filename(self, filename):
|
||||
if not self.canonical_filename_cache.has_key(filename):
|
||||
f = filename
|
||||
if os.path.isabs(f) and not os.path.exists(f):
|
||||
f = os.path.basename(f)
|
||||
if not os.path.isabs(f):
|
||||
for path in [os.curdir] + sys.path:
|
||||
g = os.path.join(path, f)
|
||||
if os.path.exists(g):
|
||||
f = g
|
||||
break
|
||||
cf = os.path.normcase(os.path.abspath(f))
|
||||
self.canonical_filename_cache[filename] = cf
|
||||
return self.canonical_filename_cache[filename]
|
||||
|
||||
# canonicalize_filenames(). Copy results from "executed" to
|
||||
# "cexecuted", canonicalizing filenames on the way. Clear the
|
||||
# "executed" map.
|
||||
|
||||
def canonicalize_filenames(self):
|
||||
global c
|
||||
for filename, lineno in c.keys():
|
||||
f = self.canonical_filename(filename)
|
||||
if not self.cexecuted.has_key(f):
|
||||
self.cexecuted[f] = {}
|
||||
self.cexecuted[f][lineno] = 1
|
||||
c = {}
|
||||
|
||||
# morf_filename(morf). Return the filename for a module or file.
|
||||
|
||||
def morf_filename(self, morf):
|
||||
if isinstance(morf, types.ModuleType):
|
||||
if not hasattr(morf, '__file__'):
|
||||
raise self.error, "Module has no __file__ attribute."
|
||||
file = morf.__file__
|
||||
else:
|
||||
file = morf
|
||||
return self.canonical_filename(file)
|
||||
|
||||
# analyze_morf(morf). Analyze the module or filename passed as
|
||||
# the argument. If the source code can't be found, raise an error.
|
||||
# Otherwise, return a tuple of (1) the canonical filename of the
|
||||
# source code for the module, (2) a list of lines of statements
|
||||
# in the source code, and (3) a list of lines of excluded statements.
|
||||
|
||||
def analyze_morf(self, morf):
|
||||
if self.analysis_cache.has_key(morf):
|
||||
return self.analysis_cache[morf]
|
||||
filename = self.morf_filename(morf)
|
||||
ext = os.path.splitext(filename)[1]
|
||||
if ext == '.pyc':
|
||||
if not os.path.exists(filename[0:-1]):
|
||||
raise self.error, ("No source for compiled code '%s'."
|
||||
% filename)
|
||||
filename = filename[0:-1]
|
||||
elif ext != '.py':
|
||||
raise self.error, "File '%s' not Python source." % filename
|
||||
source = open(filename, 'r')
|
||||
lines, excluded_lines = self.find_executable_statements(
|
||||
source.read(), exclude=self.exclude_re
|
||||
)
|
||||
source.close()
|
||||
result = filename, lines, excluded_lines
|
||||
self.analysis_cache[morf] = result
|
||||
return result
|
||||
|
||||
def get_suite_spots(self, tree, spots):
|
||||
import symbol, token
|
||||
for i in range(1, len(tree)):
|
||||
if type(tree[i]) == type(()):
|
||||
if tree[i][0] == symbol.suite:
|
||||
# Found a suite, look back for the colon and keyword.
|
||||
lineno_colon = lineno_word = None
|
||||
for j in range(i-1, 0, -1):
|
||||
if tree[j][0] == token.COLON:
|
||||
lineno_colon = tree[j][2]
|
||||
elif tree[j][0] == token.NAME:
|
||||
if tree[j][1] == 'elif':
|
||||
# Find the line number of the first non-terminal
|
||||
# after the keyword.
|
||||
t = tree[j+1]
|
||||
while t and token.ISNONTERMINAL(t[0]):
|
||||
t = t[1]
|
||||
if t:
|
||||
lineno_word = t[2]
|
||||
else:
|
||||
lineno_word = tree[j][2]
|
||||
break
|
||||
elif tree[j][0] == symbol.except_clause:
|
||||
# "except" clauses look like:
|
||||
# ('except_clause', ('NAME', 'except', lineno), ...)
|
||||
if tree[j][1][0] == token.NAME:
|
||||
lineno_word = tree[j][1][2]
|
||||
break
|
||||
if lineno_colon and lineno_word:
|
||||
# Found colon and keyword, mark all the lines
|
||||
# between the two with the two line numbers.
|
||||
for l in range(lineno_word, lineno_colon+1):
|
||||
spots[l] = (lineno_word, lineno_colon)
|
||||
self.get_suite_spots(tree[i], spots)
|
||||
|
||||
def find_executable_statements(self, text, exclude=None):
|
||||
# Find lines which match an exclusion pattern.
|
||||
excluded = {}
|
||||
suite_spots = {}
|
||||
if exclude:
|
||||
reExclude = re.compile(exclude)
|
||||
lines = text.split('\n')
|
||||
for i in range(len(lines)):
|
||||
if reExclude.search(lines[i]):
|
||||
excluded[i+1] = 1
|
||||
|
||||
import parser
|
||||
tree = parser.suite(text+'\n\n').totuple(1)
|
||||
self.get_suite_spots(tree, suite_spots)
|
||||
|
||||
# Use the compiler module to parse the text and find the executable
|
||||
# statements. We add newlines to be impervious to final partial lines.
|
||||
statements = {}
|
||||
ast = compiler.parse(text+'\n\n')
|
||||
visitor = StatementFindingAstVisitor(statements, excluded, suite_spots)
|
||||
compiler.walk(ast, visitor, walker=visitor)
|
||||
|
||||
lines = statements.keys()
|
||||
lines.sort()
|
||||
excluded_lines = excluded.keys()
|
||||
excluded_lines.sort()
|
||||
return lines, excluded_lines
|
||||
|
||||
# format_lines(statements, lines). Format a list of line numbers
|
||||
# for printing by coalescing groups of lines as long as the lines
|
||||
# represent consecutive statements. This will coalesce even if
|
||||
# there are gaps between statements, so if statements =
|
||||
# [1,2,3,4,5,10,11,12,13,14] and lines = [1,2,5,10,11,13,14] then
|
||||
# format_lines will return "1-2, 5-11, 13-14".
|
||||
|
||||
def format_lines(self, statements, lines):
|
||||
pairs = []
|
||||
i = 0
|
||||
j = 0
|
||||
start = None
|
||||
pairs = []
|
||||
while i < len(statements) and j < len(lines):
|
||||
if statements[i] == lines[j]:
|
||||
if start == None:
|
||||
start = lines[j]
|
||||
end = lines[j]
|
||||
j = j + 1
|
||||
elif start:
|
||||
pairs.append((start, end))
|
||||
start = None
|
||||
i = i + 1
|
||||
if start:
|
||||
pairs.append((start, end))
|
||||
def stringify(pair):
|
||||
start, end = pair
|
||||
if start == end:
|
||||
return "%d" % start
|
||||
else:
|
||||
return "%d-%d" % (start, end)
|
||||
import string
|
||||
return string.join(map(stringify, pairs), ", ")
|
||||
|
||||
# Backward compatibility with version 1.
|
||||
def analysis(self, morf):
|
||||
f, s, _, m, mf = self.analysis2(morf)
|
||||
return f, s, m, mf
|
||||
|
||||
def analysis2(self, morf):
|
||||
filename, statements, excluded = self.analyze_morf(morf)
|
||||
self.canonicalize_filenames()
|
||||
if not self.cexecuted.has_key(filename):
|
||||
self.cexecuted[filename] = {}
|
||||
missing = []
|
||||
for line in statements:
|
||||
if not self.cexecuted[filename].has_key(line):
|
||||
missing.append(line)
|
||||
return (filename, statements, excluded, missing,
|
||||
self.format_lines(statements, missing))
|
||||
|
||||
def morf_name(self, morf):
|
||||
if isinstance(morf, types.ModuleType):
|
||||
return morf.__name__
|
||||
else:
|
||||
return os.path.splitext(os.path.basename(morf))[0]
|
||||
|
||||
def report(self, morfs, show_missing=1, ignore_errors=0):
|
||||
if not isinstance(morfs, types.ListType):
|
||||
morfs = [morfs]
|
||||
max_name = max([5,] + map(len, map(self.morf_name, morfs)))
|
||||
fmt_name = "%%- %ds " % max_name
|
||||
fmt_err = fmt_name + "%s: %s"
|
||||
header = fmt_name % "Name" + " Stmts Exec Cover"
|
||||
fmt_coverage = fmt_name + "% 6d % 6d % 5d%%"
|
||||
if show_missing:
|
||||
header = header + " Missing"
|
||||
fmt_coverage = fmt_coverage + " %s"
|
||||
print header
|
||||
print "-" * len(header)
|
||||
total_statements = 0
|
||||
total_executed = 0
|
||||
for morf in morfs:
|
||||
name = self.morf_name(morf)
|
||||
try:
|
||||
_, statements, _, missing, readable = self.analysis2(morf)
|
||||
n = len(statements)
|
||||
m = n - len(missing)
|
||||
if n > 0:
|
||||
pc = 100.0 * m / n
|
||||
else:
|
||||
pc = 100.0
|
||||
args = (name, n, m, pc)
|
||||
if show_missing:
|
||||
args = args + (readable,)
|
||||
print fmt_coverage % args
|
||||
total_statements = total_statements + n
|
||||
total_executed = total_executed + m
|
||||
except KeyboardInterrupt:
|
||||
raise
|
||||
except:
|
||||
if not ignore_errors:
|
||||
type, msg = sys.exc_info()[0:2]
|
||||
print fmt_err % (name, type, msg)
|
||||
if len(morfs) > 1:
|
||||
print "-" * len(header)
|
||||
if total_statements > 0:
|
||||
pc = 100.0 * total_executed / total_statements
|
||||
else:
|
||||
pc = 100.0
|
||||
args = ("TOTAL", total_statements, total_executed, pc)
|
||||
if show_missing:
|
||||
args = args + ("",)
|
||||
print fmt_coverage % args
|
||||
|
||||
# annotate(morfs, ignore_errors).
|
||||
|
||||
blank_re = re.compile("\\s*(#|$)")
|
||||
else_re = re.compile("\\s*else\\s*:\\s*(#|$)")
|
||||
|
||||
def annotate(self, morfs, directory=None, ignore_errors=0):
|
||||
for morf in morfs:
|
||||
try:
|
||||
filename, statements, excluded, missing, _ = self.analysis2(morf)
|
||||
self.annotate_file(filename, statements, excluded, missing, directory)
|
||||
except KeyboardInterrupt:
|
||||
raise
|
||||
except:
|
||||
if not ignore_errors:
|
||||
raise
|
||||
|
||||
def annotate_file(self, filename, statements, excluded, missing, directory=None):
|
||||
source = open(filename, 'r')
|
||||
if directory:
|
||||
dest_file = os.path.join(directory,
|
||||
os.path.basename(filename)
|
||||
+ ',cover')
|
||||
else:
|
||||
dest_file = filename + ',cover'
|
||||
dest = open(dest_file, 'w')
|
||||
lineno = 0
|
||||
i = 0
|
||||
j = 0
|
||||
covered = 1
|
||||
while 1:
|
||||
line = source.readline()
|
||||
if line == '':
|
||||
break
|
||||
lineno = lineno + 1
|
||||
while i < len(statements) and statements[i] < lineno:
|
||||
i = i + 1
|
||||
while j < len(missing) and missing[j] < lineno:
|
||||
j = j + 1
|
||||
if i < len(statements) and statements[i] == lineno:
|
||||
covered = j >= len(missing) or missing[j] > lineno
|
||||
if self.blank_re.match(line):
|
||||
dest.write(' ')
|
||||
elif self.else_re.match(line):
|
||||
# Special logic for lines containing only
|
||||
# 'else:'. See [GDR 2001-12-04b, 3.2].
|
||||
if i >= len(statements) and j >= len(missing):
|
||||
dest.write('! ')
|
||||
elif i >= len(statements) or j >= len(missing):
|
||||
dest.write('> ')
|
||||
elif statements[i] == missing[j]:
|
||||
dest.write('! ')
|
||||
else:
|
||||
dest.write('> ')
|
||||
elif lineno in excluded:
|
||||
dest.write('- ')
|
||||
elif covered:
|
||||
dest.write('> ')
|
||||
else:
|
||||
dest.write('! ')
|
||||
dest.write(line)
|
||||
source.close()
|
||||
dest.close()
|
||||
|
||||
# Singleton object.
|
||||
the_coverage = coverage()
|
||||
|
||||
# Module functions call methods in the singleton object.
|
||||
def use_cache(*args, **kw): return the_coverage.use_cache(*args, **kw)
|
||||
def start(*args, **kw): return the_coverage.start(*args, **kw)
|
||||
def stop(*args, **kw): return the_coverage.stop(*args, **kw)
|
||||
def erase(*args, **kw): return the_coverage.erase(*args, **kw)
|
||||
def exclude(*args, **kw): return the_coverage.exclude(*args, **kw)
|
||||
def analysis(*args, **kw): return the_coverage.analysis(*args, **kw)
|
||||
def analysis2(*args, **kw): return the_coverage.analysis2(*args, **kw)
|
||||
def report(*args, **kw): return the_coverage.report(*args, **kw)
|
||||
def annotate(*args, **kw): return the_coverage.annotate(*args, **kw)
|
||||
def annotate_file(*args, **kw): return the_coverage.annotate_file(*args, **kw)
|
||||
|
||||
# Save coverage data when Python exits. (The atexit module wasn't
|
||||
# introduced until Python 2.0, so use sys.exitfunc when it's not
|
||||
# available.)
|
||||
try:
|
||||
import atexit
|
||||
atexit.register(the_coverage.save)
|
||||
except ImportError:
|
||||
sys.exitfunc = the_coverage.save
|
||||
|
||||
# Command-line interface.
|
||||
if __name__ == '__main__':
|
||||
the_coverage.command_line()
|
||||
|
||||
|
||||
# A. REFERENCES
|
||||
#
|
||||
# [GDR 2001-12-04a] "Statement coverage for Python"; Gareth Rees;
|
||||
# Ravenbrook Limited; 2001-12-04;
|
||||
# <http://www.garethrees.org/2001/12/04/python-coverage/>.
|
||||
#
|
||||
# [GDR 2001-12-04b] "Statement coverage for Python: design and
|
||||
# analysis"; Gareth Rees; Ravenbrook Limited; 2001-12-04;
|
||||
# <http://www.garethrees.org/2001/12/04/python-coverage/design.html>.
|
||||
#
|
||||
# [van Rossum 2001-07-20a] "Python Reference Manual (releae 2.1.1)";
|
||||
# Guide van Rossum; 2001-07-20;
|
||||
# <http://www.python.org/doc/2.1.1/ref/ref.html>.
|
||||
#
|
||||
# [van Rossum 2001-07-20b] "Python Library Reference"; Guido van Rossum;
|
||||
# 2001-07-20; <http://www.python.org/doc/2.1.1/lib/lib.html>.
|
||||
#
|
||||
#
|
||||
# B. DOCUMENT HISTORY
|
||||
#
|
||||
# 2001-12-04 GDR Created.
|
||||
#
|
||||
# 2001-12-06 GDR Added command-line interface and source code
|
||||
# annotation.
|
||||
#
|
||||
# 2001-12-09 GDR Moved design and interface to separate documents.
|
||||
#
|
||||
# 2001-12-10 GDR Open cache file as binary on Windows. Allow
|
||||
# simultaneous -e and -x, or -a and -r.
|
||||
#
|
||||
# 2001-12-12 GDR Added command-line help. Cache analysis so that it
|
||||
# only needs to be done once when you specify -a and -r.
|
||||
#
|
||||
# 2001-12-13 GDR Improved speed while recording. Portable between
|
||||
# Python 1.5.2 and 2.1.1.
|
||||
#
|
||||
# 2002-01-03 GDR Module-level functions work correctly.
|
||||
#
|
||||
# 2002-01-07 GDR Update sys.path when running a file with the -x option,
|
||||
# so that it matches the value the program would get if it were run on
|
||||
# its own.
|
||||
#
|
||||
# 2004-12-12 NMB Significant code changes.
|
||||
# - Finding executable statements has been rewritten so that docstrings and
|
||||
# other quirks of Python execution aren't mistakenly identified as missing
|
||||
# lines.
|
||||
# - Lines can be excluded from consideration, even entire suites of lines.
|
||||
# - The filesystem cache of covered lines can be disabled programmatically.
|
||||
# - Modernized the code.
|
||||
#
|
||||
# 2004-12-14 NMB Minor tweaks. Return 'analysis' to its original behavior
|
||||
# and add 'analysis2'. Add a global for 'annotate', and factor it, adding
|
||||
# 'annotate_file'.
|
||||
#
|
||||
# 2004-12-31 NMB Allow for keyword arguments in the module global functions.
|
||||
#
|
||||
# C. COPYRIGHT AND LICENCE
|
||||
#
|
||||
# Copyright 2001 Gareth Rees. All rights reserved.
|
||||
# Copyright 2004 Ned Batchelder. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
# DAMAGE.
|
||||
#
|
||||
# $Id: coverage.py 5 2004-12-14 12:08:23Z ned $
|
||||
@@ -0,0 +1 @@
|
||||
../help.html
|
||||
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 85 KiB |
|
After Width: | Height: | Size: 505 B |
@@ -0,0 +1,106 @@
|
||||
# This file contains the code that demonstrates animation.
|
||||
|
||||
init:
|
||||
|
||||
# A simple animation. We interleave the displayables we want to
|
||||
# show with the times we want to show them for.
|
||||
image eileen animated = Animation(
|
||||
"eileen_vhappy.png", 1.0,
|
||||
"eileen_happy.png", 1.0)
|
||||
|
||||
image transanimation = anim.TransitionAnimation(
|
||||
im.Scale("whitehouse.jpg", 400, 300), 1.0, dissolve,
|
||||
im.Scale("washington.jpg", 400, 300), 1.0, dissolve)
|
||||
|
||||
# The blink animation.
|
||||
image blinking text = anim.Blink(Text("Blink", color="#ff0", size=72))
|
||||
|
||||
# A state machine-based animation.
|
||||
image smanim = anim.SMAnimation(
|
||||
|
||||
# The name of the starting state.
|
||||
"r",
|
||||
|
||||
# The states we use, and the displayables we show during those
|
||||
# states.
|
||||
anim.State("r", "#f00"),
|
||||
anim.State("g", "#0f0"),
|
||||
anim.State("b", "#00f"),
|
||||
|
||||
# The edges, given as a state, a time we remain in that state for,
|
||||
# the new state, and the time it takes to transition between the
|
||||
# two of them.
|
||||
#
|
||||
# dissolve only works with solid images. move is also useful here.
|
||||
anim.Edge("r", .5, "g", dissolve),
|
||||
anim.Edge("r", .5, "b", dissolve),
|
||||
|
||||
anim.Edge("g", .5, "r", dissolve),
|
||||
anim.Edge("g", .5, "b", dissolve),
|
||||
|
||||
anim.Edge("b", .5, "r", dissolve),
|
||||
anim.Edge("b", .5, "g", dissolve),
|
||||
)
|
||||
|
||||
label demo_animation:
|
||||
|
||||
|
||||
|
||||
e "Ren'Py supports a number of ways of creating animations."
|
||||
|
||||
e "These animations let you vary images, independent of the user's clicks."
|
||||
|
||||
show eileen animated
|
||||
|
||||
e "For example, I'm switching my expression back and forth, once a second."
|
||||
|
||||
e "Even though you clicked, I'm still doing it."
|
||||
|
||||
e "This is an example of the Animation function at work."
|
||||
|
||||
show eileen happy
|
||||
|
||||
e "The Animation function is limited to simple lists of images, with fixed delays between them."
|
||||
|
||||
e "The sequence can repeat, or can stop after one go-through."
|
||||
|
||||
show eileen happy at right
|
||||
show transanimation at Position(xpos=50, ypos=50, xanchor=0, yanchor=0)
|
||||
with moveinleft
|
||||
|
||||
e "The anim.TransitionAnimation function is similar, but it lets you specify a transition between frames."
|
||||
|
||||
show eileen happy
|
||||
hide transanimation
|
||||
with moveoutleft
|
||||
|
||||
e "If you want more control, you can use the anim.SMAnimation function."
|
||||
|
||||
e "It can randomly change images, and even apply transitions to changes."
|
||||
|
||||
scene smanim
|
||||
show eileen happy
|
||||
with dissolve
|
||||
|
||||
e "Here, we are randomly dissolving the background between red, green, and blue images."
|
||||
|
||||
e "Psychadelic."
|
||||
|
||||
scene bg washington
|
||||
show eileen happy
|
||||
with dissolve
|
||||
|
||||
e "It's probably best if we stop here, before somebody's brain explodes."
|
||||
|
||||
show blinking text at Position(xalign=.5, yalign=.7)
|
||||
|
||||
e "Finally, there's anim.Blink, which can be used to blink things in and out."
|
||||
|
||||
e "I don't know why you'd want to do that to a character, but blinking text seems reasonable for signs and things like that."
|
||||
|
||||
hide blinking text
|
||||
with dissolve
|
||||
|
||||
return
|
||||
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
# This file contains some of the basics of Ren'Py. This is stuff you'll use in
|
||||
# just about every game.
|
||||
|
||||
# First, we have an init block that contains many of the definitions we
|
||||
# use in the game
|
||||
init:
|
||||
|
||||
# Here we define the backgrounds that are used by the demo.
|
||||
image bg washington = "washington.jpg"
|
||||
image bg whitehouse = "whitehouse.jpg"
|
||||
|
||||
# And this is the character art we use in the demo.
|
||||
image eileen happy = "eileen_happy.png"
|
||||
image eileen vhappy = "eileen_vhappy.png"
|
||||
image eileen concerned = "eileen_concerned.png"
|
||||
|
||||
# Now, we declare the characters.
|
||||
$ e = Character('Eileen', color="#c8ffc8")
|
||||
|
||||
|
||||
# In a real game, we would have:
|
||||
#
|
||||
# label start:
|
||||
#
|
||||
# here. But since we are inside the demo game, we have to use a different
|
||||
# label.
|
||||
|
||||
label demo_basics:
|
||||
|
||||
e "This is our demonstration of the basics of using Ren'Py. You may want to click the button at the upper-right of the screen, to follow along."
|
||||
|
||||
"Somehow, I realize that Ren'Py supports narration."
|
||||
|
||||
e "Ren'Py supports dialogue, as long as you declare a character first. If it didn't I wouldn't be able to talk to you."
|
||||
|
||||
e "Ren'Py also supports menus, which let you make decisions based on user input."
|
||||
|
||||
|
||||
menu:
|
||||
|
||||
e "Do you think you'd ever use menus in a game?"
|
||||
|
||||
"Yes.":
|
||||
|
||||
jump about_menus_yes
|
||||
|
||||
"No.":
|
||||
|
||||
jump about_menus_no
|
||||
|
||||
"I'm not ready to make that decision yet.":
|
||||
|
||||
jump about_menus_unsure
|
||||
|
||||
label about_menus_yes:
|
||||
|
||||
$ about_menus_choice = "yes"
|
||||
|
||||
e "Menus are the most important way of providing interactivity to a game."
|
||||
|
||||
jump about_menus_done
|
||||
|
||||
label about_menus_no:
|
||||
|
||||
$ about_menus_choice = "no"
|
||||
|
||||
e "That's okay, Ren'Py has been used to make a number of linear games, which we call kinetic novels."
|
||||
|
||||
jump about_menus_done
|
||||
|
||||
label about_menus_unsure:
|
||||
|
||||
$ about_menus_choice = "unsure"
|
||||
|
||||
e "Well, it doesn't really matter. Whatever you decide, Ren'Py is ready for you."
|
||||
|
||||
jump about_menus_done
|
||||
|
||||
|
||||
label about_menus_done:
|
||||
|
||||
e "Ren'Py wouldn't be much of a visual novel engine if it didn't support images."
|
||||
|
||||
scene bg whitehouse
|
||||
with dissolve
|
||||
|
||||
e "The scene statement clears the screen, and optionally lets you place a single new image on the screen."
|
||||
|
||||
show eileen happy
|
||||
with dissolve
|
||||
|
||||
e "The show statement shows images to the user."
|
||||
|
||||
show eileen vhappy
|
||||
with dissolve
|
||||
|
||||
e "Showing an image with the same tag, the same first part of the name, as an already-show image replaces that image."
|
||||
|
||||
show eileen happy at right
|
||||
with dissolve
|
||||
|
||||
e "Images can be shown at different locations on the screen, and you can show as many images on the screen as you want."
|
||||
|
||||
hide eileen happy
|
||||
with dissolve
|
||||
|
||||
e "The hide statement hides images, although with scene statement clearing the screen and the show statement replacing images, it's rarely necessary to do so."
|
||||
|
||||
scene bg washington
|
||||
show eileen happy
|
||||
with dissolve
|
||||
|
||||
e "Finally, the with statement is what we use to perform a transition from one screen to the next."
|
||||
|
||||
e "That's all you need to make a simple game, like a kinetic novel."
|
||||
|
||||
e "But I would be remiss if I didn't mention that Ren'Py can store data, and make decisions based on it."
|
||||
|
||||
if about_menus_choice == "yes":
|
||||
|
||||
e "For example, I remember you wanted to use menus in your game."
|
||||
|
||||
elif about_menus_choice == "no":
|
||||
|
||||
e "For example, I remember you didn't want to use menus."
|
||||
|
||||
else:
|
||||
|
||||
e "For example, I remember you weren't sure about menus."
|
||||
|
||||
e "Ren'Py embeds the Python programming language, which lets you do some very sophisticated things."
|
||||
|
||||
e "But you don't need learn Python if you don't want to."
|
||||
|
||||
return
|
||||
@@ -0,0 +1,99 @@
|
||||
# This file demonstrates how Character objects can be used to customize the
|
||||
# display of text.
|
||||
|
||||
init:
|
||||
# With a nestled click-to-continue indicator.
|
||||
$ ectc = Character('Eileen',
|
||||
color="#c8ffc8",
|
||||
ctc=anim.Blink("arrow.png"))
|
||||
|
||||
|
||||
# With a fixed-position ctc indicator.
|
||||
$ ectcf = Character('Eileen',
|
||||
color="#c8ffc8",
|
||||
ctc=anim.Filmstrip("sakura.png", (20, 20), (2, 1), .30, xpos=760, ypos=560, xanchor=0, yanchor=0),
|
||||
ctc_position="fixed")
|
||||
|
||||
# With quotes around text.
|
||||
$ equote = Character('Eileen',
|
||||
color="#c8ffc8",
|
||||
who_suffix = ':',
|
||||
what_prefix='"',
|
||||
what_suffix='"')
|
||||
|
||||
# Weird-looking.
|
||||
$ eweird = Character('Eileen',
|
||||
color="#c8ffc8",
|
||||
what_underline=True,
|
||||
window_left_margin=200,
|
||||
window_yminimum=300)
|
||||
|
||||
# Two-window mode.
|
||||
$ etwo = Character('Eileen',
|
||||
color="#c8ffc8",
|
||||
show_two_window=True)
|
||||
|
||||
# Image on the side.
|
||||
$ eside = Character('Eileen',
|
||||
color="#c8ffc8",
|
||||
window_left_padding=160,
|
||||
show_side_image=Image("eileen_side.png", xalign=0.0, yalign=1.0))
|
||||
|
||||
label demo_character:
|
||||
|
||||
|
||||
e "The Character object is used to declare characters, and it can also be used to customize the way in which a character speaks."
|
||||
|
||||
e "By supplying it with the appropriate arguments, we can really change around the feel of the game."
|
||||
|
||||
e "In this section, we'll demonstrate some of what can be accomplished by customizing character objects."
|
||||
|
||||
equote "By supplying what_prefix and what_suffix arguments to a Character object, we can automatically add things before each line of text."
|
||||
|
||||
equote "This is a lot easier than having to put those quotes in by hand."
|
||||
|
||||
equote "We can also use who_prefix and who_suffix to add text to the name of the speaker."
|
||||
|
||||
e "We can also supply arguments to the Character object that customize the look of the character name, the text that is being said, and the window itself."
|
||||
|
||||
eweird "These can really change the look of the game."
|
||||
|
||||
eside "A more practical use of that is in conjunction with show_side_image, which lets us position an image next to the text."
|
||||
|
||||
etwo "There's also show_two_window, which puts the character's name in its own window."
|
||||
|
||||
ectc "Finally, we demonstrate a click to continue indicator. In this example, it's nestled in with the text."
|
||||
|
||||
ectcf "A click to continue image can also be placed at a fixed location on the screen."
|
||||
|
||||
e "There's a lot more you can do with Character, as it lets you set style properties on all of the displayed text."
|
||||
|
||||
e "Finally, let me point out a couple of special characters we pre-define."
|
||||
|
||||
show black
|
||||
with dissolve
|
||||
|
||||
centered "The \"centered\" character shows text at the center of the screen, without a window."
|
||||
|
||||
centered "It's just a highly customized normal character, that's useful for dates and titles."
|
||||
|
||||
hide black
|
||||
with dissolve
|
||||
|
||||
e "The \"extend\" character is very special."
|
||||
|
||||
e "It lets you"
|
||||
|
||||
show eileen vhappy
|
||||
|
||||
extend " extend the previous dialogue"
|
||||
|
||||
show eileen happy
|
||||
|
||||
extend " with additional text."
|
||||
|
||||
e "That lets you have things happen in the middle of text. If you didn't notice, I was changing my expression."
|
||||
|
||||
e "Hopefully, these characters, along with the ones you define, will lead to a very expressive game."
|
||||
|
||||
return
|
||||
@@ -0,0 +1,40 @@
|
||||
# This file demonstrates how to use DynamicDisplayable to make parts of the
|
||||
# display that update without there being an interaction.
|
||||
|
||||
init:
|
||||
python:
|
||||
|
||||
# This function will run a countdown of the given length. It will
|
||||
# be white until 5 seconds are left, and then red until 0 seconds are
|
||||
# left, and then will blink 0.0 when time is up.
|
||||
def countdown(st, at, length=0.0):
|
||||
|
||||
remaining = length - st
|
||||
|
||||
if remaining > 5.0:
|
||||
return Text("%.1f" % remaining, color="#fff", size=72), .1
|
||||
elif remaining > 0.0:
|
||||
return Text("%.1f" % remaining, color="#f00", size=72), .1
|
||||
else:
|
||||
return anim.Blink(Text("0.0", color="#f00", size=72)), None
|
||||
|
||||
# Show a countdown for 10 seconds.
|
||||
image countdown = DynamicDisplayable(countdown, length=10.0)
|
||||
|
||||
|
||||
label demo_dynamic:
|
||||
|
||||
e "The DynamicDisplayable function lets you change what's displayed over the course of an interaction."
|
||||
|
||||
show countdown at Position(xalign=.1, yalign=.1)
|
||||
|
||||
e "This makes it possible to display things like countdown timers and progress bars."
|
||||
|
||||
e "Remember, people read at different speeds, so it's probably better to use this for flavor, rather then to make games time-sensitive."
|
||||
|
||||
hide countdown
|
||||
with dissolve
|
||||
|
||||
return
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# This file demonstrates the Ren'Py User Experience... the features you get
|
||||
# for free by choosing to use Ren'Py as a visual novel engine.
|
||||
|
||||
init:
|
||||
image popup prefs = "prefs.png"
|
||||
image popup save = "save.png"
|
||||
|
||||
label demo_experience:
|
||||
|
||||
e "One of the goals of Ren'Py is to provide visual novel players with a good user experience."
|
||||
|
||||
e "To ensure this, there are a number of features that are included as part of every Ren'Py game. Here, we'll show off some of these features."
|
||||
|
||||
e "Skipping can be turned on from the game menu, or when the user presses the Tab key. It is also enabled while the user holds down either Ctrl key."
|
||||
|
||||
e "By default it only skips read text, so if it's your first time reading this, it won't do anything. That can be changed from the game menu."
|
||||
|
||||
e "On the second and later times reading a screen of text, it will skip right through it."
|
||||
|
||||
e "Rollback is a feature that lets you go back in time to previous screens, letting you re-read text."
|
||||
|
||||
menu:
|
||||
|
||||
e "Would you like to hear more about rollback?"
|
||||
|
||||
"Yes.":
|
||||
|
||||
jump demo_rollback
|
||||
|
||||
"No.":
|
||||
|
||||
jump demo_rollback_done
|
||||
|
||||
|
||||
label demo_rollback:
|
||||
|
||||
e "You can invoke a rollback by scrolling the mouse wheel up, or by pushing the page up key. That'll bring you back to the previous screen."
|
||||
|
||||
e "While at a previous screen, you can roll forward by scrolling the mouse wheel down, or pushing the page down key."
|
||||
|
||||
e "Rolling forward through a menu will make the same choice you did last time. You can also make a different choice, if you change your mind."
|
||||
|
||||
e "You can try it by rolling back through the last menu, and saying 'No'."
|
||||
|
||||
e "Press page up, or scroll up the mouse wheel."
|
||||
|
||||
show eileen concerned
|
||||
|
||||
e "Well, are you going to try it?"
|
||||
|
||||
e "Your loss."
|
||||
|
||||
e "Moving on."
|
||||
|
||||
show eileen happy
|
||||
|
||||
label demo_rollback_done:
|
||||
|
||||
e "Now, let me show off the game menu. You can access the game menu by right clicking, or by hitting escape. You can get back by doing the same thing, or by clicking \"Return\"."
|
||||
|
||||
e "The game menu lets you do many things."
|
||||
|
||||
show popup save at Position(ypos=.1, yanchor=0, xpos=0, xanchor=1.0)
|
||||
with None
|
||||
|
||||
show popup save at Position(xpos=.1, ypos=.1, xanchor=0, yanchor=0)
|
||||
show eileen happy at right
|
||||
with move
|
||||
|
||||
e "The save screen lets you save a game, while the load screen lets you load the game back in."
|
||||
|
||||
e "Unlike many game engines, Ren'Py supports an unlimited number of save slots."
|
||||
|
||||
show popup prefs at Position(xpos=.1, ypos=.1, xanchor=0, yanchor=0)
|
||||
with dissolve
|
||||
|
||||
e "The preferences screen lets the end-user change some aspects of the behavior of Ren'Py."
|
||||
|
||||
e "The user can choose if the game runs in a window, or fullscreen."
|
||||
|
||||
e "By setting transitions to None, a user can eliminate transitions entirely."
|
||||
|
||||
e "A user can choose if the skipping feature skips all messages, or only seen messages, and if it stops when an in-game menu is selected."
|
||||
|
||||
e "When the text speed setting isn't the maximum, text will be drawn onto the screen one character at a time."
|
||||
|
||||
e "The auto-forward time setting controls how long we will wait before automatically advancing through text."
|
||||
|
||||
e "The auto-forward time is adjusted by the length of the text being shown."
|
||||
|
||||
e "Finally, we allow the user to choose the volume for music, voice, and sound effects."
|
||||
|
||||
e "From the game menu, the user can return to the game, begin skipping, return to the main menu, or quit entirely."
|
||||
|
||||
show popup save at Position(ypos=.1, yanchor=0, xpos=0, xanchor=1.0)
|
||||
show eileen happy at center
|
||||
with move
|
||||
|
||||
hide popup save
|
||||
|
||||
e "And that's part of how Ren'Py gives end-users the experience they expect."
|
||||
|
||||
return
|
||||
@@ -0,0 +1,204 @@
|
||||
# This file demonstrates the use of image operators.
|
||||
|
||||
init:
|
||||
image logo base = "logo.png"
|
||||
|
||||
image logo crop = im.Crop("logo.png", 0, 0, 100, 307)
|
||||
|
||||
image logo scale = im.Scale("logo.png", 100, 150)
|
||||
|
||||
image logo factorscale = im.FactorScale("logo.png", 1.5, 1.5)
|
||||
|
||||
image logo composite = im.Composite((200, 407),
|
||||
(0, 0), "logo.png",
|
||||
(0, 50), "logo.png",
|
||||
(0, 100), "logo.png")
|
||||
|
||||
image logo livecomposite = LiveComposite((200, 407),
|
||||
(0, 0), anim.Blink(Image("logo.png")),
|
||||
(0, 50), "logo.png",
|
||||
(0, 100), "logo.png")
|
||||
|
||||
image logo green = im.Map("logo.png", rmap=im.ramp(0, 0))
|
||||
|
||||
image logo green2 = im.Recolor("logo.png", 0, 255, 255, 255)
|
||||
|
||||
image logo alpha = im.Alpha("logo.png", 0.5)
|
||||
|
||||
image logo blackwhite = "logobw.png"
|
||||
|
||||
image logo twocolor = im.Twocolor("logobw.png",
|
||||
(128, 255, 255, 255),
|
||||
(255, 0, 0, 255))
|
||||
|
||||
|
||||
image eileen alpha = im.Alpha("eileen_happy.png", 0.5)
|
||||
|
||||
image eileen flip = im.Flip("eileen_happy.png", vertical=True)
|
||||
|
||||
|
||||
image logo halfsat = im.MatrixColor("logo.png",
|
||||
im.matrix.saturation(.5))
|
||||
|
||||
# This could be better done with im.matrix.invert(), but I want to show
|
||||
# how to use a matrix.
|
||||
image logo invert = im.MatrixColor("logo.png",
|
||||
[ -1, 0, 0, 0, 1,
|
||||
0, -1, 0, 0, 1,
|
||||
0, 0, -1, 0, 1,
|
||||
0, 0, 0, 1, 0, ])
|
||||
|
||||
image logo tintblue = im.MatrixColor("logo.png",
|
||||
im.matrix.saturation(.5) * im.matrix.tint(.75, .75, 1.0))
|
||||
|
||||
image logo hue = im.MatrixColor("logo.png",
|
||||
im.matrix.hue(90))
|
||||
|
||||
image logo bright = im.MatrixColor("logo.png",
|
||||
im.matrix.brightness(.5))
|
||||
|
||||
image logo sepia = im.Sepia("logo.png")
|
||||
|
||||
image logo grayscale = im.Grayscale("logo.png")
|
||||
|
||||
|
||||
$ logopos = Position(xpos=.5, xanchor=0, ypos=50, yanchor=0)
|
||||
|
||||
label demo_imageops:
|
||||
|
||||
e "Image operations allow us to manipulate images as they are loaded in."
|
||||
|
||||
e "They're efficient, as they are only evaluated when an image is first loaded."
|
||||
|
||||
e "This way, there's no extra work that needs to be done when each frame is drawn to the screen."
|
||||
|
||||
show eileen happy at left
|
||||
with move
|
||||
show logo base at logopos
|
||||
with dissolve
|
||||
|
||||
e "Let me show you a test image, the Ren'Py logo."
|
||||
|
||||
e "We'll be applying some image operations to it, to see how they can be used."
|
||||
|
||||
show logo crop at logopos
|
||||
with dissolve
|
||||
|
||||
e "The im.Crop operation can take the image, and chop it up into a smaller image."
|
||||
|
||||
show logo composite at logopos
|
||||
with dissolve
|
||||
|
||||
e "The im.Composite operation lets us take multiple images, and draw them into a single image."
|
||||
|
||||
e "While you can do this by showing multiple images, this is often more efficient."
|
||||
|
||||
show logo livecomposite at logopos
|
||||
with dissolve
|
||||
|
||||
e "There's also LiveComposite, which is less efficent, but allows for animation."
|
||||
|
||||
e "It isn't really an image operation, but we don't know where else to put it."
|
||||
|
||||
show logo scale at logopos
|
||||
with dissolve
|
||||
|
||||
e "The im.Scale operation lets us scale an image to a particular size."
|
||||
|
||||
show logo factorscale at logopos
|
||||
with dissolve
|
||||
|
||||
e "im.FactorScale lets us do the same thing, except to a factor of the original size."
|
||||
|
||||
show logo green at logopos
|
||||
with dissolve
|
||||
|
||||
e "The im.Map operation lets us mess with the red, green, blue, and alpha channels of an image."
|
||||
|
||||
e "In this case, we removed all the blue from the image, leaving only the red and green channels."
|
||||
|
||||
show logo base at logopos
|
||||
with dissolve
|
||||
show logo green2 at logopos
|
||||
with dissolve
|
||||
|
||||
e "The im.Recolor operation can do the same thing, but is more efficient when we're linearly mapping colors."
|
||||
|
||||
show logo blackwhite at logopos
|
||||
with dissolve
|
||||
|
||||
e "The im.Twocolor operation lets you take a black and white image, like this one..."
|
||||
|
||||
show logo twocolor at logopos
|
||||
with dissolve
|
||||
|
||||
e "... and assign colors to replace black and white."
|
||||
|
||||
show logo halfsat at logopos
|
||||
with dissolve
|
||||
|
||||
e "The im.MatrixColor operation lets you use a matrix to alter the colors. With the right matrix, you can desaturate colors..."
|
||||
|
||||
show logo tintblue at logopos
|
||||
with dissolve
|
||||
|
||||
e "... tint the image blue..."
|
||||
|
||||
show logo hue at logopos
|
||||
with dissolve
|
||||
|
||||
e "... rotate the hue... "
|
||||
|
||||
show logo invert at logopos
|
||||
with dissolve
|
||||
|
||||
e "... or invert the colors, for a kinda scary look."
|
||||
|
||||
show logo bright at logopos
|
||||
with dissolve
|
||||
|
||||
e "It can even adjust brightness and contrast."
|
||||
|
||||
e "We've made some of the most common matrices into image operators."
|
||||
|
||||
show logo grayscale at logopos
|
||||
with dissolve
|
||||
|
||||
e "im.Grayscale can make an image grayscale..."
|
||||
|
||||
show logo sepia at logopos
|
||||
with dissolve
|
||||
|
||||
e "... while im.Sepia can sepia-tone an image."
|
||||
|
||||
show logo base at logopos
|
||||
with dissolve
|
||||
show logo alpha at logopos
|
||||
with dissolve
|
||||
|
||||
e "The im.Alpha operation can adjust the alpha channel on an image, making things partially transparent."
|
||||
|
||||
show eileen alpha at left
|
||||
with dissolve
|
||||
|
||||
e "It's useful if a character just happens to be ghost."
|
||||
|
||||
hide logo
|
||||
show eileen happy at left
|
||||
with dissolve
|
||||
|
||||
e "But that isn't the case with me."
|
||||
|
||||
show eileen happy
|
||||
with move
|
||||
show eileen flip
|
||||
with dissolve
|
||||
|
||||
e "Finally, there's im.Flip, which can flip an image horizontally or vertically."
|
||||
|
||||
e "I think the less I say about this, the better."
|
||||
|
||||
show eileen happy
|
||||
with dissolve
|
||||
|
||||
return
|
||||
@@ -0,0 +1,72 @@
|
||||
# Code that demonstrates layers and advanced show.
|
||||
|
||||
init:
|
||||
|
||||
# Declare a layer, 'demo', that lives just above the default 'master'
|
||||
# layer.
|
||||
$ config.layers.insert(1, 'demo')
|
||||
|
||||
# Make it so that it only takes up part of the screen.
|
||||
$ config.layer_clipping['demo'] = (50, 50, 700, 500)
|
||||
|
||||
|
||||
label demo_layers:
|
||||
|
||||
e "Ren'Py lets you define layers, and show images on specific layers."
|
||||
|
||||
hide eileen
|
||||
with dissolve
|
||||
|
||||
show bg whitehouse onlayer demo
|
||||
with dissolve
|
||||
|
||||
show eileen happy onlayer demo
|
||||
with dissolve
|
||||
|
||||
e "The \"onlayer\" clause of the scene, show, and hide statements lets us pick which layers the commands affect."
|
||||
|
||||
e "As you can see, layers do not have to take up the entire screen. When a layer doesn't, images are clipped to the layer."
|
||||
|
||||
scene onlayer demo
|
||||
show eileen happy
|
||||
with dissolve
|
||||
|
||||
e "The \"as\" clause lets you change the tag of an image."
|
||||
|
||||
show eileen happy as eileen2
|
||||
with None
|
||||
|
||||
show eileen happy at left
|
||||
show eileen happy at right as eileen2
|
||||
with move
|
||||
|
||||
e "This is useful when you want to show two copies of the same image."
|
||||
|
||||
e "Or if a character has a twin."
|
||||
|
||||
show eileen happy at center
|
||||
show eileen happy at offscreenright as eileen2
|
||||
with move
|
||||
|
||||
hide eileen2
|
||||
|
||||
show expression Text("This is text.", size=50, yalign=0.5, xalign=0.5, drop_shadow=(2, 2)) as text
|
||||
with dissolve
|
||||
|
||||
e "You can use \"show expression\" to show things that aren't just images, like text."
|
||||
|
||||
hide text
|
||||
with dissolve
|
||||
|
||||
show logo base at Position(xalign=0.6, yalign=0.0) behind eileen
|
||||
with dissolve
|
||||
|
||||
e "Finally, the \"behind\" clause lets you place an image behind another."
|
||||
|
||||
hide logo base
|
||||
show eileen happy
|
||||
with dissolve
|
||||
|
||||
e "And that's it for layers and advanced show."
|
||||
|
||||
return
|
||||
@@ -0,0 +1,276 @@
|
||||
init:
|
||||
|
||||
image bg pong field = "pong_field.png"
|
||||
|
||||
python:
|
||||
|
||||
class PongDisplayable(renpy.Displayable):
|
||||
|
||||
def __init__(self):
|
||||
|
||||
renpy.Displayable.__init__(self)
|
||||
|
||||
# Some displayables we use.
|
||||
self.paddle = Image("pong.png")
|
||||
self.ball = Image("pong_ball.png")
|
||||
self.player = Text("Player", size=36)
|
||||
self.eileen = Text("Eileen", size=36)
|
||||
self.ctb = Text("Click to Begin", size=36)
|
||||
|
||||
# The sizes of some of the images.
|
||||
self.PADDLE_WIDTH = 8
|
||||
self.PADDLE_HEIGHT = 79
|
||||
self.BALL_WIDTH = 15
|
||||
self.BALL_HEIGHT = 15
|
||||
self.COURT_TOP = 108
|
||||
self.COURT_BOTTOM = 543
|
||||
|
||||
# If the ball is stuck to the paddle.
|
||||
self.stuck = True
|
||||
|
||||
# The positions of the two paddles.
|
||||
self.playery = (self.COURT_BOTTOM - self.COURT_TOP) / 2
|
||||
self.computery = self.playery
|
||||
|
||||
# The speed of the computer.
|
||||
self.computerspeed = 350.0
|
||||
|
||||
# The position, dental-position, and the speed of the
|
||||
# ball.
|
||||
self.bx = 88
|
||||
self.by = self.playery
|
||||
self.bdx = .5
|
||||
self.bdy = .5
|
||||
self.bspeed = 300.0
|
||||
|
||||
# The time of the past render-frame.
|
||||
self.oldst = None
|
||||
|
||||
# The winner.
|
||||
self.winner = None
|
||||
|
||||
def visit(self):
|
||||
return [ self.paddle, self.ball, self.player, self.eileen, self.ctb ]
|
||||
|
||||
# Recomputes the position of the ball, handles bounces, and
|
||||
# draws the screen.
|
||||
def render(self, width, height, st, at):
|
||||
|
||||
# The Render object we'll be drawing into.
|
||||
r = renpy.Render(width, height)
|
||||
|
||||
# Figure out the time elapsed since the previous frame.
|
||||
if self.oldst is None:
|
||||
self.oldst = st
|
||||
|
||||
dtime = st - self.oldst
|
||||
self.oldst = st
|
||||
|
||||
# Figure out where we want to move the ball to.
|
||||
speed = dtime * self.bspeed
|
||||
oldbx = self.bx
|
||||
|
||||
if self.stuck:
|
||||
self.by = self.playery
|
||||
else:
|
||||
self.bx += self.bdx * speed
|
||||
self.by += self.bdy * speed
|
||||
|
||||
# Move the computer's paddle. It wants to go to self.by, but
|
||||
# may be limited by it's speed limit.
|
||||
cspeed = self.computerspeed * dtime
|
||||
if abs(self.by - self.computery) <= cspeed:
|
||||
self.computery = self.by
|
||||
else:
|
||||
self.computery += cspeed * (self.by - self.computery) / abs(self.by - self.computery)
|
||||
|
||||
# Handle bounces.
|
||||
|
||||
# Bounce off of top.
|
||||
ball_top = self.COURT_TOP + self.BALL_HEIGHT / 2
|
||||
if self.by < ball_top:
|
||||
self.by = ball_top + (ball_top - self.by)
|
||||
self.bdy = -self.bdy
|
||||
renpy.sound.play("pong_beep.wav", channel=0)
|
||||
|
||||
# Bounce off bottom.
|
||||
ball_bot = self.COURT_BOTTOM - self.BALL_HEIGHT / 2
|
||||
if self.by > ball_bot:
|
||||
self.by = ball_bot - (self.by - ball_bot)
|
||||
self.bdy = -self.bdy
|
||||
renpy.sound.play("pong_beep.wav", channel=0)
|
||||
|
||||
# This draws a paddle, and checks for bounces.
|
||||
def paddle(px, py, hotside):
|
||||
|
||||
# Render the paddle image. We give it an 800x600 area
|
||||
# to render into, knowing that images will render smaller.
|
||||
# (This isn't the case with all displayables. Solid, Frame,
|
||||
# and Fixed will expand to fill the space allotted.)
|
||||
# We also pass in st and at.
|
||||
pi = renpy.render(self.paddle, 800, 600, st, at)
|
||||
|
||||
# renpy.render returns a Render object, which we can
|
||||
# blit to the Render we're making.
|
||||
r.blit(pi, (int(px), int(py - self.PADDLE_HEIGHT / 2)))
|
||||
|
||||
if py - self.PADDLE_HEIGHT / 2 <= self.by <= py + self.PADDLE_HEIGHT / 2:
|
||||
|
||||
hit = False
|
||||
|
||||
if oldbx >= hotside >= self.bx:
|
||||
self.bx = hotside + (hotside - self.bx)
|
||||
self.bdx = -self.bdx
|
||||
hit = True
|
||||
|
||||
elif oldbx <= hotside <= self.bx:
|
||||
self.bx = hotside - (self.bx - hotside)
|
||||
self.bdx = -self.bdx
|
||||
hit = True
|
||||
|
||||
if hit:
|
||||
renpy.sound.play("pong_boop.wav", channel=1)
|
||||
self.bspeed *= 1.10
|
||||
|
||||
# Draw the two paddles.
|
||||
paddle(68, self.playery, 68 + self.PADDLE_WIDTH)
|
||||
paddle(724, self.computery, 724)
|
||||
|
||||
# Draw the ball.
|
||||
ball = renpy.render(self.ball, 800, 600, st, at)
|
||||
r.blit(ball, (int(self.bx - self.BALL_WIDTH / 2),
|
||||
int(self.by - self.BALL_HEIGHT / 2)))
|
||||
|
||||
# Show the player names.
|
||||
player = renpy.render(self.player, 800, 600, st, at)
|
||||
r.blit(player, (20, 25))
|
||||
|
||||
# Show Eileen's name.
|
||||
eileen = renpy.render(self.eileen, 800, 600, st, at)
|
||||
ew, eh = eileen.get_size()
|
||||
r.blit(eileen, (790 - ew, 25))
|
||||
|
||||
# Show the "Click to Begin" label.
|
||||
if self.stuck:
|
||||
ctb = renpy.render(self.ctb, 800, 600, st, at)
|
||||
cw, ch = ctb.get_size()
|
||||
r.blit(ctb, (400 - cw / 2, 30))
|
||||
|
||||
|
||||
# Check for a winner.
|
||||
if self.bx < -200:
|
||||
self.winner = "eileen"
|
||||
|
||||
# Needed to ensure that event is called, noticing
|
||||
# the winner.
|
||||
renpy.timeout(0)
|
||||
|
||||
elif self.bx > 1000:
|
||||
self.winner = "player"
|
||||
renpy.timeout(0)
|
||||
|
||||
# Ask that we be re-rendered ASAP, so we can show the next
|
||||
# frame.
|
||||
renpy.redraw(self, 0)
|
||||
|
||||
# Return the Render object.
|
||||
return r
|
||||
|
||||
# Handles events.
|
||||
def event(self, ev, x, y, st):
|
||||
|
||||
import pygame
|
||||
|
||||
# Mousebutton down == start the game by setting stuck to
|
||||
# false.
|
||||
if ev.type == pygame.MOUSEBUTTONDOWN and ev.button == 1:
|
||||
self.stuck = False
|
||||
|
||||
# Set the position of the player's paddle.
|
||||
y = max(y, self.COURT_TOP)
|
||||
y = min(y, self.COURT_BOTTOM)
|
||||
self.playery = y
|
||||
|
||||
# If we have a winner, return him or her. Otherwise, ignore
|
||||
# the current event.
|
||||
if self.winner:
|
||||
return self.winner
|
||||
else:
|
||||
raise renpy.IgnoreEvent()
|
||||
|
||||
|
||||
label demo_minigame:
|
||||
|
||||
e "You may want to mix Ren'Py with other forms of gameplay. There are many ways to do this."
|
||||
|
||||
e "The first is with the UI functions, which can be used to create powerful button and menu based interfaces."
|
||||
|
||||
e "These are often enough for many simulation-style games."
|
||||
|
||||
e "We also have two more ways in which Ren'Py can be extended. Both require experience with Python programming, and so aren't for the faint of heart."
|
||||
|
||||
e "Renpygame is a library that allows pygame games to be run inside Ren'Py."
|
||||
|
||||
e "When using renpygame, Ren'Py steps out of the way and gives you total control over the user's experience."
|
||||
|
||||
e "You can get renpygame from the Frameworks page of the Ren'Py website."
|
||||
|
||||
e "If you want to integrate your code with Ren'Py, you can write a user-defined displayable."
|
||||
|
||||
e "User-defined displayables are somewhat more limited, but integrate better with the rest of Ren'Py."
|
||||
|
||||
e "For example, one could support loading and saving while a user-defined displayable is shown."
|
||||
|
||||
e "Now, why don't we play some pong?"
|
||||
|
||||
window hide None
|
||||
|
||||
label demo_minigame_pong:
|
||||
|
||||
# Put up the pong background, in the usual fashion.
|
||||
scene bg pong field
|
||||
|
||||
# Run the pong minigame, and determine the winner.
|
||||
python:
|
||||
ui.add(PongDisplayable())
|
||||
winner = ui.interact(suppress_overlay=True, suppress_underlay=True)
|
||||
|
||||
scene bg washington
|
||||
show eileen vhappy
|
||||
|
||||
window show None
|
||||
|
||||
|
||||
if winner == "eileen":
|
||||
|
||||
e "I win!"
|
||||
|
||||
else:
|
||||
|
||||
e "You won! Congratulations."
|
||||
|
||||
|
||||
show eileen happy
|
||||
|
||||
menu:
|
||||
e "Would you like to play again?"
|
||||
|
||||
"Sure.":
|
||||
jump demo_minigame_pong
|
||||
"No thanks.":
|
||||
pass
|
||||
|
||||
|
||||
e "Remember to be careful about putting minigames in a visual novel, since not every visual novel player wants to be good at arcade games."
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
init:
|
||||
# Defines a big image we can pan over.
|
||||
image bg onememorial = "1memorial.jpg"
|
||||
|
||||
# Defines a SnowBlossom object, which uses particle motion to show falling
|
||||
# cherry blossom petals.
|
||||
image snowblossom = SnowBlossom(anim.Filmstrip("sakura.png", (20, 20), (2, 1), .15), fast=True)
|
||||
|
||||
# Defines the magic circle image.
|
||||
image magic_circle = "magic.png"
|
||||
|
||||
# Defines an image that zooms between various sizes.
|
||||
image logo sizezoom = Animation(
|
||||
At("logo.png", SizeZoom((100, 300), (300, 100), 1, opaque=False)), 1,
|
||||
At("logo.png", SizeZoom((300, 100), (100, 300), 1, opaque=False)), 1,
|
||||
)
|
||||
|
||||
# Defines a spline motion.
|
||||
init python:
|
||||
spline = SplineMotion([
|
||||
((-0.042, 0.523,),),
|
||||
((0.768, 0.296,), (0.082, 0.507,), (0.772, 0.573,),),
|
||||
((0.292, 0.304,), (0.766, 0.112,), (0.296, 0.123,),),
|
||||
((1.152, 0.509,), (0.288, 0.555,), (1.076, 0.499,),),
|
||||
], 3.0, anchors=(0.5, 0.5))
|
||||
|
||||
label demo_movement:
|
||||
|
||||
|
||||
e "I'm not stuck standing in the middle of the screen, even though I like being the center of attention."
|
||||
|
||||
e "Positions, given with an at clause, specify where I'm standing, while the 'move' transition moves around images that have changed position."
|
||||
|
||||
e "For example..."
|
||||
|
||||
show eileen happy at left
|
||||
with move
|
||||
|
||||
e "The left position has my left side border the left side of the screen."
|
||||
|
||||
show eileen happy at center
|
||||
with move
|
||||
|
||||
e "I can also move to the center..."
|
||||
|
||||
show eileen happy at right
|
||||
with move
|
||||
|
||||
e "and the right."
|
||||
|
||||
e "We don't limit you to these positions either. You can always create your own Position objects."
|
||||
|
||||
# This is necessary to restart the time at which we are
|
||||
# shown.
|
||||
hide eileen happy
|
||||
|
||||
show eileen happy at Move((1.0, 1.0, 1.0, 1.0),
|
||||
(0.0, 1.0, 0.0, 1.0),
|
||||
4.0, repeat=True, bounce=True)
|
||||
|
||||
e "It's also possible to have a movement happen while showing dialogue on the screen, using the Move function."
|
||||
|
||||
e "Move can repeat a movement, and even have it bounce back and forth, like I'm doing now."
|
||||
|
||||
|
||||
show eileen happy at Move((.25, 1.0, 0.0, 1.0),
|
||||
(.75, 1.0, 1.0, 1.0),
|
||||
10.0, repeat=True, bounce=True, subpixel=True)
|
||||
|
||||
with dissolve
|
||||
|
||||
e "Our subpixel mode allows slow moves, of less than a few pixels a second, to be very accurate."
|
||||
|
||||
scene bg onememorial at Pan((0, 800), (0, 0), 10.0)
|
||||
with dissolve
|
||||
|
||||
e "We can pan around an image larger than the screen, using the Pan function in an at clause. That's what we're doing now."
|
||||
|
||||
scene bg whitehouse
|
||||
with dissolve
|
||||
|
||||
# spline is defined near the top of this file.
|
||||
show logo base at spline
|
||||
|
||||
e "SplineMotion allows for more complex movements to be defined."
|
||||
|
||||
hide logo base
|
||||
|
||||
scene bg whitehouse at Zoom((800, 600), (0, 0, 800, 600), (225, 150, 400, 300), 1.0)
|
||||
|
||||
e "We can zoom into images..."
|
||||
|
||||
scene bg whitehouse at Zoom((800, 600), (225, 150, 400, 300), (0, 0, 800, 600), 1.0)
|
||||
|
||||
e "... and zoom back out of them again."
|
||||
|
||||
scene bg whitehouse
|
||||
show eileen happy at FactorZoom(1.0, 0.5, 1.0, opaque=False), center
|
||||
|
||||
e "We can also zoom images by a factor..."
|
||||
|
||||
show eileen happy at FactorZoom(0.5, 1.0, 1.0, opaque=False), center
|
||||
|
||||
e "... and zoom {i}them{/i} out again."
|
||||
|
||||
show eileen happy at left
|
||||
# logo sizezoom is defined at the top of this file.
|
||||
show logo sizezoom at Position(xalign=.75, yalign=.4)
|
||||
with moveinright
|
||||
|
||||
e "We can scale images to arbitrary sizes."
|
||||
|
||||
show eileen happy at center
|
||||
hide logo sizezoom
|
||||
with moveoutright
|
||||
|
||||
with Pause(.5)
|
||||
|
||||
$ renpy.layer_at_list([ Zoom((800, 600), (0, 0, 800, 600), (200, 0, 400, 300), 1)])
|
||||
with Pause(1)
|
||||
$ renpy.layer_at_list([ Zoom((800, 600), (200, 0, 400, 300), (0, 0, 800, 600), 1)])
|
||||
with Pause(1)
|
||||
$ renpy.layer_at_list([ ])
|
||||
|
||||
e "We can apply motions to a layer as a whole."
|
||||
|
||||
show eileen happy
|
||||
show magic_circle at RotoZoom(0, 360, 5, 0, 1, 1, rot_repeat=True, rot_anim_timebase=True, opaque=False, xalign=0.5, yalign=0.5)
|
||||
|
||||
with Pause(1)
|
||||
|
||||
e "We can rotate and zoom images in a single operation."
|
||||
|
||||
e "And when we're no longer feeling so occult, we can zoom them back out again."
|
||||
|
||||
show magic_circle at RotoZoom(0, 360, 5, 1, 0, 1, rot_repeat=True, rot_anim_timebase=True, opaque=False, xalign=0.5, yalign=0.5)
|
||||
|
||||
with Pause(1)
|
||||
|
||||
hide magic_circle
|
||||
|
||||
show eileen happy
|
||||
show logo base at Position(xpos=250, ypos=300, xanchor=0.5, yanchor=0.5), Revolve(0, 360, 4, repeat=True) behind eileen
|
||||
with dissolve
|
||||
|
||||
"We can also revolve an image around in a circle."
|
||||
|
||||
show bg washington
|
||||
hide logo base
|
||||
show snowblossom
|
||||
with dissolve
|
||||
|
||||
e "Finally, Ren'Py has a particle motion system, that can be used for things like falling cherry blossoms, falling snow, and rising bubbles."
|
||||
|
||||
e "The particle motion system uses a factory to create particles over the course of an interaction."
|
||||
|
||||
e "While the SnowBlossom function wraps a factory that provides convenient support for things rising and falling in straight lines, it's also possible to define your own."
|
||||
|
||||
e "The sky's the limit."
|
||||
|
||||
e "Or the ground, in the case of these cherry blossoms."
|
||||
|
||||
hide snowblossom
|
||||
with dissolve
|
||||
|
||||
return
|
||||
@@ -0,0 +1,57 @@
|
||||
# This file contains demonstrations of Ren'Py's multimedia
|
||||
# support. Right now, this is just showing off sound and music, but
|
||||
# Ren'Py does support movies, and we'll add them sometime later.
|
||||
|
||||
image movie = Movie(size=(320, 240), xpos=475, ypos=50, xanchor=0, yanchor=0)
|
||||
|
||||
label demo_multimedia:
|
||||
|
||||
e "Ren'Py supports a number of multimedia functions."
|
||||
|
||||
e "You're probably hearing music playing in the background."
|
||||
|
||||
# This stops the music, and fades it out.
|
||||
stop music fadeout 0.5
|
||||
|
||||
e "We can stop it, with a fadeout..."
|
||||
|
||||
# This plays music.
|
||||
play music "mozart.ogg"
|
||||
|
||||
e "... and start it playing again."
|
||||
|
||||
# This plays a sound effect.
|
||||
play sound "18005551212.ogg"
|
||||
|
||||
e "We can play sound effects on top of the music."
|
||||
|
||||
$ renpy.music.set_pan(-1, 0)
|
||||
$ renpy.music.set_pan( 1, 2)
|
||||
|
||||
e "We can pan the music back and forth."
|
||||
|
||||
$ renpy.music.set_pan(0, .5)
|
||||
|
||||
e "Voice support is included as part of Ren'Py, although we don't yet have a demonstration."
|
||||
|
||||
$ renpy.music.set_volume(0, .5)
|
||||
|
||||
e "Finally, we support playing movie files."
|
||||
|
||||
show movie behind eileen
|
||||
play movie "shuttle.ogv"
|
||||
|
||||
e "We can put a movie on the screen with text and other images."
|
||||
|
||||
stop movie
|
||||
hide movie
|
||||
|
||||
e "We can also play the movie in fullscreen... but with this tiny movie we're using as an example, it's going to look bad."
|
||||
|
||||
$ renpy.movie_cutscene("shuttle.ogv", stop_music=False)
|
||||
|
||||
$ renpy.music.set_volume(1, 1.0)
|
||||
|
||||
e "That's about it for multimedia."
|
||||
|
||||
return
|
||||
@@ -0,0 +1,81 @@
|
||||
# This demonstrates nvl_mode.rpy.
|
||||
|
||||
init:
|
||||
|
||||
# Declare an nvl-version of eileen.
|
||||
$ nvle = Character("Eileen", color="#c8ffc8", kind=nvl)
|
||||
|
||||
$ config.adv_nvl_transition = dissolve
|
||||
$ config.nvl_adv_transition = dissolve
|
||||
|
||||
label demo_nvlmode:
|
||||
|
||||
window hide
|
||||
|
||||
nvl clear
|
||||
nvl show dissolve
|
||||
|
||||
nvle "NVL-style games are games that cover the full screen with text, rather then placing it in a file at the bottom of the screen."
|
||||
|
||||
nvle "Ren'Py ships with a file, nvl_mode.rpy, that implements NVL-style games. You're seeing an example of NVL-mode at work."
|
||||
|
||||
nvl clear
|
||||
|
||||
nvle "To use NVL-mode, you need to define Characters with a kind=nvl."
|
||||
|
||||
nvle "You use 'nvl clear' to clear the screen when that becomes necessary."
|
||||
|
||||
nvl hide dissolve
|
||||
nvl show dissolve
|
||||
|
||||
nvle "The 'nvl show' and 'nvl hide' statements use transitions to show and hide the NVL window."
|
||||
|
||||
nvle "The nvl_erase function removes a line from the screen."
|
||||
|
||||
$ nvl_erase()
|
||||
|
||||
nvle "Like that."
|
||||
|
||||
# Doing this during the game isn't recommended, it's better to do
|
||||
# it in an init block. We have to do it here because we need to use
|
||||
# both kinds of menus.
|
||||
$ menu = nvl_menu
|
||||
|
||||
menu:
|
||||
|
||||
nvle "The nvl_mode also supports showing menus to the user, provided they are the last thing on the screen. Understand?"
|
||||
|
||||
"Yes.":
|
||||
|
||||
nvl clear
|
||||
|
||||
nvle "Good!"
|
||||
|
||||
nvl clear
|
||||
|
||||
"No.":
|
||||
|
||||
nvl clear
|
||||
|
||||
nvle "Well, it might help if you take a look at the demo code."
|
||||
|
||||
nvl clear
|
||||
|
||||
eside "You can specify transitions that occur when going from NVL-mode to ADV-mode."
|
||||
|
||||
nvle "As well as when going from ADV-mode to NVL-mode."
|
||||
|
||||
nvle "Text tags like {{w}{w} work in NVL-mode."
|
||||
|
||||
extend " As does the \"extend\" special character."
|
||||
|
||||
nvle "And that's it for NVL-mode."
|
||||
|
||||
$ menu = renpy.display_menu
|
||||
|
||||
nvl hide dissolve
|
||||
window show
|
||||
|
||||
return
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
init:
|
||||
$ mp = MultiPersistent("demo.renpy.org")
|
||||
|
||||
label demo_persistent:
|
||||
|
||||
"Ren'Py supports per-game and multi-game persistent data."
|
||||
|
||||
"Persistent data can store flags and other per-game information that should be shared between plays of a single game."
|
||||
|
||||
# per-game persistent data example.
|
||||
python:
|
||||
if persistent.plays is None:
|
||||
persistent.plays = 1
|
||||
else:
|
||||
persistent.plays += 1
|
||||
|
||||
plays = persistent.plays
|
||||
|
||||
"For example, I can tell you that you've see this line %(plays)d time(s) since you cleared the per-game persistent data."
|
||||
|
||||
"Multipersistent data is shared between games, which lets one game unlock features in a second."
|
||||
|
||||
"A sequel might play differently if the player has beaten the first game."
|
||||
|
||||
# multipersistent data example.
|
||||
python:
|
||||
if mp.plays is None:
|
||||
mp.plays = 1
|
||||
else:
|
||||
mp.plays += 1
|
||||
|
||||
mp.save()
|
||||
plays = mp.plays
|
||||
|
||||
"According to the multipersistent data, you've seen this line %(plays)d times total."
|
||||
|
||||
return
|
||||