Compare commits
373 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b384ee0381 | |||
| b8862d6b24 | |||
| dbfa4ed46d | |||
| d9eb999775 | |||
| b4a9ca3f87 | |||
| d087c86d1a | |||
| 0cfc7b25a6 | |||
| 8f3c9bd2ba | |||
| 91c79cdac9 | |||
| 20e4e110ce | |||
| 870d7ffe2c | |||
| 6ff88c914d | |||
| 2a2078517f | |||
| c09f697293 | |||
| a9e273a13d | |||
| 592665aa9a | |||
| 3745788f06 | |||
| 52b09d8f4c | |||
| 32f25cdcec | |||
| 6f022a9b6a | |||
| eea6970929 | |||
| 35ecfd279f | |||
| 1f5c610843 | |||
| 05f4c52c33 | |||
| 326f773e75 | |||
| 2079b518a2 | |||
| 70ed15e5ac | |||
| f1d7fe0c73 | |||
| 08e4b9bafc | |||
| 56a0212316 | |||
| 5df6506191 | |||
| 39779be980 | |||
| bdacdddf14 | |||
| 4b32337ef3 | |||
| 4897d5b7a9 | |||
| 6daa64facd | |||
| 07651e414d | |||
| 7e1e76f0d8 | |||
| b91a5d1a16 | |||
| 39b0646f24 | |||
| ea6406f144 | |||
| 7ed3f3fbad | |||
| cacb4ac40e | |||
| 9503744631 | |||
| 58dfd5dbfa | |||
| 60d5507184 | |||
| 5641cec146 | |||
| dd455e3d14 | |||
| 6876697f74 | |||
| 4373cab8cf | |||
| eeccb5833b | |||
| 790dad0330 | |||
| 078a38af5d | |||
| 8c186d2eb1 | |||
| 81b94b27e0 | |||
| 17e8616e8c | |||
| 50b0dc3c5e | |||
| 9e217e722f | |||
| f466b44b66 | |||
| 34e0fc7cba | |||
| bb88a7bb95 | |||
| 71ba444e62 | |||
| 3e0baee463 | |||
| a0064f5511 | |||
| e7ce23f377 | |||
| 9c6d93968c | |||
| e4b29d58f4 | |||
| a48b87a0d6 | |||
| 763515a937 | |||
| 46a8242e51 | |||
| efa8d66d3d | |||
| b7c71bb3b8 | |||
| aca5438b5a | |||
| e7eb23ab5e | |||
| 05dd8bfcc7 | |||
| 2c299ab079 | |||
| 62acff5c75 | |||
| 316d146893 | |||
| e69fee2108 | |||
| 8fe6e1cf20 | |||
| 6fcf7dbbba | |||
| f55c5f0ce5 | |||
| aaf8369421 | |||
| 8e26c7730c | |||
| 556ca0611a | |||
| e2e78c175b | |||
| 7b8033e6b2 | |||
| d602645fee | |||
| f8ac9c9e83 | |||
| 98c90f8ab3 | |||
| 16bb21ee62 | |||
| 46bfec93d4 | |||
| 00e1ecf37d | |||
| a3e7b290fb | |||
| 27ce59963f | |||
| 54e3a97447 | |||
| f886f710b7 | |||
| a895e1dc6c | |||
| 6f24d8eebd | |||
| 000174c2c4 | |||
| 192aaea186 | |||
| eb0d6b696e | |||
| 94e1b0eb56 | |||
| 694a1cd6d5 | |||
| 0600897a26 | |||
| e8c52f9417 | |||
| 6d86963b1d | |||
| 01e621067a | |||
| cd379ef1a3 | |||
| 41a4fbfb4d | |||
| 04db2112c3 | |||
| d20bfb18bc | |||
| d02d83f896 | |||
| 6b45c92a58 | |||
| 871ad8c07f | |||
| 997290cd28 | |||
| fcfab5ada6 | |||
| 005f45bad3 | |||
| ef64872af5 | |||
| 2cd5528df9 | |||
| 0a73e6f905 | |||
| b9f468e3f4 | |||
| ad5631ffc1 | |||
| 50767c211a | |||
| 8223545b72 | |||
| 9925fa78e7 | |||
| 7834365803 | |||
| 5bfeea6e30 | |||
| 1877fcfe65 | |||
| 98437bc207 | |||
| 49e9560e91 | |||
| 9c5084ef14 | |||
| 401c503c91 | |||
| 73d4515f9e | |||
| 9faadbd077 | |||
| c886f16308 | |||
| 6b4b410708 | |||
| d6e50d840f | |||
| c1848159a9 | |||
| 46f503ec3c | |||
| 71f40a33f7 | |||
| 94e789efde | |||
| d738da4272 | |||
| 8bbf9cb618 | |||
| c5276e5073 | |||
| 9b0a739872 | |||
| b3e817e1d4 | |||
| 96a73712eb | |||
| dc91721ca2 | |||
| 7175bb664c | |||
| 2a49120ac2 | |||
| 4ef546649b | |||
| f1a77bd2b0 | |||
| aa8b6d364b | |||
| 1245c6120e | |||
| 2995118cae | |||
| a201418d1a | |||
| 1b46904897 | |||
| 1cf6764a08 | |||
| 6527b4e198 | |||
| fd4d01374f | |||
| c77a11382d | |||
| 1239153a1c | |||
| ae7152a5fc | |||
| eec4eb73b5 | |||
| 0ab3521005 | |||
| 660ef587c9 | |||
| 541dd7b3c3 | |||
| ca53e2f696 | |||
| 80764e130f | |||
| 6afd0120c1 | |||
| 953be074f2 | |||
| 03781d24d6 | |||
| 55d87064a8 | |||
| 512478b945 | |||
| 1c19ca8062 | |||
| fc764b464d | |||
| 945b4fc1cd | |||
| 902b17462e | |||
| 8b0b39829a | |||
| 356ca9cd1e | |||
| 634da84442 | |||
| 1d109ddaee | |||
| c1f996da07 | |||
| b14c9f8954 | |||
| 126050b4f3 | |||
| 313e417f28 | |||
| e98ef1025c | |||
| 3729e4bc3a | |||
| ac071777ad | |||
| 445972756d | |||
| 91732e7def | |||
| 5b7e4af26c | |||
| 2bb459cda5 | |||
| d410c73074 | |||
| da70f197fe | |||
| c18ffb28d0 | |||
| d5f17ef9f1 | |||
| 79c3f426e5 | |||
| b004dd138f | |||
| 45b479e324 | |||
| b07cbd4193 | |||
| ae2739f32d | |||
| dd51fcb1fd | |||
| edc26fe0a4 | |||
| c9215b3b71 | |||
| 115338bdeb | |||
| b0b10ac7d3 | |||
| 5a6013aac9 | |||
| f3aa299aa0 | |||
| 8e44536133 | |||
| 0cb937298e | |||
| 6ed0491520 | |||
| af7748920c | |||
| 3c1c0310d8 | |||
| 91a67304dd | |||
| 04d0e46c3e | |||
| ed27eac80b | |||
| 1f3e02bbdc | |||
| 275e938602 | |||
| 3f80320d37 | |||
| 0e44ce7636 | |||
| 8fe727a8a1 | |||
| b82f7a5548 | |||
| fe15242479 | |||
| 677a9b0dab | |||
| 309001e2fe | |||
| 90e782c9c6 | |||
| f95d9cacb5 | |||
| 308d1e6b00 | |||
| c57b3004a0 | |||
| 00bd5c96e9 | |||
| 371b11370a | |||
| b9338a7446 | |||
| e39ae375f4 | |||
| 975907aebf | |||
| ccfbdf6f3a | |||
| 7934d40b7c | |||
| 3b569a10bd | |||
| 941d959ee5 | |||
| d5a51c8139 | |||
| fc79078d51 | |||
| d6615410dd | |||
| adee372b4b | |||
| 9c7542a357 | |||
| bc18285a61 | |||
| 7b6c3f52e0 | |||
| f95c6e479d | |||
| e4e224348f | |||
| 7e914da261 | |||
| ae3eb40a0e | |||
| 2f8cd81870 | |||
| a1e7b60dab | |||
| 92515fca49 | |||
| 6a8abf2a79 | |||
| 9a47b02840 | |||
| 488c1c34cd | |||
| 52bd7de14f | |||
| deb0f813ca | |||
| 5030513375 | |||
| 53deb04137 | |||
| 2c60f5251f | |||
| 64ac5a9317 | |||
| 607113b31c | |||
| 5a472ef44b | |||
| c67ba9b4e4 | |||
| 3f36d3a881 | |||
| d188618785 | |||
| e6827bdff8 | |||
| 85ac26fb1e | |||
| abea49df8e | |||
| bfc7de0d16 | |||
| aa8c3ecec9 | |||
| 7ab984972e | |||
| da09c4d04f | |||
| c42457446f | |||
| 40bb6ca557 | |||
| f2cc5d25e8 | |||
| 04a5460e8b | |||
| 12ef8ee199 | |||
| 9c2d2f3a06 | |||
| 94bcfe5c58 | |||
| fecd13c733 | |||
| a9a6595d43 | |||
| e4e9ea4e87 | |||
| 588682f0d2 | |||
| 0b502d5530 | |||
| 86a2b5d4e5 | |||
| 312a657e78 | |||
| 6197597ec9 | |||
| c3ee29a9b0 | |||
| d5b26aa973 | |||
| 5d926ad49b | |||
| b5f133ce17 | |||
| 6ee4474e5e | |||
| d515d07110 | |||
| 3d2e5124d4 | |||
| 48a826a13d | |||
| 64e82c2c62 | |||
| 9c5d4d7ad5 | |||
| 5f006c8f4c | |||
| 3d8b6cbecb | |||
| 7e2e123af7 | |||
| 14aa4c4e3d | |||
| 2c15237b8a | |||
| b4845252c1 | |||
| 2f513235b3 | |||
| c68b3bae89 | |||
| 3825e88883 | |||
| bbe0fdb98f | |||
| 009969dab5 | |||
| 376ac7ad81 | |||
| de8257f459 | |||
| 3b0fbcc55f | |||
| e33abc05fb | |||
| 430ee03d45 | |||
| 03477d1c75 | |||
| ef9ee657f7 | |||
| e31f1ac63f | |||
| 33a6c97446 | |||
| 99e9e6e9ba | |||
| 1d81cede71 | |||
| 54ab9e0f1b | |||
| f0df9a7a05 | |||
| adc3bf820b | |||
| d26ac890a5 | |||
| d0397b2111 | |||
| 0229de3f0d | |||
| 176150be7f | |||
| 04992fa431 | |||
| b26725fd01 | |||
| 601e7b1949 | |||
| 37c1571792 | |||
| 812144bdf0 | |||
| 6e616fda4e | |||
| 3f120ce658 | |||
| 5446da46dc | |||
| 172efcac94 | |||
| c5ce6c0f4b | |||
| 40f8644ac2 | |||
| d45cf0d79a | |||
| 68937a71b9 | |||
| db435f5a0a | |||
| 40c469fa23 | |||
| fe7c7e2299 | |||
| 2f9d9f9dee | |||
| 293508969a | |||
| 5908546828 | |||
| b80f6a1e8e | |||
| d3434400cd | |||
| 11a20e21d1 | |||
| 0de0aa292a | |||
| aa0d357bdc | |||
| ca16c24fc4 | |||
| d32db0c9a3 | |||
| 60b9f0522c | |||
| d3c58da216 | |||
| e81044465d | |||
| 75a0741c33 | |||
| a68f4af35d | |||
| 9e0932af5a | |||
| 112c0bce66 | |||
| d640759ab8 | |||
| bb628bd9cd | |||
| ed3c0937d9 | |||
| 48cf0cd50a | |||
| a39934d0c4 | |||
| 2a9eaf9dea | |||
| 0d07b4dcb6 | |||
| 76fbce3304 | |||
| 510eba1628 | |||
| c37fede2f1 | |||
| 3ccb522e33 |
+2
-4
@@ -5,10 +5,6 @@ renpy.app
|
||||
**/*.rpyc
|
||||
**/*.rpyb
|
||||
**/*.rpymc
|
||||
_renpy.c
|
||||
nativemidi.c
|
||||
sound.c
|
||||
winmixer.c
|
||||
jedit
|
||||
lint.txt
|
||||
renpy.code
|
||||
@@ -60,3 +56,5 @@ close_bugs.py
|
||||
.logplayer
|
||||
scite-6.10.zip
|
||||
scite-renpy-20090803.zip
|
||||
module/cython.sh
|
||||
old_demo
|
||||
|
||||
+135
@@ -1,3 +1,138 @@
|
||||
|
||||
New in Ren'Py 6.10.2
|
||||
--------------------
|
||||
|
||||
Ren'Py now caches the individual words of text that are rendered. This
|
||||
can lead to a speedup in text display when there are many words of
|
||||
text on the screen, and that text is re-displayed, as is the case
|
||||
where the text text speed is not the maximum. This is especially
|
||||
beneficial for eastasian languages, where every character is treated
|
||||
as a word.
|
||||
|
||||
|
||||
The new config.menu_clear_layers variable allows layers to be cleared
|
||||
when entering the game menu. This makes it easier for a layer to have
|
||||
overlay-like things on it when in the game, but not when in the game
|
||||
menu.
|
||||
|
||||
|
||||
The new renpy.cache_pin function pins images into memory, loading them
|
||||
as soon as possible and keeping them loaded. The renpy.cache_unpin function
|
||||
undoes this.
|
||||
|
||||
|
||||
The new config.automatic_images_strip variable can strip out prefixes
|
||||
when automatically defining images.
|
||||
|
||||
|
||||
It's now possible to assign style properties to individual imagemap
|
||||
buttons, by indexing style.imagemap_button. (So for example, one could
|
||||
assign to style.imagemap_button["Start Game"].hover_sound .)
|
||||
|
||||
|
||||
The new voice_replay function replays the voice played on the current
|
||||
interaction. The new voice_can_replay function returns True if a voice
|
||||
can be replayed.
|
||||
|
||||
|
||||
The launcher now accepts a RENPY_DEFAULT_PROJECTS_DIRECTORY, which sets
|
||||
the default for the projects directory, if it has not already been set
|
||||
by the user. It also will report an error when creating a project fails,
|
||||
rather than producing a traceback.
|
||||
|
||||
|
||||
The launcher now links to the new Ren'Py Games List, at
|
||||
http://games.renpy.org/.
|
||||
|
||||
|
||||
Previously, it was impossible to pass an arguments list to a call
|
||||
expression. Now, we allow the pass keyword to be used to distinguish
|
||||
the two, using code like:
|
||||
|
||||
call expression foo pass (bar, baz)
|
||||
|
||||
|
||||
Ren'Py will now not show the click-to-continue indicator when a
|
||||
character is called with interact=False, unless that character is also
|
||||
called with ctc_force=True.
|
||||
|
||||
|
||||
Ren'Py now builds zip files in distributions 64k at a time.
|
||||
|
||||
|
||||
Ren'Py will now ignore music files that do not exist. Previously, it
|
||||
could loop trying to play them. (This would increase CPU usage, rather
|
||||
than causing a crash.)
|
||||
|
||||
|
||||
The following numbered bugs were fixed:
|
||||
|
||||
* lp:501351 - Displaying a Frame() with tile=True crashes
|
||||
* lp:506322 - MoveTransition is not applied to overlay even when explicitly stated
|
||||
|
||||
In addition:
|
||||
|
||||
* Fixed a bug that caused pixellate to crash.
|
||||
* Fixed a bug that caused the overlay to display twice in some cases.
|
||||
* Fix an infinite loop that could rarely occur when rolling back or saving.
|
||||
|
||||
|
||||
|
||||
New in Ren'Py 6.10.1
|
||||
--------------------
|
||||
|
||||
Images and other surfaces are now created with a 1px transparent border
|
||||
around them. This change allows transform to work correctly with a 1:1
|
||||
scale, where as previously Ren'Py would blur the image slightly, while
|
||||
trying to ensure it never accessed a pixel outside of the original
|
||||
image bounds.
|
||||
|
||||
|
||||
ATL now has a "function" statement, which allows an ATL transform to
|
||||
use the same functions that are supplied to Transform.
|
||||
|
||||
|
||||
The layout.imagemap_main_menu and layout.imagemap_load_save functions
|
||||
now allow one to define variant screens. This allows one to select an
|
||||
imagemap main menu screen to use, or to define different screens for
|
||||
loading and saving.
|
||||
|
||||
|
||||
The overlay semantics were changed such that transitions apply to overlays
|
||||
in the same way they apply to everything else. (So, for example, dissolves
|
||||
will apply to overlays.)
|
||||
|
||||
|
||||
The image text tag can now take any textual image representation. So
|
||||
something like {image=eileen happy} is legal, if odd.
|
||||
|
||||
|
||||
The following numbered bugs were fixed:
|
||||
|
||||
lp:366412 - Ren'Py could crash on shift+R at the main menu, under some circumstances.
|
||||
|
||||
lp:485631 - The transfer of state from a transfrom to a transform supplied as part of an image didn't work.
|
||||
|
||||
lp:487688 - non-ASCII characters didn't display in the window title bar.
|
||||
|
||||
lp:487701 - Ren'Py didn't work when in a directory containing non-ASCII characters.
|
||||
|
||||
lp:488814 - Scaling to the same size could blur an image.
|
||||
|
||||
lp:489212 - Interpolation didn't work when the starting value was None.
|
||||
|
||||
lp:493062 - One could roll back into an imagemap main menu.
|
||||
|
||||
lp:494779 - The window shown state wasn't being tracked correctly.
|
||||
|
||||
lp:494820 - Error handling in ATL hid too many error messages.
|
||||
|
||||
A major bug that caused Ren'Py to fail as scaling was enabled was fixed.
|
||||
|
||||
A number of minor bugs revealed by pyflakes were fixed.
|
||||
|
||||
|
||||
|
||||
New in Ren'Py 6.10.0
|
||||
--------------------
|
||||
|
||||
|
||||
+707
-667
File diff suppressed because it is too large
Load Diff
Symlink
+1
@@ -0,0 +1 @@
|
||||
dist/Microsoft.VC90.CRT.manifest
|
||||
+7
-3
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import shutil
|
||||
from distutils.core import setup
|
||||
import py2exe
|
||||
import sys
|
||||
@@ -7,15 +8,15 @@ import zipfile
|
||||
import traceback
|
||||
|
||||
# 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.path.insert(0, 'c:\\msys\\1.0\\newbuild\\install\\bin')
|
||||
sys.path.insert(0, 'c:\\msys\\1.0\\newbuild\\install\\python')
|
||||
|
||||
def main():
|
||||
|
||||
sys.argv[1:] = [ 'py2exe', '--bundle', '2', '-a', '--dll-excludes', 'w9xpopen.exe', ]
|
||||
# sys.argv[1:] = [ 'py2exe', '-a', '--dll-excludes', 'w9xpopen.exe', ]
|
||||
|
||||
setup(name="RenPy",
|
||||
setup(name="Ren'Py",
|
||||
windows=[ dict(script="renpy.py",
|
||||
dest_base="renpy",
|
||||
icon_resources=[ (1, "newicon.ico") ],
|
||||
@@ -70,6 +71,9 @@ def main():
|
||||
zfold.close()
|
||||
zfnew.close()
|
||||
|
||||
shutil.copy("c:/Python26/Microsoft.VC90.CRT.manifest", "dist/Microsoft.VC90.CRT.manifest")
|
||||
shutil.copy("c:/Python26/msvcr90.dll", "dist/msvcr90.dll")
|
||||
|
||||
try:
|
||||
main()
|
||||
except:
|
||||
|
||||
@@ -40,6 +40,7 @@ if __name__ == "__main__":
|
||||
|
||||
files += glob.glob("launcher/*.rpy")
|
||||
files += glob.glob("common/*.rpy")
|
||||
files += glob.glob("common/*.rpym")
|
||||
files += glob.glob("common/_layout/*.rpym")
|
||||
files += glob.glob("common/_compat/*.rpym")
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
# This file contains warpers that are used by ATL. They need to be defined
|
||||
# early, so Ren'Py knows about them when parsing other files.
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init -1210 python:
|
||||
|
||||
# This is called when script_version is set, to immediately
|
||||
@@ -26,6 +29,17 @@ init -1210 python:
|
||||
store.offscreenleft = Position(xpos=0.0, xanchor=1.0)
|
||||
store.offscreenright = Position(xpos=1.0, xanchor=0.0)
|
||||
|
||||
if version <= (6, 10, 2):
|
||||
# Before 6.11, we used the image placement to handle
|
||||
# the location of things on the screen.
|
||||
style.image_placement.xpos = 0.5
|
||||
style.image_placement.ypos = 1.0
|
||||
style.image_placement.xanchor = 0.5
|
||||
style.image_placement.yanchor = 1.0
|
||||
|
||||
config.transform_uses_child_position = False
|
||||
config.default_transform = None
|
||||
config.start_scene_black = True
|
||||
|
||||
|
||||
init 1210 python hide::
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
# 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:
|
||||
|
||||
transform reset:
|
||||
alpha 1 rotate None zoom 1 xzoom 1 yzoom 1 align (0, 0) alignaround (0, 0) subpixel False size None crop None
|
||||
|
||||
# These are positions that can be used inside at clauses. We set
|
||||
# them up here so that they can be used throughout the program.
|
||||
transform left:
|
||||
@@ -27,14 +34,18 @@ init -1110:
|
||||
transform offscreenright:
|
||||
xpos 1.0 xanchor 0.0 ypos 1.0 yanchor 1.0
|
||||
|
||||
transform default:
|
||||
alpha 1 rotate None zoom 1 xzoom 1 yzoom 1 align (0, 0) alignaround (0, 0) subpixel False size None crop None
|
||||
xpos 0.5 xanchor 0.5 ypos 1.0 yanchor 1.0
|
||||
|
||||
python:
|
||||
config.default_transform = default
|
||||
|
||||
|
||||
init -1110 python:
|
||||
|
||||
_define = define = object()
|
||||
|
||||
# Positions ##############################################################
|
||||
|
||||
|
||||
# Transitions ############################################################
|
||||
|
||||
# Simple transitions.
|
||||
@@ -176,3 +187,7 @@ init 1110 python:
|
||||
|
||||
if not hasattr(store, 'centered'):
|
||||
centered = Character(None, what_style="centered_text", window_style="centered_window")
|
||||
|
||||
# This is necessary to ensure that config.default_transform works.
|
||||
if config.default_transform:
|
||||
config.default_transform._show()
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
# This contains code to choose between OpenGL and Software rendering, when
|
||||
# a system supports both.
|
||||
|
||||
init -1024:
|
||||
screen _gl_test:
|
||||
frame:
|
||||
xalign .5
|
||||
yalign .33
|
||||
|
||||
xpadding 20
|
||||
ypadding 20
|
||||
|
||||
has vbox
|
||||
|
||||
label _(u"Graphics Acceleration")
|
||||
|
||||
null height 10
|
||||
|
||||
textbutton _(u"Automatically Choose"):
|
||||
size_group "gl"
|
||||
action SetField(persistent, "_gl_test", "auto")
|
||||
textbutton _(u"Prefer Software Renderer"):
|
||||
size_group "gl"
|
||||
action SetField(persistent, "_gl_test", "sw")
|
||||
textbutton _(u"Prefer OpenGL Renderer"):
|
||||
size_group "gl"
|
||||
action SetField(persistent, "_gl_test", "gl")
|
||||
|
||||
null height 10
|
||||
|
||||
textbutton _(u"Continue"):
|
||||
size_group "gl"
|
||||
action Return(True)
|
||||
|
||||
init -1024 python:
|
||||
# The image that we fill the screen with in GL-test mode.
|
||||
config.gl_test_image = "black"
|
||||
|
||||
class __GLTest(renpy.Displayable):
|
||||
"""
|
||||
This counts the number of times it's been rendered, and
|
||||
the number of seconds it's been displayed, and uses them
|
||||
to make the decisions as to if OpenGL is working or not.
|
||||
"""
|
||||
|
||||
def __init__(self, frames, fps, timeout):
|
||||
super(__GLTest, self).__init__()
|
||||
|
||||
self.target = 1.0 * frames / fps
|
||||
self.frames = frames
|
||||
self.timeout = timeout
|
||||
|
||||
self.times = [ ]
|
||||
self.success = False
|
||||
|
||||
def render(self, width, height, st, at):
|
||||
self.times.append(st)
|
||||
|
||||
renpy.redraw(self, 0)
|
||||
|
||||
if len(self.times) >= self.frames:
|
||||
if (self.times[-1] - self.times[-self.frames]) < self.target:
|
||||
self.success = True
|
||||
renpy.timeout(0)
|
||||
|
||||
rv = renpy.Render(width, height)
|
||||
return rv
|
||||
|
||||
def event(self, ev, x, y, st):
|
||||
|
||||
if self.success:
|
||||
return True
|
||||
|
||||
if st > self.timeout:
|
||||
return False
|
||||
|
||||
renpy.timeout(self.timeout - st)
|
||||
|
||||
|
||||
def __gl_prefer_renderers(renderers):
|
||||
"""
|
||||
Forces the current renderer to be renderer, one of gl or sw.
|
||||
"""
|
||||
|
||||
if renpy.display.prefer_renderers == renderers:
|
||||
return
|
||||
|
||||
renpy.display.prefer_renderers = renderers
|
||||
renpy.display_reset()
|
||||
|
||||
def __gl_prompt():
|
||||
"""
|
||||
Decides if we want to prompt the user to enable OpenGL mode.
|
||||
If so, shows a screen that allows the user to alter the
|
||||
OpenGL setting.
|
||||
"""
|
||||
|
||||
if not renpy.display.interface.safe_mode:
|
||||
return
|
||||
|
||||
__gl_prefer_renderers("sw")
|
||||
|
||||
renpy.call_screen("_gl_test")
|
||||
|
||||
renpy.display.interface.safe_mode = False
|
||||
|
||||
def __gl_test():
|
||||
"""
|
||||
Makes the decision as to if we should use GL or SW mode.
|
||||
"""
|
||||
|
||||
import os
|
||||
if "RENPY_RENDERER" in os.environ:
|
||||
return
|
||||
|
||||
# Our decision survives a restart.
|
||||
if _restart:
|
||||
return
|
||||
|
||||
# If GL is disabled, don't bother.
|
||||
if not config.gl_enable:
|
||||
return
|
||||
|
||||
__gl_prompt()
|
||||
|
||||
if persistent._gl_test == "gl":
|
||||
__gl_prefer_renderers("gl,sw")
|
||||
return
|
||||
|
||||
if persistent._gl_test == "sw":
|
||||
__gl_prefer_renderers("sw")
|
||||
return
|
||||
|
||||
__gl_prefer_renderers("gl,sw")
|
||||
|
||||
ui.pausebehavior(0)
|
||||
ui.interact(suppress_underlay=True, suppress_overlay=True)
|
||||
|
||||
# If GL is able to render FRAMES frames at FPS fps in less
|
||||
# than DELAY seconds, we consider it to be operational, and
|
||||
# continue in GL mode. Otherwise, we rever to software
|
||||
# rendering mode.
|
||||
FRAMES = 5
|
||||
FPS = 15
|
||||
DELAY = 1
|
||||
|
||||
renpy.transition(Dissolve(DELAY), always=True, force=True)
|
||||
ui.add(__GLTest(FRAMES, FPS, DELAY))
|
||||
result = ui.interact(suppress_overlay=True, suppress_underlay=True)
|
||||
|
||||
if result:
|
||||
__gl_prefer_renderers("gl,sw")
|
||||
else:
|
||||
__gl_prefer_renderers("sw")
|
||||
|
||||
# Init-time code:
|
||||
# Make a guess as to what modes we should be in.
|
||||
if persistent._gl_test is None:
|
||||
persistent._gl_test = "auto"
|
||||
|
||||
if persistent._gl_test == "sw":
|
||||
renpy.display.prefer_renderers = "sw"
|
||||
|
||||
|
||||
label _gl_test:
|
||||
|
||||
# Show the test image.
|
||||
scene
|
||||
show expression config.gl_test_image
|
||||
|
||||
$ __gl_test()
|
||||
|
||||
# Hide the test image.
|
||||
scene
|
||||
|
||||
return
|
||||
|
||||
+98
-17
@@ -1,7 +1,5 @@
|
||||
# Copyright 2004-2007 PyTom
|
||||
#
|
||||
# Please see the LICENSE.txt distributed with Ren'Py for permission to
|
||||
# copy and modify.
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init -1105 python:
|
||||
|
||||
@@ -58,6 +56,21 @@ init -1105 python hide:
|
||||
joystick_preferences=layout.classic_joystick_preferences,
|
||||
)
|
||||
|
||||
if renpy.has_screen("main_menu"):
|
||||
defaults["main_menu"] = layout.screen_main_menu
|
||||
|
||||
if renpy.has_screen("load") and renpy.has_screen("save"):
|
||||
defaults["load_save"] = layout.screen_load_save
|
||||
|
||||
if renpy.has_screen("yesno_prompt"):
|
||||
defaults["yesno_prompt"] = layout.screen_yesno_prompt
|
||||
|
||||
if renpy.has_screen("preferences"):
|
||||
defaults["preferences"] = layout.screen_preferences
|
||||
|
||||
if renpy.has_screen("joystick_preferences"):
|
||||
defaults["joystick_preferences"] = layout.screen_joystick_preferences
|
||||
|
||||
for k, v in defaults.iteritems():
|
||||
if k not in layout.provided:
|
||||
v()
|
||||
@@ -288,13 +301,14 @@ init -1105 python hide:
|
||||
|
||||
|
||||
@layout
|
||||
def imagemap_main_menu(ground, selected, hotspots):
|
||||
def imagemap_main_menu(ground, selected, hotspots, idle=None, variant=None):
|
||||
renpy.load_module("_layout/imagemap_main_menu")
|
||||
|
||||
config.main_menu_ground = ground
|
||||
config.main_menu_selected = selected
|
||||
config.main_menu_hotspots = hotspots
|
||||
|
||||
config.main_menu_ground[variant] = ground
|
||||
config.main_menu_selected[variant] = selected
|
||||
config.main_menu_hotspots[variant] = hotspots
|
||||
config.main_menu_idle[variant] = idle
|
||||
|
||||
@layout
|
||||
def imagemap_navigation(ground, idle, hover, selected_idle, selected_hover,
|
||||
hotspots):
|
||||
@@ -334,21 +348,88 @@ init -1105 python hide:
|
||||
|
||||
@layout
|
||||
def imagemap_load_save(ground, idle, hover, selected_idle, selected_hover,
|
||||
hotspots):
|
||||
hotspots, variant=None):
|
||||
|
||||
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
|
||||
|
||||
config.load_save_ground[variant] = ground
|
||||
config.load_save_idle[variant] = idle
|
||||
config.load_save_hover[variant] = hover
|
||||
config.load_save_selected_idle[variant] = selected_idle
|
||||
config.load_save_selected_hover[variant] = selected_hover
|
||||
config.load_save_hotspots[variant] = hotspots
|
||||
|
||||
@layout
|
||||
def screen_main_menu():
|
||||
renpy.load_module("_layout/screen_main_menu")
|
||||
|
||||
@layout
|
||||
def screen_load_save():
|
||||
renpy.load_module("_layout/screen_load_save")
|
||||
|
||||
@layout
|
||||
def screen_preferences():
|
||||
renpy.load_module("_layout/screen_preferences")
|
||||
|
||||
@layout
|
||||
def screen_joystick_preferences():
|
||||
renpy.load_module("_layout/screen_joystick_preferences")
|
||||
|
||||
@layout
|
||||
def screen_yesno_prompt():
|
||||
renpy.load_module("_layout/screen_yesno_prompt")
|
||||
|
||||
layout.ARE_YOU_SURE = u"Are you sure?"
|
||||
layout.DELETE_SAVE = u"Are you sure you want to delete this save?"
|
||||
layout.OVERWRITE_SAVE = u"Are you sure you want to overwrite your save?"
|
||||
layout.LOADING = u"Loading will lose unsaved progress.\nAre you sure you want to do this?"
|
||||
layout.QUIT = u"Are you sure you want to quit?"
|
||||
layout.MAIN_MENU = u"Are you sure you want to return to the main menu?\nThis will lose unsaved progress."
|
||||
|
||||
@layout
|
||||
def yesno_screen(message, yes=None, no=None):
|
||||
"""
|
||||
:doc: other
|
||||
|
||||
This causes the a yes/no prompt screen with the given message
|
||||
to be displayed. The screen will be hidden when the user hits
|
||||
yes or no.
|
||||
|
||||
`message`
|
||||
The message that will be displayed.
|
||||
|
||||
`yes`
|
||||
An action that is run when the user chooses yes.
|
||||
|
||||
`no`
|
||||
An action that is run when the user chooses no.
|
||||
"""
|
||||
|
||||
|
||||
if renpy.has_screen("yesno_prompt"):
|
||||
|
||||
yes_action = [ Hide("yesno_prompt") ]
|
||||
no_action = [ Hide("yesno_prompt") ]
|
||||
|
||||
if yes is not None:
|
||||
yes_action.append(yes)
|
||||
if no is not None:
|
||||
no_action.append(no)
|
||||
|
||||
renpy.show_screen(
|
||||
"yesno_prompt",
|
||||
message=message,
|
||||
yes_action=yes_action,
|
||||
no_action=no_action)
|
||||
|
||||
renpy.restart_interaction()
|
||||
|
||||
return
|
||||
|
||||
if renpy.invoke_in_new_context(layout.yesno_prompt, None, message):
|
||||
if yes is not None:
|
||||
yes()
|
||||
else:
|
||||
if no is not None:
|
||||
no()
|
||||
|
||||
|
||||
+121
-40
@@ -1,7 +1,5 @@
|
||||
# Copyright 2004-2007 PyTom
|
||||
#
|
||||
# Please see the LICENSE.txt distributed with Ren'Py for permission to
|
||||
# copy and modify.
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
# This file consists of renpy functions that aren't expected to be
|
||||
# touched by the user too much. We reserve the _ prefix for names
|
||||
@@ -49,11 +47,26 @@ init -1180 python:
|
||||
# preference when the game is first run.
|
||||
config.default_text_cps = None
|
||||
|
||||
# If not None, the default value of afm_time
|
||||
config.default_afm_time = None
|
||||
|
||||
# If not None, the default value of afm_enable
|
||||
config.default_afm_enable = None
|
||||
|
||||
# Should we automatically define images?
|
||||
config.automatic_images = None
|
||||
|
||||
# Prefixes to strip from automatic images.
|
||||
config.automatic_images_strip = [ ]
|
||||
|
||||
# A save to automatically load, if it exists.
|
||||
config.auto_load = None
|
||||
|
||||
# Layers to clear when entering the menus.
|
||||
config.menu_clear_layers = [ ]
|
||||
|
||||
# Should we start the game with scene black or just scene?
|
||||
config.start_scene_black = False
|
||||
|
||||
# This is updated to give the user an idea of where a save is
|
||||
# taking place.
|
||||
@@ -77,8 +90,20 @@ init -1180 python:
|
||||
|
||||
|
||||
def _default_empty_window():
|
||||
store.narrator("", interact=False)
|
||||
|
||||
who = _last_say_who
|
||||
|
||||
if who is not None:
|
||||
who = eval(who)
|
||||
|
||||
if who is None:
|
||||
who = narrator
|
||||
|
||||
if isinstance(who, NVLCharacter):
|
||||
nvl_show_core()
|
||||
else:
|
||||
store.narrator("", interact=False)
|
||||
|
||||
config.empty_window = _default_empty_window
|
||||
|
||||
style.skip_indicator = Style(style.default, heavy=True, help='The skip indicator.')
|
||||
@@ -126,27 +151,28 @@ init -1180 python:
|
||||
|
||||
config.help = None
|
||||
|
||||
def _help():
|
||||
if not config.help:
|
||||
def _help(help=None):
|
||||
|
||||
if help is None:
|
||||
help = config.help
|
||||
|
||||
if help is None:
|
||||
return
|
||||
|
||||
if renpy.has_label(config.help):
|
||||
renpy.call_in_new_context(config.help)
|
||||
if renpy.has_label(help):
|
||||
renpy.call_in_new_context(help)
|
||||
return
|
||||
|
||||
_preferences.fullscreen = False
|
||||
|
||||
try:
|
||||
import webbrowser
|
||||
webbrowser.open_new("file:///" + config.basedir + "/" + config.help)
|
||||
webbrowser.open_new("file:///" + config.basedir + "/" + help)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
init -1180 python hide:
|
||||
|
||||
# Called to make a screenshot happen.
|
||||
def screenshot():
|
||||
def _screenshot():
|
||||
import os.path
|
||||
import os
|
||||
import __main__
|
||||
@@ -177,17 +203,28 @@ init -1180 python hide:
|
||||
except:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
|
||||
|
||||
init -1180 python hide:
|
||||
|
||||
def dump_styles():
|
||||
if config.developer:
|
||||
renpy.style.write_text("styles.txt")
|
||||
|
||||
# This is run when entering the game menu.
|
||||
config.game_menu_action = None
|
||||
|
||||
def invoke_game_menu():
|
||||
if renpy.context()._menu:
|
||||
renpy.jump("_noisy_return")
|
||||
if renpy.context()._main_menu:
|
||||
return
|
||||
else:
|
||||
renpy.jump("_noisy_return")
|
||||
else:
|
||||
renpy.call_in_new_context('_game_menu')
|
||||
if config.game_menu_action:
|
||||
renpy.display.behavior.run(config.game_menu_action)
|
||||
else:
|
||||
renpy.call_in_new_context('_game_menu')
|
||||
|
||||
def keymap_toggle_skipping():
|
||||
if renpy.context()._menu:
|
||||
@@ -219,7 +256,7 @@ init -1180 python hide:
|
||||
# the launcher.
|
||||
km = renpy.Keymap(
|
||||
rollback = renpy.rollback,
|
||||
screenshot = screenshot,
|
||||
screenshot = _screenshot,
|
||||
toggle_fullscreen = renpy.toggle_fullscreen,
|
||||
toggle_music = renpy.toggle_music,
|
||||
toggle_skip = keymap_toggle_skipping,
|
||||
@@ -387,6 +424,17 @@ init 1180 python:
|
||||
if config.default_text_cps is not None:
|
||||
_preferences.text_cps = config.default_text_cps
|
||||
|
||||
if config.default_afm_time is not None:
|
||||
_preferences.afm_time = config.default_afm_time
|
||||
|
||||
if config.default_afm_enable is not None:
|
||||
_preferences.afm_enable = config.default_afm_enable
|
||||
_preferences.using_afm_enable = True
|
||||
else:
|
||||
_preferences.afm_enable = True
|
||||
_preferences.using_afm_enable = False
|
||||
|
||||
|
||||
if config.developer:
|
||||
|
||||
def _inspector(l):
|
||||
@@ -398,7 +446,6 @@ init 1180 python:
|
||||
ui.text("Style Inspector")
|
||||
ui.text("")
|
||||
|
||||
|
||||
if not l:
|
||||
ui.text("Nothing to inspect.")
|
||||
|
||||
@@ -528,10 +575,13 @@ label _enter_menu:
|
||||
renpy.movie_stop(only_fullscreen=True)
|
||||
renpy.take_screenshot((config.thumbnail_width, config.thumbnail_height))
|
||||
|
||||
for i in config.menu_clear_layers:
|
||||
renpy.scene(layer=i)
|
||||
|
||||
renpy.context()._menu = True
|
||||
|
||||
# This may be changed, if we are already in the main menu.
|
||||
renpy.context().main_menu = False
|
||||
renpy.context()._main_menu = False
|
||||
renpy.context_dynamic("main_menu")
|
||||
renpy.context_dynamic("_window_subtitle")
|
||||
renpy.context_dynamic("_window")
|
||||
@@ -571,9 +621,14 @@ label _game_menu(_game_menu_screen=_game_menu_screen):
|
||||
$ 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"
|
||||
|
||||
if renpy.has_screen(_game_menu_screen):
|
||||
$ renpy.show_screen(_game_menu_screen)
|
||||
$ ui.interact()
|
||||
jump _noisy_return
|
||||
|
||||
jump expression _game_menu_screen
|
||||
|
||||
@@ -615,7 +670,7 @@ label _noisy_return:
|
||||
# Return to the game.
|
||||
label _return:
|
||||
|
||||
if renpy.context().main_menu:
|
||||
if renpy.context()._main_menu:
|
||||
$ renpy.transition(config.game_main_transition)
|
||||
jump _main_menu_screen
|
||||
|
||||
@@ -624,7 +679,6 @@ label _return:
|
||||
return
|
||||
|
||||
label _confirm_quit:
|
||||
call _enter_menu from _call__enter_menu_3
|
||||
|
||||
if renpy.has_label("confirm_quit"):
|
||||
jump expression "confirm_quit"
|
||||
@@ -650,6 +704,7 @@ init -1180 python hide:
|
||||
# after_load.
|
||||
label _after_load:
|
||||
$ renpy.context()._menu = False
|
||||
$ renpy.context()._main_menu = False
|
||||
|
||||
if config.after_load_transition:
|
||||
$ renpy.transition(config.after_load_transition, force=True)
|
||||
@@ -666,17 +721,25 @@ label _start:
|
||||
|
||||
python hide:
|
||||
renpy.context()._menu = False
|
||||
renpy.context()._main_menu = False
|
||||
|
||||
for i in config.start_callbacks:
|
||||
i()
|
||||
|
||||
|
||||
$ renpy.block_rollback()
|
||||
|
||||
call _gl_test
|
||||
|
||||
call _load_reload_game from _call__load_reload_game_1
|
||||
|
||||
if not _restart and config.auto_load and renpy.can_load(config.auto_load):
|
||||
$ renpy.load(config.auto_load)
|
||||
|
||||
scene black
|
||||
|
||||
if config.start_scene_black:
|
||||
scene black
|
||||
else:
|
||||
scene
|
||||
|
||||
if not _restart:
|
||||
$ ui.pausebehavior(0)
|
||||
$ ui.interact(suppress_underlay=True, suppress_overlay=True)
|
||||
@@ -700,20 +763,29 @@ label _start:
|
||||
$ renpy.music.stop()
|
||||
|
||||
# Clean out any residual scene from the splashscreen.
|
||||
scene black
|
||||
|
||||
if _restart is None:
|
||||
$ renpy.transition(config.end_splash_transition)
|
||||
if config.start_scene_black:
|
||||
scene black
|
||||
else:
|
||||
$ renpy.transition(_restart[0])
|
||||
jump expression _restart[1]
|
||||
scene
|
||||
|
||||
|
||||
# This has to be python, to deal with a case where _restart may
|
||||
# change across a shift-reload.
|
||||
python:
|
||||
if _restart is None:
|
||||
renpy.transition(config.end_splash_transition)
|
||||
else:
|
||||
renpy.transition(_restart[0])
|
||||
renpy.jump(_restart[1])
|
||||
|
||||
label _invoke_main_menu:
|
||||
|
||||
if _restart:
|
||||
$ renpy.call_in_new_context(_restart[2])
|
||||
else:
|
||||
$ renpy.call_in_new_context("_main_menu")
|
||||
# Again, this has to be python.
|
||||
python:
|
||||
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.
|
||||
@@ -729,7 +801,7 @@ label _main_menu(_main_menu_screen="_main_menu_screen"):
|
||||
renpy.dynamic("_load_prompt")
|
||||
_load_prompt = False
|
||||
|
||||
renpy.context().main_menu = True
|
||||
renpy.context()._main_menu = True
|
||||
store.main_menu = True
|
||||
|
||||
jump expression _main_menu_screen
|
||||
@@ -743,11 +815,11 @@ label _main_menu_screen:
|
||||
jump expression "main_menu"
|
||||
|
||||
# New name.
|
||||
if renpy.has_label("main_menu_screen"):
|
||||
elif renpy.has_label("main_menu_screen"):
|
||||
jump expression "main_menu_screen"
|
||||
|
||||
# Compatibility name.
|
||||
if renpy.has_label("_library_main_menu"):
|
||||
elif renpy.has_label("_library_main_menu"):
|
||||
jump expression "_library_main_menu"
|
||||
|
||||
return
|
||||
@@ -777,6 +849,15 @@ init 1180 python hide:
|
||||
name = ( shortfn, )
|
||||
for sep in seps:
|
||||
name = tuple(j for i in name for j in i.split(sep))
|
||||
|
||||
# Strip name components.
|
||||
while name:
|
||||
for i in config.automatic_images_strip:
|
||||
if name[0] == i:
|
||||
name = name[1:]
|
||||
break
|
||||
else:
|
||||
break
|
||||
|
||||
# Only names of 2 components or more.
|
||||
if len(name) < 2:
|
||||
|
||||
+2
-4
@@ -1,7 +1,5 @@
|
||||
# Copyright 2008 PyTom
|
||||
#
|
||||
# Please see the LICENSE.txt distributed with Ren'Py for permission to
|
||||
# copy and modify.
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
# 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
|
||||
|
||||
+4
-1
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
# This file contains code that sets up the various mixers, based on how
|
||||
# the user sets config.has_music, .has_sound, and .has_voice.
|
||||
|
||||
@@ -18,7 +21,7 @@ init -1130 python hide:
|
||||
for i in xrange(0, 8):
|
||||
renpy.music.register_channel(i)
|
||||
|
||||
renpy.music.register_channel("movie", "music", False, stop_on_mute=False)
|
||||
renpy.music.register_channel("movie", "music", False, stop_on_mute=False, buffer_queue=False)
|
||||
|
||||
# Set up default names for some of the channels.
|
||||
renpy.music.alias_channel(0, "sound")
|
||||
|
||||
+77
-25
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
# 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
|
||||
@@ -76,8 +79,47 @@ init -1100 python:
|
||||
return s[nvl_variant]
|
||||
else:
|
||||
return s
|
||||
|
||||
def nvl_show_core():
|
||||
|
||||
def nvl_show_screen(screen_name, **scope):
|
||||
"""
|
||||
Shows an nvl-mode screen. Returns the "who" widget.
|
||||
"""
|
||||
|
||||
widget_properties = { }
|
||||
dialogue = [ ]
|
||||
|
||||
for i, entry in enumerate(nvl_list):
|
||||
if not entry:
|
||||
continue
|
||||
|
||||
who, what, kwargs = entry
|
||||
|
||||
if i == len(nvl_list) - 1:
|
||||
who_id = "who"
|
||||
what_id = "what"
|
||||
window_id = "window"
|
||||
|
||||
else:
|
||||
who_id = "who%d" % i
|
||||
what_id = "what%d" % i
|
||||
window_id = "window%d" % i
|
||||
|
||||
widget_properties[who_id] = kwargs["who_args"]
|
||||
widget_properties[what_id] = kwargs["what_args"]
|
||||
widget_properties[window_id] = kwargs["window_args"]
|
||||
|
||||
dialogue.append((who, what, who_id, what_id, window_id))
|
||||
|
||||
renpy.show_screen(screen_name, _transient=True, _widget_properties=widget_properties, dialogue=dialogue, **scope)
|
||||
renpy.shown_window()
|
||||
|
||||
return renpy.get_widget(screen_name, "what")
|
||||
|
||||
def nvl_show_core(who=None, what=None):
|
||||
|
||||
# Screen version.
|
||||
if renpy.has_screen("nvl"):
|
||||
return nvl_show_screen("nvl")
|
||||
|
||||
if renpy.in_rollback():
|
||||
nvl_window = __s(style.nvl_window)['rollback']
|
||||
@@ -191,12 +233,14 @@ init -1100 python:
|
||||
else:
|
||||
checkpoint = True
|
||||
|
||||
renpy.display_say(nvl_show_core,
|
||||
checkpoint=checkpoint,
|
||||
**display_args)
|
||||
renpy.display_say(
|
||||
who,
|
||||
what,
|
||||
nvl_show_core,
|
||||
checkpoint=checkpoint,
|
||||
**display_args)
|
||||
|
||||
def do_done(self, who, what):
|
||||
|
||||
if self.clear:
|
||||
nvl_clear()
|
||||
|
||||
@@ -224,29 +268,37 @@ init -1100 python:
|
||||
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))
|
||||
if renpy.has_screen("nvl_choice"):
|
||||
|
||||
for i in nvl_list:
|
||||
if not i:
|
||||
continue
|
||||
# Screen version.
|
||||
nvl_show_screen("nvl_choice", items=items)
|
||||
|
||||
who, what, kw = i
|
||||
rv = renpy.show_display_say(who, what, **kw)
|
||||
else:
|
||||
|
||||
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),
|
||||
)
|
||||
# Traditional version.
|
||||
ui.layer("transient")
|
||||
ui.clear()
|
||||
ui.close()
|
||||
|
||||
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()
|
||||
|
||||
|
||||
+1367
File diff suppressed because it is too large
Load Diff
+119
-16
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
# This file contains code that creates a few new statements. We'll
|
||||
# also describe here the API for defining your own statements.
|
||||
#
|
||||
@@ -122,7 +125,7 @@ python early hide:
|
||||
if p["channel"] is not None:
|
||||
channel = eval(p["channel"])
|
||||
else:
|
||||
channel = 7
|
||||
channel = "music"
|
||||
|
||||
renpy.music.play(eval(p["file"]),
|
||||
fadeout=eval(p["fadeout"]),
|
||||
@@ -134,19 +137,24 @@ python early hide:
|
||||
def predict_play_music(p):
|
||||
return [ ]
|
||||
|
||||
def lint_play_music(p):
|
||||
def lint_play_music(p, channel="music"):
|
||||
|
||||
file = _try_eval(p["file"], 'filename')
|
||||
if p["channel"] is not None:
|
||||
_try_eval(p["channel"], 'channel')
|
||||
|
||||
if p["channel"] is not None:
|
||||
channel = _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)
|
||||
|
||||
if isinstance(fn, basestring):
|
||||
try:
|
||||
if not renpy.music.playable(fn, channel):
|
||||
renpy.error("%r is not loadable" % fn)
|
||||
except:
|
||||
pass
|
||||
|
||||
renpy.statements.register('play music',
|
||||
parse=parse_play_music,
|
||||
execute=execute_play_music,
|
||||
@@ -188,7 +196,7 @@ python early hide:
|
||||
if p["channel"] is not None:
|
||||
channel = eval(p["channel"])
|
||||
else:
|
||||
channel = 7
|
||||
channel = "music"
|
||||
|
||||
renpy.music.queue(
|
||||
eval(p["file"]),
|
||||
@@ -226,7 +234,7 @@ python early hide:
|
||||
if p["channel"] is not None:
|
||||
channel = eval(p["channel"])
|
||||
else:
|
||||
channel = 7
|
||||
channel = "music"
|
||||
|
||||
renpy.music.stop(fadeout=eval(p["fadeout"]), channel=channel)
|
||||
|
||||
@@ -243,7 +251,7 @@ python early hide:
|
||||
if p["channel"] is not None:
|
||||
channel = eval(p["channel"])
|
||||
else:
|
||||
channel = 0
|
||||
channel = "sound"
|
||||
|
||||
fadeout = eval(p["fadeout"]) or 0
|
||||
|
||||
@@ -251,17 +259,20 @@ python early hide:
|
||||
fadeout=fadeout,
|
||||
fadein=eval(p["fadein"]),
|
||||
channel=channel)
|
||||
|
||||
|
||||
def lint_play_sound(p, lint_play_music=lint_play_music):
|
||||
return lint_play_music(p, channel="sound")
|
||||
|
||||
renpy.statements.register('play sound',
|
||||
parse=parse_play_music,
|
||||
execute=execute_play_sound,
|
||||
lint=lint_play_music)
|
||||
lint=lint_play_sound)
|
||||
|
||||
def execute_queue_sound(p):
|
||||
if p["channel"] is not None:
|
||||
channel = eval(p["channel"])
|
||||
else:
|
||||
channel = 0
|
||||
channel = "sound"
|
||||
|
||||
renpy.sound.queue(eval(p["file"]), channel=channel)
|
||||
|
||||
@@ -275,7 +286,7 @@ python early hide:
|
||||
if p["channel"] is not None:
|
||||
channel = eval(p["channel"])
|
||||
else:
|
||||
channel = 0
|
||||
channel = "sound"
|
||||
|
||||
fadeout = eval(p["fadeout"]) or 0
|
||||
|
||||
@@ -331,7 +342,7 @@ python early hide:
|
||||
if not renpy.music.channel_defined(channel):
|
||||
renpy.error("channel %r is not defined" % channel)
|
||||
|
||||
lint_play_music(p)
|
||||
lint_play_music(p, channel)
|
||||
|
||||
def lint_stop_generic(p):
|
||||
channel = eval(p["channel"])
|
||||
@@ -436,7 +447,6 @@ python early hide:
|
||||
parse=parse_pause,
|
||||
lint=lint_pause,
|
||||
execute=execute_pause)
|
||||
|
||||
|
||||
|
||||
init -1200 python:
|
||||
@@ -450,3 +460,96 @@ init -1200 python:
|
||||
except:
|
||||
renpy.error('unable to evaluate %s %r' % (what, e))
|
||||
|
||||
##############################################################################
|
||||
# Screen-related statements.
|
||||
|
||||
python early hide:
|
||||
|
||||
def parse_show_call_screen(l):
|
||||
|
||||
# Parse a name.
|
||||
name = l.require(l.name)
|
||||
|
||||
# Parse a parameter list. (name -> expression string)
|
||||
parameters = { }
|
||||
|
||||
if l.match(r"\("):
|
||||
|
||||
while True:
|
||||
pname = l.name()
|
||||
if not pname:
|
||||
break
|
||||
|
||||
l.require(r"=")
|
||||
|
||||
expr = l.delimited_python(",)")
|
||||
|
||||
if not expr:
|
||||
l.error("expected expression.")
|
||||
|
||||
parameters[pname] = expr
|
||||
|
||||
if not l.match(r','):
|
||||
break
|
||||
|
||||
l.require(r'\)')
|
||||
l.expect_eol()
|
||||
|
||||
return dict(name=name, parameters=parameters)
|
||||
|
||||
def parse_hide_screen(l):
|
||||
name = l.require(l.name)
|
||||
|
||||
l.expect_eol()
|
||||
|
||||
return dict(name=name)
|
||||
|
||||
def execute_show_screen(p):
|
||||
|
||||
name = p["name"]
|
||||
parameters = p["parameters"]
|
||||
|
||||
kwargs = { }
|
||||
|
||||
for k, v in parameters.iteritems():
|
||||
kwargs[k] = eval(v)
|
||||
|
||||
renpy.show_screen(name, **kwargs)
|
||||
|
||||
def execute_call_screen(p):
|
||||
name = p["name"]
|
||||
parameters = p["parameters"]
|
||||
|
||||
kwargs = { }
|
||||
|
||||
for k, v in parameters.iteritems():
|
||||
kwargs[k] = eval(v)
|
||||
|
||||
store._return = renpy.call_screen(name, **kwargs)
|
||||
|
||||
def execute_hide_screen(p):
|
||||
name = p["name"]
|
||||
renpy.hide_screen(name)
|
||||
|
||||
def lint_screen(p):
|
||||
name = p["name"]
|
||||
if not renpy.has_screen(name):
|
||||
renpy.error("Screen %s does not exist." % name)
|
||||
|
||||
|
||||
renpy.statements.register("show screen",
|
||||
parse=parse_show_call_screen,
|
||||
execute=execute_show_screen,
|
||||
lint=lint_screen)
|
||||
|
||||
renpy.statements.register("call screen",
|
||||
parse=parse_show_call_screen,
|
||||
execute=execute_call_screen,
|
||||
lint=lint_screen)
|
||||
|
||||
renpy.statements.register("hide screen",
|
||||
parse=parse_hide_screen,
|
||||
execute=execute_hide_screen)
|
||||
|
||||
|
||||
|
||||
|
||||
+20
-17
@@ -1,7 +1,5 @@
|
||||
# Copyright 2004-2008 PyTom
|
||||
#
|
||||
# Please see the LICENSE.txt distributed with Ren'Py for permission to
|
||||
# copy and modify.
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
# This file is responsible for creating and defining the default styles
|
||||
# used by the system.
|
||||
@@ -24,10 +22,14 @@ init -1200 python hide:
|
||||
# Style Declarations #################################################
|
||||
|
||||
style.default = Style(None, help='root of style hierarchy')
|
||||
style.text = Style(style.default, help='style of text')
|
||||
|
||||
style.fixed = Style(style.default, help='fixed layouts')
|
||||
style.hbox = Style(style.default, help='horizontal boxes')
|
||||
style.vbox = Style(style.default, help='vertical boxes')
|
||||
|
||||
style.grid = Style(style.default, help='grid layouts')
|
||||
style.side = Style(style.default, help='side layouts')
|
||||
|
||||
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')
|
||||
@@ -52,7 +54,8 @@ init -1200 python hide:
|
||||
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 = Style(style.default, help='style of an input control')
|
||||
style.input_text = Style(style.input, 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')
|
||||
|
||||
@@ -60,8 +63,10 @@ init -1200 python hide:
|
||||
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.hotspot = Style(style.default, help='default style of hotspots inside imagemaps')
|
||||
style.hotbar = Style(style.default, help='default style of hotbars inside imagemaps')
|
||||
style.imagemap_button = style.hotspot
|
||||
|
||||
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')
|
||||
|
||||
@@ -78,6 +83,8 @@ init -1200 python hide:
|
||||
style.list_spacer = Style(style.default)
|
||||
style.list_text = Style(style.default)
|
||||
|
||||
style.tile = Style(style.default, help='default style of tile')
|
||||
|
||||
# The base styles that can be customized by themes.
|
||||
|
||||
style.frame = Style(style.default, help='base style for frames.')
|
||||
@@ -215,16 +222,9 @@ init -1090 python:
|
||||
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
|
||||
@@ -240,7 +240,7 @@ init -1090 python:
|
||||
# Menus.
|
||||
style.menu_choice.idle_color = "#0ff"
|
||||
style.menu_choice.hover_color = "#ff0"
|
||||
style.input_text.color = "#ff0"
|
||||
style.input.color = "#ff0"
|
||||
|
||||
# Styles used by centered.
|
||||
style.centered_window.xalign = 0.5
|
||||
@@ -297,7 +297,10 @@ init -1090 python:
|
||||
style.list_text.color = "#000"
|
||||
style.list_text.size = 14
|
||||
style.list_spacer.xminimum = 15
|
||||
|
||||
|
||||
# Tile
|
||||
style.tile.clipping = True
|
||||
|
||||
|
||||
######################################################################
|
||||
|
||||
|
||||
+4
-10
@@ -1,7 +1,5 @@
|
||||
# Copyright 2004-2008 PyTom
|
||||
#
|
||||
# Please see the LICENSE.txt distributed with Ren'Py for permission to
|
||||
# copy and modify.
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init -1110 python:
|
||||
|
||||
@@ -277,7 +275,7 @@ init -1110 python hide:
|
||||
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),
|
||||
@@ -288,10 +286,7 @@ init -1110 python hide:
|
||||
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,
|
||||
@@ -301,7 +296,6 @@ init -1110 python hide:
|
||||
button_menu = None,
|
||||
rounded_window = True,
|
||||
outline_bars = False,
|
||||
|
||||
mm_root = None,
|
||||
gm_root = None):
|
||||
|
||||
|
||||
+20
-5
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
# 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
|
||||
@@ -27,15 +30,17 @@ init -1120:
|
||||
_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
|
||||
|
||||
_last_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):
|
||||
@@ -44,6 +49,14 @@ init -1120:
|
||||
|
||||
_voice.sustain = True
|
||||
|
||||
# Call this to replay the last bit of voice.
|
||||
def voice_replay():
|
||||
renpy.sound.play(_last_voice_play, channel="voice")
|
||||
|
||||
# Returns true if we can replay the voice.
|
||||
def voice_can_replay():
|
||||
return _last_voice_play != None
|
||||
|
||||
python hide:
|
||||
|
||||
# basics: True if the game will have voice.
|
||||
@@ -57,9 +70,11 @@ init -1120:
|
||||
return
|
||||
|
||||
if _voice.play and not config.skipping:
|
||||
renpy.sound.play(_voice.play, channel=2)
|
||||
renpy.sound.play(_voice.play, channel="voice")
|
||||
store._last_voice_play = _voice.play
|
||||
elif not _voice.sustain:
|
||||
renpy.sound.stop(channel=2)
|
||||
renpy.sound.stop(channel="voice")
|
||||
store._last_voice_play = _voice.play
|
||||
|
||||
_voice.play = None
|
||||
_voice.sustain = False
|
||||
@@ -68,7 +83,7 @@ init -1120:
|
||||
config.say_sustain_callbacks.append(voice_sustain)
|
||||
|
||||
def voice_afm_callback():
|
||||
return not renpy.sound.is_playing(channel=2)
|
||||
return not renpy.sound.is_playing(channel="voice")
|
||||
|
||||
config.afm_callback = voice_afm_callback
|
||||
|
||||
|
||||
Binary file not shown.
@@ -1,4 +1,5 @@
|
||||
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain. Glyphs imported from Arev fonts are (c) Tavmjung Bah (see below)
|
||||
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
|
||||
Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)
|
||||
|
||||
Bitstream Vera Fonts Copyright
|
||||
------------------------------
|
||||
@@ -95,4 +96,4 @@ 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 $
|
||||
$Id: LICENSE 2133 2007-11-28 02:46:28Z lechimp $
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2008 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
######################################################################
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2008 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init:
|
||||
python:
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2008 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init -1170 python hide:
|
||||
|
||||
config.old_names['Quit'] = 'Quit Game'
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2008 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
# Copyright 2004-2006 PyTom
|
||||
#
|
||||
# Please see the LICENSE.txt distributed with Ren'Py for permission to
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2008 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python hide:
|
||||
|
||||
style.menu_button = Style(style.button, heavy=True, help='Buttons that are part of the main or game menus.')
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2008 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
# Copyright 2004-2007 PyTom
|
||||
#
|
||||
# Please see the LICENSE.txt distributed with Ren'Py for permission to
|
||||
|
||||
+12
-9
@@ -1,6 +1,5 @@
|
||||
|
||||
# This file contains the developer screen, which contains tools that might
|
||||
# be of interest to people making Ren'Py games.
|
||||
# This file contains code that helps support the development of Ren'Py
|
||||
# games.
|
||||
|
||||
label _developer_screen:
|
||||
|
||||
@@ -9,7 +8,7 @@ label _developer_screen:
|
||||
ui.window(style=style.gm_root)
|
||||
ui.null()
|
||||
|
||||
ui.frame(xpos=10, ypos=10, style=style.menu_frame)
|
||||
ui.frame(xalign=.025, yalign=.05, style=style.menu_frame)
|
||||
ui.vbox(box_first_spacing=10)
|
||||
layout.label(u"Developer Menu", None)
|
||||
|
||||
@@ -20,7 +19,7 @@ label _developer_screen:
|
||||
layout.button(u"Variable Viewer", None, clicked=ui.jumps("_debugger_screen"), size_group=sg)
|
||||
layout.button(u"Theme Test", None, clicked=ui.jumps("_theme_test"), size_group=sg)
|
||||
layout.button(u"Style Hierarchy", None, clicked=ui.jumps("_style_hierarchy"), size_group=sg)
|
||||
layout.button(u"FPS Meter", None, clicked=ui.jumps("_fps_meter"), size_group=sg)
|
||||
# layout.button(u"FPS Meter", None, clicked=ui.jumps("_fps_meter"), size_group=sg)
|
||||
layout.button(u"Image Location Picker", None, clicked=ui.jumps("_image_location_picker"), size_group=sg)
|
||||
|
||||
ui.close()
|
||||
@@ -93,7 +92,7 @@ label _theme_test:
|
||||
return ""
|
||||
|
||||
toggle_var = True
|
||||
adj = ui.adjustment(100, 25, page=25)
|
||||
adj = ui.adjustment(100, 25, page=25, adjustable=True)
|
||||
|
||||
while True:
|
||||
|
||||
@@ -370,8 +369,8 @@ init python:
|
||||
sr = renpy.render(Solid("#0ff4"), w, h, st, at)
|
||||
rv.blit(sr, (minx, miny))
|
||||
|
||||
text.append("Imagemap rectangle: %r" % ((minx, miny, maxx, maxy),))
|
||||
text.append("Cropping rectangle: %r" % ((minx, miny, w, h),))
|
||||
# text.append("Imagemap rectangle: %r" % ((minx, miny, maxx, maxy),))
|
||||
text.append("Rectangle: %r" % ((minx, miny, w, h),))
|
||||
|
||||
if self.mouse:
|
||||
mx, my = self.mouse
|
||||
@@ -466,4 +465,8 @@ label _image_location_picker:
|
||||
# ...
|
||||
|
||||
renpy.jump("_image_location_picker")
|
||||
|
||||
|
||||
|
||||
init python:
|
||||
config.underlay.append(im.Tile("_transparent_tile.png"))
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
layout.provides('joystick_preferences')
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
layout.provides('load_save')
|
||||
@@ -185,8 +188,11 @@ init python:
|
||||
else:
|
||||
base += 1
|
||||
|
||||
return base + int((int(filename) - 1) / per_page)
|
||||
|
||||
try:
|
||||
return base + int((int(filename) - 1) / per_page)
|
||||
except:
|
||||
return base
|
||||
|
||||
# Processes a screenshot.
|
||||
def _file_picker_process_screenshot(s):
|
||||
return s
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
layout.provides('main_menu')
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
layout.provides('navigation')
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
layout.provides('preferences')
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
# Styles
|
||||
@@ -130,7 +133,7 @@ init python:
|
||||
a channel.
|
||||
"""
|
||||
|
||||
def __init__(self, name, mixer, enable='True', sound='None', channel=0):
|
||||
def __init__(self, name, mixer, enable='True', sound='None', channel="sound"):
|
||||
"""
|
||||
@param name: The name of this preference, as shown to the user.
|
||||
|
||||
@@ -357,15 +360,18 @@ init python hide:
|
||||
_VolumePreference(u"Music Volume",
|
||||
'music',
|
||||
'config.has_music')
|
||||
|
||||
_VolumePreference(u"Sound Volume",
|
||||
'sfx',
|
||||
'config.has_sound',
|
||||
'config.sample_sound')
|
||||
'config.sample_sound',
|
||||
'sound')
|
||||
|
||||
_VolumePreference(u'Voice Volume',
|
||||
'voice',
|
||||
'config.has_voice',
|
||||
'config.sample_voice',
|
||||
2)
|
||||
'voice')
|
||||
|
||||
_JumpPreference(u'Joystick...',
|
||||
'joystick_preferences_screen',
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python hide:
|
||||
|
||||
layout.provides('yesno_prompt')
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
layout.provides('main_menu')
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
layout.provides('navigation')
|
||||
|
||||
@@ -1,46 +1,69 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
class _ImageMapper(object):
|
||||
|
||||
def __init__(self, screen, ground, idle, hover, selected_idle, selected_hover, hotspots):
|
||||
def __init__(self, screen, ground, idle, hover, selected_idle, selected_hover, hotspots, navigation=True, variant=None):
|
||||
|
||||
self.idle = idle
|
||||
self.hover = hover
|
||||
self.selected_idle = selected_idle
|
||||
self.selected_hover = selected_hover
|
||||
# If the argument is a dict, look up the screen in that dict, and
|
||||
# return the result. Otherwise, just return the result.
|
||||
def maybe_variant(a):
|
||||
if isinstance(a, dict):
|
||||
if variant in a:
|
||||
return a[variant]
|
||||
else:
|
||||
return a[None]
|
||||
return a
|
||||
|
||||
ground = maybe_variant(ground)
|
||||
|
||||
self.idle = maybe_variant(idle) or ground
|
||||
self.hover = maybe_variant(hover) or self.idle
|
||||
self.selected_idle = maybe_variant(selected_idle) or self.idle
|
||||
self.selected_hover = maybe_variant(selected_hover) or self.hover
|
||||
|
||||
self.hotspots = { }
|
||||
for (x1, y1, x2, y2, name) in hotspots:
|
||||
for (x1, y1, x2, y2, name) in maybe_variant(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)
|
||||
self.remaining_hotspots = set(self.hotspots.keys())
|
||||
|
||||
if navigation:
|
||||
|
||||
# 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)
|
||||
|
||||
if navigation:
|
||||
|
||||
# Display any navigation buttons that exist.
|
||||
for e in config.game_menu:
|
||||
screen_ = e[0]
|
||||
name = e[1]
|
||||
act = e[2]
|
||||
enable = e[3]
|
||||
# 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
|
||||
if not eval(enable):
|
||||
continue
|
||||
|
||||
self.button(name, act, screen == screen_)
|
||||
self.button(name, act, screen == screen_)
|
||||
|
||||
def button(self, name, clicked, selected, keymap={}):
|
||||
|
||||
if name not in self.hotspots:
|
||||
return None
|
||||
|
||||
self.remaining_hotspots.discard(name)
|
||||
|
||||
x1, y1, x2, y2 = self.hotspots[name]
|
||||
|
||||
if clicked is None:
|
||||
@@ -74,6 +97,8 @@ init python:
|
||||
if name not in self.hotspots:
|
||||
return
|
||||
|
||||
self.remaining_hotspots.discard(name)
|
||||
|
||||
x1, y1, x2, y2 = self.hotspots[name]
|
||||
|
||||
ui.bar(
|
||||
@@ -94,6 +119,9 @@ init python:
|
||||
thumb=None,
|
||||
thumb_shadow=None,
|
||||
thumb_offset=0)
|
||||
|
||||
def nothing(self, name):
|
||||
self.remaining_hotspots.discard(name)
|
||||
|
||||
def close(self):
|
||||
ui.close()
|
||||
|
||||
@@ -1,22 +1,25 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
layout.provides('load_save')
|
||||
renpy.load_module("_layout/imagemap_common")
|
||||
|
||||
# The ground image.
|
||||
config.load_save_ground = None
|
||||
config.load_save_ground = { }
|
||||
|
||||
# The idle image.
|
||||
config.load_save_idle = None
|
||||
config.load_save_idle = { }
|
||||
|
||||
# The hover image.
|
||||
config.load_save_hover = None
|
||||
config.load_save_hover = { }
|
||||
|
||||
# The selected idle image.
|
||||
config.load_save_selected_idle = None
|
||||
config.load_save_selected_idle = { }
|
||||
|
||||
# The selected hover image.
|
||||
config.load_save_selected_hover = None
|
||||
config.load_save_selected_hover = { }
|
||||
|
||||
# The hotspots. Each hotspot is defined by a tuple giving:
|
||||
# - The x-coordinate of the left side.
|
||||
@@ -24,7 +27,7 @@ init python:
|
||||
# - 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
|
||||
config.load_save_hotspots = { }
|
||||
|
||||
# Define styles
|
||||
style.file_picker_text = Style(style.large_button_text, help="text inside a file picker entry")
|
||||
@@ -148,8 +151,11 @@ init python:
|
||||
else:
|
||||
base += 1
|
||||
|
||||
return base + int((int(filename) - 1) / per_page)
|
||||
|
||||
try:
|
||||
return base + int((int(filename) - 1) / per_page)
|
||||
except:
|
||||
return base
|
||||
|
||||
# Processes a screenshot.
|
||||
def _file_picker_process_screenshot(s):
|
||||
return s
|
||||
@@ -159,8 +165,13 @@ init python:
|
||||
|
||||
hotspots = set()
|
||||
|
||||
for (x1, y1, x2, y2, name) in config.load_save_hotspots:
|
||||
hotspots.add(name)
|
||||
if isinstance(config.load_save_hotspots, dict):
|
||||
for d in config.load_save_hotspots.values():
|
||||
for (x1, y1, x2, y2, name) in d:
|
||||
hotspots.add(name)
|
||||
else:
|
||||
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)
|
||||
@@ -249,7 +260,8 @@ init python:
|
||||
config.load_save_hover,
|
||||
config.load_save_selected_idle,
|
||||
config.load_save_selected_hover,
|
||||
config.load_save_hotspots)
|
||||
config.load_save_hotspots,
|
||||
variant=screen)
|
||||
|
||||
|
||||
def tb(enabled, label, clicked, selected):
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
layout.provides('main_menu')
|
||||
|
||||
renpy.load_module("_layout/imagemap_common")
|
||||
|
||||
# The ground image.
|
||||
config.main_menu_ground = None
|
||||
config.main_menu_ground = { }
|
||||
|
||||
# The selected image.
|
||||
config.main_menu_selected = None
|
||||
# The selected/hover image.
|
||||
config.main_menu_selected = { }
|
||||
|
||||
# The idle image.
|
||||
config.main_menu_idle = { }
|
||||
|
||||
# The hotspots. Each hotspot is defined by a tuple giving:
|
||||
# - The x-coordinate of the left side.
|
||||
# - The y-coordinate of the top side.
|
||||
@@ -16,7 +23,10 @@ init python:
|
||||
# - 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 = [ ]
|
||||
config.main_menu_hotspots = { }
|
||||
|
||||
# This can be set from user code to define the main menu variant to use.
|
||||
_main_menu_variant = None
|
||||
|
||||
label main_menu_screen:
|
||||
|
||||
@@ -28,28 +38,42 @@ label main_menu_screen:
|
||||
# Show the background.
|
||||
ui.window(style='mm_root')
|
||||
ui.null()
|
||||
|
||||
rv = renpy.imagemap(
|
||||
|
||||
ime = _ImageMapper(
|
||||
None,
|
||||
config.main_menu_ground,
|
||||
config.main_menu_idle,
|
||||
config.main_menu_selected,
|
||||
config.main_menu_idle,
|
||||
config.main_menu_selected,
|
||||
config.main_menu_hotspots,
|
||||
mouse="mainmenu")
|
||||
|
||||
for e in config.main_menu:
|
||||
name = e[0]
|
||||
act = e[1]
|
||||
enable = e[2]
|
||||
navigation=False,
|
||||
variant=_main_menu_variant)
|
||||
|
||||
if name == rv:
|
||||
for e in config.main_menu:
|
||||
if len(e) == 4:
|
||||
name, act, enabled, shown = e
|
||||
else:
|
||||
name, act, enabled = e
|
||||
shown = "True"
|
||||
|
||||
if not eval(shown):
|
||||
ime.nothing(name)
|
||||
|
||||
if isinstance(act, basestring):
|
||||
act = ui.jumpsoutofcontext(act)
|
||||
act()
|
||||
if not eval(enabled):
|
||||
act = None
|
||||
|
||||
break
|
||||
else:
|
||||
ui.jumpsoutofcontext(rv)()
|
||||
if isinstance(act, basestring):
|
||||
act = ui.jumpsoutofcontext(act)
|
||||
|
||||
ime.button(name, act, False)
|
||||
|
||||
for i in list(ime.remaining_hotspots):
|
||||
ime.button(i, ui.jumpsoutofcontext(i), None)
|
||||
|
||||
ime.close()
|
||||
ui.interact(mouse='mainmenu')
|
||||
|
||||
jump main_menu_screen
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
layout.provides('navigation')
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
layout.provides('preferences')
|
||||
@@ -74,12 +77,12 @@ init python:
|
||||
ime.button("Joystick", ui.jumps("joystick_preferences_screen"), False)
|
||||
|
||||
def play_sound():
|
||||
renpy.sound.play(config.sample_sound)
|
||||
renpy.music.play(config.sample_sound, channel="sound")
|
||||
|
||||
ime.button("Sound Test", play_sound, False)
|
||||
|
||||
def play_voice():
|
||||
renpy.sound.play(config.sample_sound, channel=2)
|
||||
renpy.music.play(config.sample_sound, channel="voice")
|
||||
|
||||
ime.button("Voice Test", play_voice, False)
|
||||
|
||||
@@ -121,11 +124,14 @@ init python:
|
||||
_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)
|
||||
|
||||
if config.has_music:
|
||||
ime.bar("Music Volume", 128, int(_preferences.get_volume('music') * 128), set_music)
|
||||
if config.has_sound:
|
||||
ime.bar("Sound Volume", 128, int(_preferences.get_volume('sfx') * 128), set_sound)
|
||||
if config.has_voice:
|
||||
ime.bar("Voice Volume", 128, int(_preferences.get_volume('voice') * 128), set_voice)
|
||||
|
||||
ime.close()
|
||||
ui.interact(mouse="gamemenu")
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python hide:
|
||||
|
||||
layout.provides('yesno_prompt')
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
layout.provides('preferences')
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
layout.provides('joystick_preferences')
|
||||
|
||||
label joystick_preferences_screen:
|
||||
|
||||
$ renpy.show_screen('joystick_preferences')
|
||||
$ ui.interact()
|
||||
|
||||
jump _noisy_return
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
layout.provides('load_save')
|
||||
|
||||
label load_screen:
|
||||
|
||||
$ renpy.show_screen('load')
|
||||
$ ui.interact()
|
||||
jump _noisy_return
|
||||
|
||||
label save_screen:
|
||||
|
||||
$ renpy.show_screen('save')
|
||||
$ ui.interact()
|
||||
jump _noisy_return
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
layout.provides('main_menu')
|
||||
|
||||
label main_menu_screen:
|
||||
|
||||
$ renpy.show_screen("main_menu")
|
||||
$ ui.interact()
|
||||
|
||||
return
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
layout.provides('preferences')
|
||||
|
||||
label preferences_screen:
|
||||
|
||||
$ renpy.show_screen('preferences')
|
||||
$ ui.interact()
|
||||
|
||||
jump _noisy_return
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python hide:
|
||||
|
||||
layout.provides('yesno_prompt')
|
||||
|
||||
def yesno_prompt(screen, message):
|
||||
return renpy.call_screen('yesno_prompt', message=message, yes_action=Return(True), no_action=Return(False))
|
||||
|
||||
layout.yesno_prompt = yesno_prompt
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
layout.provides('load_save')
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
layout.provides('preferences')
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 436 B |
+22
-12
@@ -175,13 +175,19 @@ def main():
|
||||
"_renpybidi.c",
|
||||
"renpybidicore.c",
|
||||
"_renpybidi.pyx",
|
||||
"_renpy_pysdlgl.c",
|
||||
"_renpy_pysdlgl.pyx",
|
||||
"_renpy_tegl.c",
|
||||
"maketegl.py",
|
||||
"maketegl.txt",
|
||||
]
|
||||
|
||||
for i in module_files:
|
||||
files.append('module/' + i)
|
||||
|
||||
more_files.append('python25.dll')
|
||||
more_files.append('msvcr71.dll')
|
||||
more_files.append('python26.dll')
|
||||
more_files.append('msvcr90.dll')
|
||||
more_files.append('Microsoft.VC90.CRT.manifest')
|
||||
files.extend(tree('renpy'))
|
||||
more_files.extend(tree('renpy.app'))
|
||||
more_files.append('renpy.code')
|
||||
@@ -193,15 +199,17 @@ def main():
|
||||
files.extend(tree('template'))
|
||||
# files.extend(tree('tools'))
|
||||
|
||||
files.append('doc/index.html')
|
||||
files.append('doc/common.css')
|
||||
files.append('doc/docs.css')
|
||||
files.append('doc/monobook.css')
|
||||
files.append('doc/monobook2.css')
|
||||
files.append('doc/shared.css')
|
||||
files.extend(tree('doc/reference'))
|
||||
files.extend(tree('doc/tutorials'))
|
||||
files.extend(tree('doc/images'))
|
||||
files.extend(tree('doc'))
|
||||
|
||||
# files.append('doc/index.html')
|
||||
# files.append('doc/common.css')
|
||||
# files.append('doc/docs.css')
|
||||
# files.append('doc/monobook.css')
|
||||
# files.append('doc/monobook2.css')
|
||||
# files.append('doc/shared.css')
|
||||
# files.extend(tree('doc/reference'))
|
||||
# files.extend(tree('doc/tutorials'))
|
||||
# files.extend(tree('doc/images'))
|
||||
|
||||
files.sort()
|
||||
more_files.sort()
|
||||
@@ -211,8 +219,9 @@ def main():
|
||||
zipup("dists/" + prefix + "-sdk.zip", prefix, files + more_files)
|
||||
print "----"
|
||||
tarup("dists/" + prefix + "-sdk.tar.bz2", prefix, files + more_files)
|
||||
print "----"
|
||||
tarup("dists/" + prefix + "-source.tar.bz2", prefix, files)
|
||||
|
||||
print "----"
|
||||
# Make the 7zip.
|
||||
os.chdir("dists")
|
||||
os.system("unzip " + prefix + "-sdk.zip")
|
||||
@@ -232,6 +241,7 @@ def main():
|
||||
print "Did you run me with renpython -OO?"
|
||||
print "Was ming using the right crt?"
|
||||
print "Did you update renpy.py and launcher/script_version.rpy?"
|
||||
print "Did you run with a RENPY_SCALE_FACTOR?"
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
#bodyContent {
|
||||
font-size: medium;
|
||||
background: #fff;
|
||||
margin-left: 20%;
|
||||
margin-right: 20%;
|
||||
padding: 1.5em;
|
||||
}
|
||||
|
||||
.editsection {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#bodyContent a.external {
|
||||
background: none;
|
||||
padding-right: 0px;
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
wget http://www.renpy.org/w/skins/common/shared.css -O shared.css
|
||||
wget http://www.renpy.org/w/skins/monobook/main.css -O monobook.css
|
||||
wget 'http://www.renpy.org/w/index.php?title=MediaWiki:Common.css&usemsgcache=yes&action=raw&ctype=text/css&smaxage=18000' -O common.css
|
||||
wget 'http://www.renpy.org/w/index.php?title=MediaWiki:Monobook.css&usemsgcache=yes&action=raw&ctype=text/css&smaxage=18000' -O monobook2.css
|
||||
|
||||
rm -Rf www.renpy.org
|
||||
wget -e robots=off -m -I /wiki/renpy/doc/reference/,/wiki/renpy/doc/tutorials/,/w/images -m http://www.renpy.org/wiki/renpy/doc/index
|
||||
|
||||
rm -Rf images
|
||||
mkdir -p images
|
||||
cp `find www.renpy.org -name \*.png -type f` images
|
||||
|
||||
No jpgs yet.
|
||||
cp `find www.renpy.org -name \*.jpg -type f` images
|
||||
|
||||
rm -Rf reference tutorials
|
||||
python2.5 process.py
|
||||
-164
@@ -1,164 +0,0 @@
|
||||
#!/usr/bin/python2.4
|
||||
|
||||
import sys
|
||||
import os.path
|
||||
|
||||
# import xml.etree.ElementTree as elementtree
|
||||
# sys.modules['elementtree'] = elementtree
|
||||
|
||||
# from elementtree.ElementTree import ElementTree, Element, SubElement, tostring, fromstring
|
||||
# from elementtidy import TidyHTMLTreeBuilder
|
||||
|
||||
from xml.etree.ElementTree import ElementTree, Element, SubElement, tostring, fromstring
|
||||
from elementtidy import TidyHTMLTreeBuilder
|
||||
|
||||
# Removes everyhing we don't care about from the wikipages.
|
||||
def remove_crap(n):
|
||||
|
||||
classes = n.attrib.get("class", "").split()
|
||||
|
||||
if "editsection" in classes:
|
||||
return None
|
||||
if "printfooter" in classes:
|
||||
return None
|
||||
if "magnify" in classes:
|
||||
return None
|
||||
|
||||
|
||||
id = n.attrib.get("id", None)
|
||||
|
||||
if "catlinks" == id:
|
||||
return None
|
||||
|
||||
newchildren = [ ]
|
||||
for i in n:
|
||||
i = remove_crap(i)
|
||||
if i is not None:
|
||||
newchildren.append(i)
|
||||
|
||||
n[:] = newchildren
|
||||
|
||||
if n.tag == "a" and not n.text:
|
||||
n.text = "SPACE REMOVE ME PLEASE"
|
||||
|
||||
return n
|
||||
|
||||
def process(src, dst, nav):
|
||||
|
||||
if nav:
|
||||
nav = fromstring(nav)
|
||||
|
||||
base = "../" * (len(dst.split('/')) - 1)
|
||||
|
||||
if dst.startswith("./"):
|
||||
base = ""
|
||||
|
||||
# tree = TidyHTMLTreeBuilder.parse(src)
|
||||
|
||||
|
||||
code = file(src).read()
|
||||
code = code.replace(" ", u"\u00a0".encode("utf-8"))
|
||||
tree = fromstring(code)
|
||||
|
||||
XHTML = "{http://www.w3.org/1999/xhtml}"
|
||||
|
||||
for elem in tree.getiterator():
|
||||
if elem.tag.startswith(XHTML):
|
||||
elem.tag = elem.tag[len(XHTML):]
|
||||
|
||||
by_id = dict()
|
||||
|
||||
for n in tree.getiterator():
|
||||
if "id" in n.attrib:
|
||||
by_id[n.attrib["id"]] = n
|
||||
|
||||
html = Element("html")
|
||||
head = SubElement(html, "head")
|
||||
title = SubElement(head, "title")
|
||||
title.text = tree.findtext(".//title")
|
||||
head = SubElement(head, "link", rel="stylesheet", href=base + "shared.css")
|
||||
head = SubElement(head, "link", rel="stylesheet", href=base + "monobook.css")
|
||||
head = SubElement(head, "link", rel="stylesheet", href=base + "common.css")
|
||||
head = SubElement(head, "link", rel="stylesheet", href=base + "monobook2.css")
|
||||
head = SubElement(head, "link", rel="stylesheet", href=base + "docs.css")
|
||||
|
||||
body = SubElement(html, "body")
|
||||
# gw = SubElement(body, "div", id="globalWrapper")
|
||||
# cc = SubElement(gw, "div", id="column-content")
|
||||
# content = SubElement(cc, "div", id="content")
|
||||
|
||||
bc = by_id['bodyContent']
|
||||
body.append(bc)
|
||||
|
||||
bc.remove(by_id['siteSub'])
|
||||
bc.remove(by_id['contentSub'])
|
||||
bc.remove(by_id['jump-to-nav'])
|
||||
|
||||
for n in bc.findall(".//a"):
|
||||
if "href" in n.attrib:
|
||||
href = n.attrib['href']
|
||||
|
||||
if href.startswith("/wiki/Image:") or href.startswith("/w/"):
|
||||
n.attrib['href'] = 'http://www.renpy.org' + href
|
||||
continue
|
||||
|
||||
if href.startswith("#"):
|
||||
continue
|
||||
|
||||
if href.startswith("http:"):
|
||||
continue
|
||||
|
||||
href = href.replace("/wiki/renpy/doc/", base)
|
||||
|
||||
if "#" in href:
|
||||
href.replace("#", ".html#")
|
||||
else:
|
||||
href += ".html"
|
||||
|
||||
n.attrib['href'] = href
|
||||
|
||||
for n in bc.findall(".//img"):
|
||||
src = n.attrib["src"]
|
||||
src = base + "images" + src[src.rfind("/"):]
|
||||
n.attrib["src"] = src
|
||||
|
||||
|
||||
if nav:
|
||||
hr = Element("hr")
|
||||
bc[:] = [ nav ] + list(bc) + [ hr, nav ]
|
||||
|
||||
html = remove_crap(html)
|
||||
|
||||
doc = tostring(html)
|
||||
doc = doc.replace("SPACE REMOVE ME PLEASE", "")
|
||||
file(dst, "w").write(doc)
|
||||
|
||||
|
||||
def process_dir(src, dst, nav):
|
||||
try:
|
||||
os.makedirs(dst)
|
||||
except:
|
||||
pass
|
||||
|
||||
for fn in os.listdir(src):
|
||||
if os.path.isdir(src + "/" + fn):
|
||||
continue
|
||||
|
||||
if fn.endswith(".1"):
|
||||
continue
|
||||
|
||||
print src + "/" + fn
|
||||
|
||||
process(src + "/" + fn, dst + "/" + fn + ".html", nav)
|
||||
|
||||
nav = '<p class="docnav"><a href="../index.html">documentation index</a></p>'
|
||||
process_dir("www.renpy.org/wiki/renpy/doc/tutorials", "tutorials", nav)
|
||||
|
||||
nav = '<p class="docnav"><a href="../index.html">documentation index</a> ◦ <a href="Reference_Manual.html">reference manual</a> ◦ <a href="Function_Index.html">function index</a></p>'
|
||||
process_dir("www.renpy.org/wiki/renpy/doc/reference", "reference", nav)
|
||||
|
||||
nav = '<p class="docnav"><a href="../../index.html">documentation index</a> ◦ <a href="../Reference_Manual.html">reference manual</a> ◦ <a href="../Function_Index.html">function index</a></p>'
|
||||
process_dir("www.renpy.org/wiki/renpy/doc/reference/functions", "reference/functions", nav)
|
||||
|
||||
nav = ''
|
||||
process_dir("www.renpy.org/wiki/renpy/doc/", ".", nav)
|
||||
@@ -0,0 +1,329 @@
|
||||
|
||||
# http://www.csn.ul.ie/~caolan/publink/winresdump/winresdump/doc/pefile.html
|
||||
# Contains a reasonable description of the format.
|
||||
|
||||
import struct
|
||||
import sys
|
||||
import array
|
||||
import pefile
|
||||
|
||||
# This class performs various operations on memory-loaded binary files,
|
||||
# including modifications.
|
||||
class BinFile(object):
|
||||
|
||||
def set_u32(self, addr, value):
|
||||
self.a[addr+0] = (value >> 0) & 0xff
|
||||
self.a[addr+1] = (value >> 8) & 0xff
|
||||
self.a[addr+2] = (value >> 16) & 0xff
|
||||
self.a[addr+3] = (value >> 24) & 0xff
|
||||
|
||||
def u32(self):
|
||||
addr = self.addr
|
||||
rv = self.a[addr]
|
||||
rv |= self.a[addr+1] << 8
|
||||
rv |= self.a[addr+2] << 16
|
||||
rv |= self.a[addr+3] << 24
|
||||
self.addr += 4
|
||||
return rv
|
||||
|
||||
def u16(self):
|
||||
addr = self.addr
|
||||
rv = self.a[addr]
|
||||
rv |= self.a[addr+1] << 8
|
||||
self.addr += 2
|
||||
return rv
|
||||
|
||||
def u8(self):
|
||||
rv = self.a[self.addr]
|
||||
self.addr += 1
|
||||
return rv
|
||||
|
||||
def name(self):
|
||||
c = self.u16()
|
||||
|
||||
rv = u""
|
||||
for i in range(c):
|
||||
rv += unichr(self.u16())
|
||||
|
||||
return rv
|
||||
|
||||
def seek(self, addr):
|
||||
self.addr = addr
|
||||
|
||||
def tostring(self):
|
||||
return self.a.tostring()
|
||||
|
||||
def substring(self, start, len):
|
||||
return self.a[start:start+len].tostring()
|
||||
|
||||
def __init__(self, data):
|
||||
self.a = array.array('B')
|
||||
self.a.fromstring(data)
|
||||
|
||||
##############################################################################
|
||||
# These functions parse data out of the file. In these functions, offset is
|
||||
# relative to the start of the file.
|
||||
|
||||
# The virtual address of the resource segment.
|
||||
resource_virtual = 0
|
||||
|
||||
# This parses a data block out of the resources.
|
||||
def parse_data(bf, offset):
|
||||
bf.seek(offset)
|
||||
data_offset = bf.u32()
|
||||
data_len = bf.u32()
|
||||
code_page = bf.u32()
|
||||
bf.u32()
|
||||
|
||||
l = [ ]
|
||||
|
||||
bf.seek(data_offset - resource_virtual)
|
||||
for i in range(data_len):
|
||||
l.append(chr(bf.u8()))
|
||||
|
||||
return (code_page, "".join(l))
|
||||
|
||||
# This parses a resource directory.
|
||||
def parse_directory(bf, offset):
|
||||
|
||||
bf.seek(offset)
|
||||
char = bf.u32()
|
||||
timedate = bf.u32()
|
||||
major = bf.u16()
|
||||
minor = bf.u16()
|
||||
n_named = bf.u16()
|
||||
n_id = bf.u16()
|
||||
|
||||
entries = [ ]
|
||||
|
||||
for i in range(n_named + n_id):
|
||||
entries.append((bf.u32(), bf.u32()))
|
||||
|
||||
rv = { }
|
||||
|
||||
for name, value in entries:
|
||||
|
||||
if name & 0x80000000:
|
||||
bf.seek((name & 0x7fffffff))
|
||||
name = bf.name()
|
||||
|
||||
if value & 0x80000000:
|
||||
value = parse_directory(bf, value & 0x7fffffff)
|
||||
else:
|
||||
value = parse_data(bf, value)
|
||||
|
||||
rv[name] = value
|
||||
|
||||
return rv
|
||||
|
||||
|
||||
##############################################################################
|
||||
# This utility function displays the tree of resources that have been loaded.
|
||||
def show_resources(d, prefix):
|
||||
|
||||
if not isinstance(d, dict):
|
||||
print prefix, "Codepage", d[0], "length", len(d[1])
|
||||
return
|
||||
|
||||
for k in d:
|
||||
print prefix, k
|
||||
show_resources(d[k], prefix + " ")
|
||||
|
||||
##############################################################################
|
||||
# These functions repack the resources into a new resource segment. Here,
|
||||
# the offset is relative to the start of the resource segment.
|
||||
|
||||
class Packer(object):
|
||||
|
||||
def pack(self, d):
|
||||
self.data = ""
|
||||
self.data_offset = 0
|
||||
|
||||
self.entries = ""
|
||||
self.entries_offset = 0
|
||||
|
||||
head = self.pack_dict(d, 0)
|
||||
|
||||
self.data = ""
|
||||
self.data_offset = len(head) + len(self.entries)
|
||||
|
||||
self.entries = ""
|
||||
self.entries_offset = len(head)
|
||||
|
||||
return self.pack_dict(d, 0) + self.entries + self.data
|
||||
|
||||
def pack_name(self, s):
|
||||
rv = self.data_offset + len(self.data)
|
||||
|
||||
l = len(s)
|
||||
s = s.encode("utf-16le")
|
||||
self.data += struct.pack("<H", l) + s + "\0\0"
|
||||
|
||||
return rv
|
||||
|
||||
def pack_tuple(self, t):
|
||||
codepage, data = t
|
||||
|
||||
rv = len(self.entries) + self.entries_offset
|
||||
|
||||
if len(self.data) % 2:
|
||||
self.data += "P"
|
||||
|
||||
daddr = len(self.data) + self.data_offset
|
||||
|
||||
self.entries += struct.pack("<IIII", daddr + resource_virtual, len(data), codepage, 0)
|
||||
self.data += data
|
||||
|
||||
# if len(self.data) % 1 == 1:
|
||||
# self.data += 'P'
|
||||
|
||||
return rv
|
||||
|
||||
def pack_dict(self, d, offset):
|
||||
name_entries = sorted((a, b) for a, b in d.iteritems() if isinstance(a, unicode))
|
||||
id_entries = sorted((a, b) for a, b in d.iteritems() if isinstance(a, int))
|
||||
|
||||
rv = struct.pack("<IIHHHH", 0, 0, 4, 0, len(name_entries), len(id_entries))
|
||||
|
||||
offset += len(rv) + (len(name_entries) + len(id_entries)) * 8
|
||||
|
||||
rest = ""
|
||||
|
||||
for (name, value) in name_entries + id_entries:
|
||||
if isinstance(name, unicode):
|
||||
name = 0x80000000 | self.pack_name(name)
|
||||
|
||||
if isinstance(value, dict):
|
||||
addr = offset | 0x80000000
|
||||
packed = self.pack_dict(value, offset)
|
||||
offset += len(packed)
|
||||
rest += packed
|
||||
else:
|
||||
addr = self.pack_tuple(value)
|
||||
|
||||
rv += struct.pack("<II", name, addr)
|
||||
|
||||
return rv + rest
|
||||
|
||||
##############################################################################
|
||||
# This loads in an icon file, and returns a dictionary that is suitable for
|
||||
# use in the resources of an exe file.
|
||||
def load_icon(fn):
|
||||
f = BinFile(file(fn, "rb").read())
|
||||
|
||||
f.seek(0)
|
||||
f.u16()
|
||||
f.u16()
|
||||
count = f.u16()
|
||||
|
||||
rv = { }
|
||||
rv[3] = { }
|
||||
|
||||
group = struct.pack("HHH", 0, 1, count)
|
||||
|
||||
for i in range(count):
|
||||
width = f.u8()
|
||||
height = f.u8()
|
||||
colors = f.u8()
|
||||
reserved = f.u8()
|
||||
planes = f.u16()
|
||||
bpp = f.u16()
|
||||
size = f.u32()
|
||||
offset = f.u32()
|
||||
|
||||
addr = f.addr
|
||||
f.seek(offset + 16)
|
||||
if not f.u32():
|
||||
f.set_u32(offset + 20, 0)
|
||||
|
||||
rv[3][i + 1] = { 0 : (1252, f.substring(offset, size)) }
|
||||
|
||||
|
||||
group += struct.pack("BBBBHHIH", width, height, colors, reserved,
|
||||
planes, bpp, size, i + 1)
|
||||
|
||||
f.seek(addr)
|
||||
|
||||
rv[14] = { 1 : { 0 : (1252, group) } }
|
||||
|
||||
return rv
|
||||
|
||||
|
||||
##############################################################################
|
||||
# This is the main function that should be called externally, that copies over
|
||||
# the icons.
|
||||
def change_icons(oldexe, icofn):
|
||||
global resource_virtual
|
||||
|
||||
pe = pefile.PE(oldexe)
|
||||
|
||||
for s in pe.sections:
|
||||
if s.Name == ".rsrc\0\0\0":
|
||||
rsrc_section = s
|
||||
break
|
||||
else:
|
||||
raise Exception("Couldn't find resource section.")
|
||||
|
||||
base = rsrc_section.PointerToRawData
|
||||
resource_virtual = rsrc_section.VirtualAddress
|
||||
|
||||
physize = rsrc_section.SizeOfRawData
|
||||
virsize = rsrc_section.Misc_VirtualSize
|
||||
|
||||
f = file(oldexe, "rb")
|
||||
f.seek(base)
|
||||
data = f.read(physize)
|
||||
f.close()
|
||||
|
||||
bf = BinFile(data)
|
||||
|
||||
resources = parse_directory(bf, 0)
|
||||
# show_resources(resources, "")
|
||||
resources.update(load_icon(icofn))
|
||||
# show_resources(resources, "")
|
||||
|
||||
rsrc = Packer().pack(resources)
|
||||
|
||||
alignment = pe.OPTIONAL_HEADER.SectionAlignment
|
||||
|
||||
# print "Alignment is", alignment
|
||||
|
||||
if len(rsrc) % alignment:
|
||||
pad = alignment - (len(rsrc) % alignment)
|
||||
padding = "RENPYVNE" * (pad / 8 + 1)
|
||||
padding = padding[:pad]
|
||||
rsrc += padding
|
||||
|
||||
newsize = len(rsrc)
|
||||
|
||||
rsrc_section.Misc_VirtualSize += newsize - virsize
|
||||
rsrc_section.Misc_PhysicalAddress += newsize - virsize
|
||||
rsrc_section.Misc += newsize - virsize
|
||||
rsrc_section.SizeOfRawData += newsize - physize
|
||||
|
||||
pe.OPTIONAL_HEADER.SizeOfInitializedData += newsize - physize
|
||||
|
||||
# Resource size.
|
||||
pe.OPTIONAL_HEADER.DATA_DIRECTORY[2].Size += newsize - virsize
|
||||
|
||||
# Compute the total size of the image.
|
||||
total_size = 0
|
||||
|
||||
for i in pe.sections:
|
||||
|
||||
sec_size = i.Misc_VirtualSize
|
||||
sec_size = sec_size - (sec_size % alignment) + alignment
|
||||
print sec_size
|
||||
|
||||
total_size += sec_size
|
||||
|
||||
pe.OPTIONAL_HEADER.SizeOfImage = total_size
|
||||
|
||||
return pe.write()[:base] + rsrc
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
f = file(sys.argv[3], "wb")
|
||||
f.write(change_icons(sys.argv[1], sys.argv[2]))
|
||||
f.close()
|
||||
|
||||
@@ -0,0 +1,533 @@
|
||||
import os
|
||||
import os.path
|
||||
import zipfile
|
||||
import tarfile
|
||||
import time
|
||||
import sys
|
||||
import struct
|
||||
import zlib
|
||||
zlib.Z_DEFAULT_COMPRESSION = 9
|
||||
|
||||
import binascii
|
||||
import change_icon
|
||||
|
||||
import argparse
|
||||
|
||||
# The directory containing the project that we'll be distributing.
|
||||
project_path = None
|
||||
|
||||
# The path to the Ren'Py base directory.
|
||||
renpy_base = None
|
||||
|
||||
# A function that is called to give information about what is going
|
||||
# on now.
|
||||
def info(title, body):
|
||||
return
|
||||
|
||||
# A function that is called to give a progress report.
|
||||
def progress(title, total, amount):
|
||||
amount += 1
|
||||
|
||||
if amount % 25 == 0:
|
||||
print title, amount, "of", total
|
||||
|
||||
# A translation function.
|
||||
def _(s):
|
||||
return s
|
||||
|
||||
# These are files that are ignored wherever they are found in a
|
||||
# distribution.
|
||||
ignored_files = (
|
||||
"thumbs.db",
|
||||
"traceback.txt",
|
||||
"errors.txt",
|
||||
"saves"
|
||||
)
|
||||
|
||||
# These are files (and directories) that are ignored when found in
|
||||
# the root directory of the distribution.
|
||||
root_ignored_files = (
|
||||
"common",
|
||||
"renpy",
|
||||
"renpy.code",
|
||||
"python23.dll",
|
||||
"python24.dll",
|
||||
"python25.dll",
|
||||
"msvcr71.dll",
|
||||
"lib",
|
||||
"iliad-icon.png",
|
||||
"manifest.xml",
|
||||
"icon.ico",
|
||||
"icon.icns",
|
||||
"launcherinfo.py",
|
||||
"archived",
|
||||
)
|
||||
|
||||
# Extensions that should be made executable.
|
||||
executable_extensions = (
|
||||
"MacOS",
|
||||
"so",
|
||||
"dylib",
|
||||
".sh",
|
||||
"python",
|
||||
"python.real",
|
||||
)
|
||||
|
||||
class MyZipFile(zipfile.ZipFile):
|
||||
"""
|
||||
Modified ZipFile class that can insert a file into the archive,
|
||||
using a supplied ZipInfo object. Code comes from the writestr
|
||||
and write methods of ZipFile.
|
||||
"""
|
||||
|
||||
def write_file_with_zipinfo(self, filename, zinfo, compress_type=None):
|
||||
"""Put the bytes from filename into the archive under the name
|
||||
arcname."""
|
||||
st = os.stat(filename)
|
||||
|
||||
if compress_type is None:
|
||||
zinfo.compress_type = self.compression
|
||||
else:
|
||||
zinfo.compress_type = compress_type
|
||||
|
||||
zinfo.file_size = st.st_size
|
||||
zinfo.flag_bits = 0x00
|
||||
zinfo.header_offset = self.fp.tell() # Start of header bytes
|
||||
|
||||
self._writecheck(zinfo)
|
||||
self._didModify = True
|
||||
|
||||
fp = open(filename, "rb")
|
||||
|
||||
# Must overwrite CRC and sizes with correct data later
|
||||
zinfo.CRC = CRC = 0
|
||||
zinfo.compress_size = compress_size = 0
|
||||
zinfo.file_size = file_size = 0
|
||||
|
||||
self.fp.write(zinfo.FileHeader())
|
||||
|
||||
if zinfo.compress_type == zipfile.ZIP_DEFLATED:
|
||||
cmpr = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION,
|
||||
zlib.DEFLATED, -15)
|
||||
else:
|
||||
cmpr = None
|
||||
while 1:
|
||||
buf = fp.read(1024 * 64)
|
||||
if not buf:
|
||||
break
|
||||
file_size = file_size + len(buf)
|
||||
CRC = binascii.crc32(buf, CRC)
|
||||
if cmpr:
|
||||
buf = cmpr.compress(buf)
|
||||
compress_size = compress_size + len(buf)
|
||||
self.fp.write(buf)
|
||||
fp.close()
|
||||
if cmpr:
|
||||
buf = cmpr.flush()
|
||||
compress_size = compress_size + len(buf)
|
||||
self.fp.write(buf)
|
||||
zinfo.compress_size = compress_size
|
||||
else:
|
||||
zinfo.compress_size = file_size
|
||||
|
||||
zinfo.CRC = CRC
|
||||
zinfo.file_size = file_size
|
||||
|
||||
# Seek backwards and write CRC and file sizes
|
||||
position = self.fp.tell() # Preserve current position in file
|
||||
self.fp.seek(zinfo.header_offset + 14, 0)
|
||||
self.fp.write(struct.pack("<lLL", zinfo.CRC, zinfo.compress_size,
|
||||
zinfo.file_size))
|
||||
|
||||
self.fp.seek(position, 0)
|
||||
self.filelist.append(zinfo)
|
||||
self.NameToInfo[zinfo.filename] = zinfo
|
||||
|
||||
def tree(
|
||||
src,
|
||||
dest,
|
||||
exclude_suffix=[ ".pyc", "~", ".bak" ],
|
||||
exclude_prefix=[ "#", "." ],
|
||||
exclude_files = set(ignored_files),
|
||||
root_exclude_prefix = [ ],
|
||||
root_exclude_suffix = [ ".py", ".sh", ".app" ],
|
||||
root_exclude_files = set(root_ignored_files),
|
||||
root=False):
|
||||
|
||||
"""
|
||||
Returns a list of source-filename, destination-filename pairs.
|
||||
"""
|
||||
|
||||
if dest[0] != "/":
|
||||
raise Exception("Destination must begin with /: %r" % dest)
|
||||
|
||||
src = src.rstrip('/')
|
||||
dest = dest.rstrip('/')
|
||||
|
||||
def include(fn, is_root):
|
||||
"""
|
||||
Returns True if the file should be included in the list of
|
||||
files we are copying.
|
||||
"""
|
||||
|
||||
for i in exclude_suffix:
|
||||
if fn.endswith(i):
|
||||
return False
|
||||
|
||||
for i in exclude_prefix:
|
||||
if fn.startswith(i):
|
||||
return False
|
||||
|
||||
if fn in exclude_files:
|
||||
return False
|
||||
|
||||
if not root or not is_root:
|
||||
return True
|
||||
|
||||
for i in root_exclude_suffix:
|
||||
if fn.endswith(i):
|
||||
return False
|
||||
|
||||
for i in root_exclude_prefix:
|
||||
if fn.startswith(i):
|
||||
return False
|
||||
|
||||
if fn in root_exclude_files:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
rv = [ ]
|
||||
|
||||
# Walk the tree, including what is necessary.
|
||||
for srcdir, dirs, files in os.walk(src):
|
||||
|
||||
is_root = (srcdir == src)
|
||||
|
||||
srcdir += "/"
|
||||
destdir = dest + srcdir[len(src):]
|
||||
destdir.replace("\\", "/")
|
||||
|
||||
rv.append((srcdir, destdir))
|
||||
|
||||
for fn in files:
|
||||
|
||||
if not include(fn, is_root):
|
||||
continue
|
||||
|
||||
sfn = srcdir + fn
|
||||
dfn = destdir + fn
|
||||
|
||||
rv.append((sfn, dfn))
|
||||
|
||||
dirs[:] = [ i for i in dirs if include(i, is_root) ]
|
||||
|
||||
rv = [ (a.replace("\\", "/"), b.replace("\\", "/")) for a, b in rv ]
|
||||
|
||||
return rv
|
||||
|
||||
|
||||
def make_zip(t, filename, files, file_data):
|
||||
"""
|
||||
This creates `filename`.zip, containing `files`, placed in the
|
||||
`filename` directory. `file_data` is a map from source file to
|
||||
replacement data.
|
||||
"""
|
||||
|
||||
files.sort(key=lambda a : a[1])
|
||||
progress_len = len(files)
|
||||
|
||||
fn = os.path.join(os.path.dirname(project_path), filename)
|
||||
|
||||
zf = MyZipFile(fn + ".zip", "w", zipfile.ZIP_DEFLATED)
|
||||
|
||||
for i, (fn, an) in enumerate(files):
|
||||
|
||||
progress(t, progress_len, i)
|
||||
|
||||
if os.path.isdir(fn):
|
||||
continue
|
||||
|
||||
zi = zipfile.ZipInfo(filename + an)
|
||||
|
||||
s = os.stat(fn)
|
||||
zi.date_time = time.gmtime(s.st_mtime)[:6]
|
||||
zi.compress_type = zipfile.ZIP_DEFLATED
|
||||
zi.create_system = 3
|
||||
|
||||
for i in executable_extensions:
|
||||
if os.path.dirname(fn).endswith(i) or fn.endswith(i):
|
||||
zi.external_attr = long(0100777) << 16
|
||||
break
|
||||
else:
|
||||
zi.external_attr = long(0100666) << 16
|
||||
|
||||
if fn in file_data:
|
||||
data = file_data[fn]
|
||||
zf.writestr(zi, data)
|
||||
else:
|
||||
zf.write_file_with_zipinfo(fn, zi)
|
||||
|
||||
zf.close()
|
||||
|
||||
def make_tar(t, filename, files):
|
||||
"""
|
||||
Makes a tarfile, as above.
|
||||
"""
|
||||
|
||||
files.sort(key=lambda a : a[1])
|
||||
progress_len = len(files)
|
||||
|
||||
fn = os.path.join(os.path.dirname(project_path), filename)
|
||||
|
||||
tf = tarfile.open(fn + ".tar.bz2", "w:bz2")
|
||||
tf.dereference = True
|
||||
|
||||
for j, (fn, an) in enumerate(files):
|
||||
|
||||
progress(t, progress_len, j)
|
||||
|
||||
info = tf.gettarinfo(fn, filename + an)
|
||||
|
||||
perms = 0666
|
||||
|
||||
if info.isdir():
|
||||
perms = 0777
|
||||
|
||||
for i in executable_extensions:
|
||||
if fn.endswith(i):
|
||||
perms = 0777
|
||||
|
||||
info.mode = perms
|
||||
info.uid = 1000
|
||||
info.gid = 1000
|
||||
info.uname = "renpy"
|
||||
info.gname = "renpy"
|
||||
|
||||
if info.isreg():
|
||||
tf.addfile(info, file(fn, "rb"))
|
||||
else:
|
||||
tf.addfile(info)
|
||||
|
||||
tf.close()
|
||||
|
||||
|
||||
def distribute(
|
||||
_project_path,
|
||||
_renpy_base,
|
||||
base_name,
|
||||
executable_name,
|
||||
ignore_extensions,
|
||||
documentation_extensions,
|
||||
build_windows,
|
||||
build_linux,
|
||||
build_mac,
|
||||
build_all):
|
||||
|
||||
global project_path
|
||||
global renpy_base
|
||||
project_path = _project_path
|
||||
renpy_base = _renpy_base
|
||||
|
||||
base_name = base_name.encode("utf-8")
|
||||
executable_name = executable_name.encode("utf-8")
|
||||
ignore_extensions = ignore_extensions.encode("utf-8")
|
||||
documentation_extensions = documentation_extensions.encode("utf-8")
|
||||
|
||||
# Convert some of these to more useful formats.
|
||||
ignore_extensions = [ i.strip() for i in ignore_extensions.split() ]
|
||||
documentation_extensions = [ i.strip() for i in documentation_extensions.split() ]
|
||||
|
||||
# Scan for the files we want to include in the various distributions.
|
||||
info(_(u"Scanning..."), "")
|
||||
|
||||
# Files included in the various distributions.
|
||||
multi_files = [ ]
|
||||
win_files = [ ]
|
||||
linux_files = [ ]
|
||||
mac_files = [ ]
|
||||
|
||||
# A map from source file name to replacement data to be placed in
|
||||
# that file.
|
||||
file_data = { }
|
||||
|
||||
|
||||
######################################################################
|
||||
# Multi files.
|
||||
|
||||
rb = renpy_base.replace("\\", "/") + "/"
|
||||
|
||||
# Project files.
|
||||
multi_files.extend(tree(project_path, "/", root=True, exclude_suffix=ignore_extensions))
|
||||
multi_files.append((rb + "renpy.py", "/" + executable_name + ".py"))
|
||||
|
||||
# Renpy files.
|
||||
multi_files.extend(tree(rb + "common", "/common"))
|
||||
multi_files.extend(tree(rb + "renpy", "/renpy"))
|
||||
multi_files.append((rb + "LICENSE.txt", "/renpy/LICENSE.txt"))
|
||||
|
||||
def add_script_version(fn, ignore_extensions=ignore_extensions, multi_files=multi_files, rb=rb):
|
||||
"""
|
||||
Add a script_version file if it does not already exist, and if the
|
||||
extension is allowed by the game.
|
||||
"""
|
||||
|
||||
for a, b in multi_files:
|
||||
if b == "/game/" + fn:
|
||||
return
|
||||
|
||||
for i in ignore_extensions:
|
||||
if fn.endswith(i):
|
||||
return
|
||||
|
||||
multi_files.append((rb + "launcher/" + fn, "/game/" + fn))
|
||||
|
||||
add_script_version("script_version.rpy")
|
||||
add_script_version("script_version.rpyc")
|
||||
|
||||
|
||||
######################################################################
|
||||
# Windows files.
|
||||
|
||||
if build_windows or build_all:
|
||||
|
||||
win_files.append((rb + "renpy.exe", "/" + executable_name + ".exe"))
|
||||
win_files.append((rb + "renpy.code", "/renpy.code"))
|
||||
win_files.append((rb + "python26.dll", "/python26.dll"))
|
||||
win_files.append((rb + "msvcr90.dll", "/msvcr90.dll"))
|
||||
win_files.append((rb + "Microsoft.VC90.CRT.manifest", "/Microsoft.VC90.CRT.manifest"))
|
||||
|
||||
if os.path.exists(project_path + "/icon.ico"):
|
||||
file_data[rb + "renpy.exe"] = change_icon.change_icons(
|
||||
rb + "renpy.exe",
|
||||
project_path + "/icon.ico",
|
||||
)
|
||||
|
||||
|
||||
######################################################################
|
||||
# Linux files.
|
||||
|
||||
if build_linux or build_all:
|
||||
|
||||
linux_files.append((rb + "renpy.sh", "/" + executable_name + ".sh"))
|
||||
linux_files.append((rb + "lib", "/lib"))
|
||||
linux_files.append((rb + "lib/python", "/lib/python"))
|
||||
linux_files.extend(tree(rb + "lib/linux-x86", "/lib/linux-x86"))
|
||||
|
||||
# Warning: The tar.bz2 builder doesn't support file_data.
|
||||
|
||||
|
||||
######################################################################
|
||||
# Mac (non-app) files.
|
||||
|
||||
if build_mac or build_all:
|
||||
mac_files = tree(rb + "renpy.app",
|
||||
"/" + executable_name + ".app")
|
||||
|
||||
# Rename executable.
|
||||
mac_files = [ (fn, an.replace("Ren'Py Launcher", executable_name)) for (fn, an) in mac_files ]
|
||||
|
||||
# Plist file.
|
||||
quoted_name = executable_name.replace("&", "&").replace("<", "<")
|
||||
info_plist = file(rb + "renpy.app/Contents/Info.plist", "rb").read().replace("Ren'Py Launcher", quoted_name)
|
||||
file_data[rb + "renpy.app/Contents/Info.plist"] = info_plist
|
||||
|
||||
# Launcher script.
|
||||
quoted_name = executable_name.replace("\"", "\\\"")
|
||||
launcher_py = file(rb + "renpy.app/Contents/Resources/launcher.py", "rb").read().replace("Ren'Py Launcher", quoted_name)
|
||||
file_data[rb + "renpy.app/Contents/Resources/launcher.py"] = launcher_py
|
||||
|
||||
# Icon file.
|
||||
if os.path.exists(project_path + "/icon.icns"):
|
||||
icon_data = file(project_path + "/icon.icns", "rb").read()
|
||||
file_data[rb + "renpy.app/Contents/Resources/launcher.icns"] = icon_data
|
||||
|
||||
|
||||
######################################################################
|
||||
# Now, build the various distributions.
|
||||
|
||||
if build_windows:
|
||||
make_zip(
|
||||
_(u"Building Windows..."),
|
||||
base_name + "-win32",
|
||||
multi_files + win_files,
|
||||
file_data)
|
||||
|
||||
if build_linux:
|
||||
make_tar(
|
||||
_(u"Building Linux..."),
|
||||
base_name + "-linux-x86",
|
||||
multi_files + linux_files)
|
||||
|
||||
|
||||
if build_mac:
|
||||
|
||||
# Reorganize the files so all the non application files live inside
|
||||
# the application. If there's documentation involved, then it
|
||||
# lives in both places.
|
||||
macapp_files = [ ]
|
||||
|
||||
for fn, an in multi_files + mac_files:
|
||||
if not an.startswith("/" + executable_name + ".app"):
|
||||
new_an = "/" + executable_name + ".app/Contents/Resources/autorun" + an
|
||||
macapp_files.append((fn, new_an))
|
||||
|
||||
if an.rindex('/') == 0:
|
||||
for i in documentation_extensions:
|
||||
if fn.endswith(i):
|
||||
macapp_files.append((fn, an))
|
||||
break
|
||||
else:
|
||||
macapp_files.append((fn, an))
|
||||
|
||||
make_zip(
|
||||
_(u"Building Macintosh..."),
|
||||
base_name + "-mac",
|
||||
macapp_files,
|
||||
file_data)
|
||||
|
||||
|
||||
if build_all:
|
||||
make_zip(
|
||||
_(u"Building Combined..."),
|
||||
base_name + "-all",
|
||||
multi_files + win_files + linux_files + mac_files,
|
||||
file_data)
|
||||
|
||||
def main():
|
||||
|
||||
ap = argparse.ArgumentParser(description="Prepare a Ren'Py game for distribution.")
|
||||
|
||||
ap.add_argument("project_path", type=str, help="The path to the directory containing the project.")
|
||||
ap.add_argument("base_name", type=str, help="The base name of the archive files produced.")
|
||||
ap.add_argument("executable_name", type=str, help="The name of the executables produced.")
|
||||
ap.add_argument("--renpy-base", type=str, default=None, help="The path to the Ren'Py distribution.")
|
||||
|
||||
ap.add_argument("--ignore-extensions", type=str, default="~ .bak", help="A space-separated list of extensions to ignore.")
|
||||
ap.add_argument("--documentation-extensions", type=str, default="txt html", help="A space-separated list of extensions to treat as documentation.")
|
||||
|
||||
ap.add_argument("--build-windows", action="store_true", default=False, help="Build the Windows distribution.")
|
||||
ap.add_argument("--build-mac", action="store_true", default=False, help="Build the Mac OS X distribution.")
|
||||
ap.add_argument("--build-linux", action="store_true", default=False, help="Build the Windows distribution.")
|
||||
ap.add_argument("--build-all", action="store_true", default=False, help="Build the All Platforms distribution.")
|
||||
|
||||
args = ap.parse_args()
|
||||
|
||||
renpy_base = args.renpy_base
|
||||
if renpy_base is None:
|
||||
renpy_base = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
|
||||
|
||||
distribute(
|
||||
args.project_path,
|
||||
renpy_base,
|
||||
base_name=args.base_name,
|
||||
executable_name=args.executable_name,
|
||||
ignore_extensions=args.ignore_extensions,
|
||||
documentation_extensions=args.documentation_extensions,
|
||||
build_windows=args.build_windows,
|
||||
build_mac=args.build_mac,
|
||||
build_linux=args.build_linux,
|
||||
build_all=args.build_all)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
+19
-388
@@ -1,234 +1,21 @@
|
||||
# This file contains the code needed to build a Ren'Py distribution.
|
||||
|
||||
init python:
|
||||
import os
|
||||
import os.path
|
||||
import zipfile
|
||||
import tarfile
|
||||
import time
|
||||
import sys
|
||||
import zlib
|
||||
zlib.Z_DEFAULT_COMPRESSION = 9
|
||||
init 12 python:
|
||||
|
||||
import pefile
|
||||
|
||||
# These are files that are ignored wherever they are found in a
|
||||
# distribution.
|
||||
ignored_files = (
|
||||
"thumbs.db",
|
||||
"traceback.txt",
|
||||
"errors.txt",
|
||||
"saves"
|
||||
)
|
||||
import distribute
|
||||
|
||||
# These are files (and directories) that are ignored when found in
|
||||
# the root directory of the distribution.
|
||||
root_ignored_files = (
|
||||
"common",
|
||||
"renpy",
|
||||
"renpy.code",
|
||||
"python23.dll",
|
||||
"python24.dll",
|
||||
"python25.dll",
|
||||
"msvcr71.dll",
|
||||
"lib",
|
||||
"iliad-icon.png",
|
||||
"manifest.xml",
|
||||
"icon.ico",
|
||||
"icon.icns",
|
||||
"launcherinfo.py",
|
||||
"archived",
|
||||
)
|
||||
distribute.progress = progress
|
||||
distribute.info = info
|
||||
distribute._ = _
|
||||
|
||||
# Extensions that should be made executable.
|
||||
executable_extensions = (
|
||||
"MacOS",
|
||||
"so",
|
||||
"dylib",
|
||||
".sh",
|
||||
"python",
|
||||
"python.real",
|
||||
)
|
||||
|
||||
|
||||
def tree(
|
||||
src,
|
||||
dest,
|
||||
exclude_suffix=[ ".pyc", "~", ".bak" ],
|
||||
exclude_prefix=[ "#", "." ],
|
||||
exclude_files = set(ignored_files),
|
||||
root_exclude_prefix = [ ],
|
||||
root_exclude_suffix = [ ".py", ".sh", ".app" ],
|
||||
root_exclude_files = set(root_ignored_files),
|
||||
root=False):
|
||||
|
||||
"""
|
||||
Returns a list of source-filename, destination-filename pairs.
|
||||
"""
|
||||
|
||||
if dest[0] != "/":
|
||||
raise Exception("Destination must begin with /: %r" % dest)
|
||||
|
||||
src = src.rstrip('/')
|
||||
dest = dest.rstrip('/')
|
||||
|
||||
def include(fn, is_root):
|
||||
"""
|
||||
Returns True if the file should be included in the list of
|
||||
files we are copying.
|
||||
"""
|
||||
|
||||
for i in exclude_suffix:
|
||||
if fn.endswith(i):
|
||||
return False
|
||||
|
||||
for i in exclude_prefix:
|
||||
if fn.startswith(i):
|
||||
return False
|
||||
|
||||
if fn in exclude_files:
|
||||
return False
|
||||
|
||||
if not root or not is_root:
|
||||
return True
|
||||
|
||||
for i in root_exclude_suffix:
|
||||
if fn.endswith(i):
|
||||
return False
|
||||
|
||||
for i in root_exclude_prefix:
|
||||
if fn.startswith(i):
|
||||
return False
|
||||
|
||||
if fn in root_exclude_files:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
rv = [ ]
|
||||
|
||||
# Walk the tree, including what is necessary.
|
||||
for srcdir, dirs, files in os.walk(src):
|
||||
|
||||
is_root = (srcdir == src)
|
||||
|
||||
srcdir += "/"
|
||||
destdir = dest + srcdir[len(src):]
|
||||
destdir.replace("\\", "/")
|
||||
|
||||
rv.append((srcdir, destdir))
|
||||
|
||||
for fn in files:
|
||||
|
||||
if not include(fn, is_root):
|
||||
continue
|
||||
|
||||
sfn = srcdir + fn
|
||||
dfn = destdir + fn
|
||||
|
||||
rv.append((sfn, dfn))
|
||||
|
||||
dirs[:] = [ i for i in dirs if include(i, is_root) ]
|
||||
|
||||
rv = [ (a.replace("\\", "/"), b.replace("\\", "/")) for a, b in rv ]
|
||||
|
||||
return rv
|
||||
|
||||
|
||||
def make_zip(t, filename, files, file_data):
|
||||
"""
|
||||
This creates `filename`.zip, containing `files`, placed in the
|
||||
`filename` directory. `file_data` is a map from source file to
|
||||
replacement data.
|
||||
"""
|
||||
|
||||
files.sort(key=lambda a : a[1])
|
||||
progress_len = len(files)
|
||||
|
||||
fn = os.path.join(os.path.dirname(project.path), filename)
|
||||
|
||||
zf = zipfile.ZipFile(fn + ".zip", "w", zipfile.ZIP_DEFLATED)
|
||||
|
||||
for i, (fn, an) in enumerate(files):
|
||||
|
||||
progress(t, progress_len, i)
|
||||
|
||||
if os.path.isdir(fn):
|
||||
continue
|
||||
|
||||
zi = zipfile.ZipInfo(filename + an)
|
||||
|
||||
s = os.stat(fn)
|
||||
zi.date_time = time.gmtime(s.st_mtime)[:6]
|
||||
zi.compress_type = zipfile.ZIP_DEFLATED
|
||||
zi.create_system = 3
|
||||
|
||||
for i in executable_extensions:
|
||||
if os.path.dirname(fn).endswith(i) or fn.endswith(i):
|
||||
zi.external_attr = long(0100777) << 16
|
||||
break
|
||||
else:
|
||||
zi.external_attr = long(0100666) << 16
|
||||
|
||||
if fn in file_data:
|
||||
data = file_data[fn]
|
||||
else:
|
||||
data = file(fn, "rb").read()
|
||||
|
||||
zf.writestr(zi, data)
|
||||
|
||||
zf.close()
|
||||
|
||||
def make_tar(t, filename, files):
|
||||
"""
|
||||
Makes a tarfile, as above.
|
||||
"""
|
||||
|
||||
files.sort(key=lambda a : a[1])
|
||||
progress_len = len(files)
|
||||
|
||||
fn = os.path.join(os.path.dirname(project.path), filename)
|
||||
|
||||
tf = tarfile.open(fn + ".tar.bz2", "w:bz2")
|
||||
tf.dereference = True
|
||||
|
||||
for j, (fn, an) in enumerate(files):
|
||||
|
||||
progress(t, progress_len, j)
|
||||
|
||||
info = tf.gettarinfo(fn, filename + an)
|
||||
|
||||
perms = 0666
|
||||
|
||||
if info.isdir():
|
||||
perms = 0777
|
||||
|
||||
for i in executable_extensions:
|
||||
if fn.endswith(i):
|
||||
perms = 0777
|
||||
|
||||
info.mode = perms
|
||||
info.uid = 1000
|
||||
info.gid = 1000
|
||||
info.uname = "renpy"
|
||||
info.gname = "renpy"
|
||||
|
||||
if info.isreg():
|
||||
tf.addfile(info, file(fn, "rb"))
|
||||
else:
|
||||
tf.addfile(info)
|
||||
|
||||
tf.close()
|
||||
|
||||
|
||||
def dist_exists(fn):
|
||||
"""
|
||||
Returns true if the given file exists in the renpy directory.
|
||||
"""
|
||||
|
||||
|
||||
return os.path.exists(os.path.join(config.renpy_base, fn))
|
||||
|
||||
|
||||
|
||||
label distribute:
|
||||
|
||||
call lint
|
||||
@@ -368,173 +155,18 @@ label distribute:
|
||||
|
||||
project.save()
|
||||
|
||||
base_name = base_name.encode("utf-8")
|
||||
executable_name = executable_name.encode("utf-8")
|
||||
ignore_extensions = ignore_extensions.encode("utf-8")
|
||||
documentation_extensions = documentation_extensions.encode("utf-8")
|
||||
|
||||
# Convert some of these to more useful formats.
|
||||
ignore_extensions = [ i.strip() for i in ignore_extensions.split() ]
|
||||
documentation_extensions = [ i.strip() for i in documentation_extensions.split() ]
|
||||
|
||||
# Scan for the files we want to include in the various distributions.
|
||||
info(_(u"Scanning..."), "")
|
||||
|
||||
# Files included in the various distributions.
|
||||
multi_files = [ ]
|
||||
win_files = [ ]
|
||||
linux_files = [ ]
|
||||
mac_files = [ ]
|
||||
|
||||
# A map from source file name to replacement data to be placed in
|
||||
# that file.
|
||||
file_data = { }
|
||||
|
||||
|
||||
######################################################################
|
||||
# Multi files.
|
||||
|
||||
rb = config.renpy_base.replace("\\", "/") + "/"
|
||||
|
||||
|
||||
|
||||
|
||||
# Project files.
|
||||
multi_files.extend(tree(project.path, "/", root=True, exclude_suffix=ignore_extensions))
|
||||
multi_files.append((rb + "renpy.py", "/" + executable_name + ".py"))
|
||||
|
||||
# Renpy files.
|
||||
multi_files.extend(tree(rb + "common", "/common"))
|
||||
multi_files.extend(tree(rb + "renpy", "/renpy"))
|
||||
multi_files.append((rb + "LICENSE.txt", "/renpy/LICENSE.txt"))
|
||||
|
||||
def add_script_version(fn, ignore_extensions=ignore_extensions, multi_files=multi_files, rb=rb):
|
||||
"""
|
||||
Add a script_version file if it does not already exist, and if the
|
||||
extension is allowed by the game.
|
||||
"""
|
||||
|
||||
for a, b in multi_files:
|
||||
if b == "/game/" + fn:
|
||||
return
|
||||
|
||||
for i in ignore_extensions:
|
||||
if fn.endswith(i):
|
||||
return
|
||||
|
||||
multi_files.append((rb + "launcher/" + fn, "/game/" + fn))
|
||||
|
||||
add_script_version("script_version.rpy")
|
||||
add_script_version("script_version.rpyc")
|
||||
|
||||
|
||||
######################################################################
|
||||
# Windows files.
|
||||
|
||||
if build_windows or build_all:
|
||||
|
||||
win_files.append((rb + "renpy.exe", "/" + executable_name + ".exe"))
|
||||
win_files.append((rb + "renpy.code", "/renpy.code"))
|
||||
win_files.append((rb + "python25.dll", "/python25.dll"))
|
||||
win_files.append((rb + "msvcr71.dll", "/msvcr71.dll"))
|
||||
|
||||
if os.path.exists(project.path + "/icon.ico"):
|
||||
file_data[rb + "renpy.exe"] = pefile.change_icons(
|
||||
rb + "renpy.exe",
|
||||
project.path + "/icon.ico",
|
||||
)
|
||||
|
||||
|
||||
######################################################################
|
||||
# Linux files.
|
||||
|
||||
if build_linux or build_all:
|
||||
|
||||
linux_files.append((rb + "renpy.sh", "/" + executable_name + ".sh"))
|
||||
linux_files.append((rb + "lib", "/lib"))
|
||||
linux_files.append((rb + "lib/python", "/lib/python"))
|
||||
linux_files.extend(tree(rb + "lib/linux-x86", "/lib/linux-x86"))
|
||||
|
||||
# Warning: The tar.bz2 builder doesn't support file_data.
|
||||
|
||||
distribute.distribute(
|
||||
project.path,
|
||||
config.renpy_base,
|
||||
base_name=base_name,
|
||||
executable_name=executable_name,
|
||||
ignore_extensions=ignore_extensions,
|
||||
documentation_extensions=documentation_extensions,
|
||||
build_windows=build_windows,
|
||||
build_mac=build_mac,
|
||||
build_linux=build_linux,
|
||||
build_all=build_all)
|
||||
|
||||
######################################################################
|
||||
# Mac (non-app) files.
|
||||
|
||||
if build_mac or build_all:
|
||||
mac_files = tree(rb + "renpy.app",
|
||||
"/" + executable_name + ".app")
|
||||
|
||||
# Rename executable.
|
||||
mac_files = [ (fn, an.replace("Ren'Py Launcher", executable_name)) for (fn, an) in mac_files ]
|
||||
|
||||
# Plist file.
|
||||
quoted_name = executable_name.replace("&", "&").replace("<", "<")
|
||||
info_plist = file(rb + "renpy.app/Contents/Info.plist", "rb").read().replace("Ren'Py Launcher", quoted_name)
|
||||
file_data[rb + "renpy.app/Contents/Info.plist"] = info_plist
|
||||
|
||||
# Launcher script.
|
||||
quoted_name = executable_name.replace("\"", "\\\"")
|
||||
launcher_py = file(rb + "renpy.app/Contents/Resources/launcher.py", "rb").read().replace("Ren'Py Launcher", quoted_name)
|
||||
file_data[rb + "renpy.app/Contents/Resources/launcher.py"] = launcher_py
|
||||
|
||||
# Icon file.
|
||||
if os.path.exists(project.path + "/icon.icns"):
|
||||
icon_data = file(project.path + "/icon.icns", "rb").read()
|
||||
file_data[rb + "renpy.app/Contents/Resources/launcher.icns"] = icon_data
|
||||
|
||||
|
||||
######################################################################
|
||||
# Now, build the various distributions.
|
||||
|
||||
if build_windows:
|
||||
make_zip(
|
||||
_(u"Building Windows..."),
|
||||
base_name + "-win32",
|
||||
multi_files + win_files,
|
||||
file_data)
|
||||
|
||||
if build_linux:
|
||||
make_tar(
|
||||
_(u"Building Linux..."),
|
||||
base_name + "-linux-x86",
|
||||
multi_files + linux_files)
|
||||
|
||||
|
||||
if build_mac:
|
||||
|
||||
# Reorganize the files so all the non application files live inside
|
||||
# the application. If there's documentation involved, then it
|
||||
# lives in both places.
|
||||
macapp_files = [ ]
|
||||
|
||||
for fn, an in multi_files + mac_files:
|
||||
if not an.startswith("/" + executable_name + ".app"):
|
||||
new_an = "/" + executable_name + ".app/Contents/Resources/autorun" + an
|
||||
macapp_files.append((fn, new_an))
|
||||
|
||||
if an.rindex('/') == 0:
|
||||
for i in documentation_extensions:
|
||||
if fn.endswith(i):
|
||||
macapp_files.append((fn, an))
|
||||
break
|
||||
else:
|
||||
macapp_files.append((fn, an))
|
||||
|
||||
make_zip(
|
||||
_(u"Building Macintosh..."),
|
||||
base_name + "-mac",
|
||||
macapp_files,
|
||||
file_data)
|
||||
|
||||
|
||||
if build_all:
|
||||
make_zip(
|
||||
_(u"Building Combined..."),
|
||||
base_name + "-all",
|
||||
multi_files + win_files + linux_files + mac_files,
|
||||
file_data)
|
||||
|
||||
# Report success to the user.
|
||||
set_tooltip(_(u"Thank you for choosing Ren'Py."))
|
||||
|
||||
@@ -542,7 +174,7 @@ label distribute:
|
||||
ui.vbox()
|
||||
|
||||
title(_(u"Success"))
|
||||
text(_(u"The distributions have been built. Be sure to test them before release.\n\nNote that unpacking and repacking the Macintosh, Linux, or Combined distributions on Windows is not supported.\n\nPlease announce your release at the {a=http://lemmasoft.renai.us/forums/}Lemma Soft Forums{/a}, so we can add it to the Ren'Py web site."))
|
||||
text(_(u"The distributions have been built. Be sure to test them before release.\n\nNote that unpacking and repacking the Macintosh, Linux, or Combined distributions on Windows is not supported.\n\nPlease announce your release at the {a=http://lemmasoft.renai.us/forums/}Lemma Soft Forums{/a}, and add it to {a=http://games.renpy.org}games.renpy.org{/a}."))
|
||||
|
||||
ui.null(height=20)
|
||||
|
||||
@@ -551,4 +183,3 @@ label distribute:
|
||||
ui.close()
|
||||
interact()
|
||||
|
||||
|
||||
|
||||
+5
-2
@@ -29,9 +29,12 @@ label new_project:
|
||||
_(u"Please wait while we create the project."))
|
||||
|
||||
template = os.path.join(config.renpy_base, "template")
|
||||
|
||||
shutil.copytree(template, path)
|
||||
|
||||
try:
|
||||
shutil.copytree(template, path)
|
||||
except OSError, e:
|
||||
error(_(u"Could not create the project directory. The error was: %s") % unicode(e))
|
||||
|
||||
launcherinfo = os.path.join(path, "launcherinfo.py")
|
||||
if os.path.exists(launcherinfo):
|
||||
os.unlink(launcherinfo)
|
||||
|
||||
@@ -100,6 +100,9 @@ init -1 python hide:
|
||||
## Set this to False if the game does not have any sound effects.
|
||||
config.sound = False
|
||||
|
||||
# Disable opengl.
|
||||
config.gl_enable = False
|
||||
|
||||
python early:
|
||||
config.save_directory = "launcher-2"
|
||||
|
||||
|
||||
+3872
-302
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,11 @@ init python:
|
||||
import sys
|
||||
import platform
|
||||
import subprocess
|
||||
|
||||
# Set the projects directory to None if it no longer exists.
|
||||
if persistent.projects_directory is not None:
|
||||
if not os.path.isdir(persistent.projects_directory):
|
||||
persistent.projects_directory = None
|
||||
|
||||
ZWSP = u"\u200B"
|
||||
|
||||
@@ -220,7 +225,7 @@ label launch:
|
||||
set_tooltip(_(u"%s has been launched.") % project.name.capitalize())
|
||||
|
||||
store.game_proc = proc
|
||||
|
||||
|
||||
jump top
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,8 @@ label choose_projects_directory:
|
||||
|
||||
if path is None:
|
||||
path = os.path.dirname(config.renpy_base)
|
||||
|
||||
path = os.environ.get("RENPY_DEFAULT_PROJECTS_DIRECTORY", path)
|
||||
|
||||
|
||||
if EasyDialogs:
|
||||
|
||||
|
||||
+17
-3
@@ -68,7 +68,7 @@ label top:
|
||||
|
||||
title(_(u"Ren'Py"))
|
||||
|
||||
ui.grid(2, 3, transpose=True)
|
||||
ui.grid(2, 4, transpose=True)
|
||||
|
||||
button(_(u"Select Project"),
|
||||
ui.jumps("select_project"),
|
||||
@@ -78,8 +78,12 @@ label top:
|
||||
ui.jumps("new_project"),
|
||||
_(u"Create a new project."))
|
||||
|
||||
button(_(u"Ren'Py Games List"),
|
||||
ui.jumps("renpy_games_list"),
|
||||
_(u"Visit the Ren'Py games list, at http://games.renpy.org."))
|
||||
|
||||
button(_(u"Quit"),
|
||||
renpy.quit,
|
||||
ui.jumps("launcher_quit"),
|
||||
_(u"Causes the launcher to exit."))
|
||||
|
||||
button(_(u"Options"),
|
||||
@@ -99,7 +103,8 @@ label top:
|
||||
else:
|
||||
|
||||
ui.null()
|
||||
|
||||
|
||||
ui.null()
|
||||
|
||||
|
||||
ui.close()
|
||||
@@ -121,6 +126,15 @@ label documentation:
|
||||
jump top
|
||||
|
||||
|
||||
label renpy_games_list:
|
||||
python hide:
|
||||
import webbrowser
|
||||
webbrowser.open_new("http://games.renpy.org")
|
||||
set_tooltip(_(u"Now showing the Ren'Py Games List in your web browser."))
|
||||
|
||||
jump top
|
||||
|
||||
label launcher_quit:
|
||||
label confirm_quit:
|
||||
$ renpy.quit()
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
init -999:
|
||||
$ config.script_version = (6, 10, 0)
|
||||
$ config.script_version = (6, 11, 0)
|
||||
|
||||
|
||||
+32
-19
@@ -3,6 +3,11 @@ init python:
|
||||
|
||||
TRANSLATION_STRINGS = [
|
||||
|
||||
u"Graphics Acceleration",
|
||||
u"Automatically Choose",
|
||||
u"Prefer Software Renderer",
|
||||
u"Prefer OpenGL Renderer",
|
||||
u"Continue",
|
||||
u"Are you sure?",
|
||||
u"Are you sure you want to delete this save?",
|
||||
u"Are you sure you want to overwrite your save?",
|
||||
@@ -33,14 +38,14 @@ init python:
|
||||
u"Test",
|
||||
u"Left",
|
||||
u"Right",
|
||||
u"Not Assigned",
|
||||
u"Up",
|
||||
u"Down",
|
||||
u"Not Assigned",
|
||||
u"Select/Dismiss",
|
||||
u"Rollback",
|
||||
u"Hold to Skip",
|
||||
u"Joystick Mapping",
|
||||
u"Move the joystick or press a joystick button to create the mapping. Click the mouse to remove the mapping.",
|
||||
u"Rollback",
|
||||
u"Hold to Skip",
|
||||
u"Toggle Skip",
|
||||
u"Hide Text",
|
||||
u"Menu",
|
||||
@@ -64,6 +69,15 @@ init python:
|
||||
u"Joystick...",
|
||||
u"Joystick Configuration",
|
||||
u"Voice Volume",
|
||||
u"Developer Menu",
|
||||
u"Reload Game (Shift+R)",
|
||||
u"Return to the developer menu",
|
||||
u"Variable Viewer",
|
||||
u"Theme Test",
|
||||
u"Style Hierarchy",
|
||||
u"FPS Meter",
|
||||
u"Image Location Picker",
|
||||
u"Done",
|
||||
u"Auto",
|
||||
u"Quick",
|
||||
u"The patterns did not match any files, so no archive was created.",
|
||||
@@ -95,6 +109,16 @@ init python:
|
||||
u"Choose Theme",
|
||||
u"Please choose a color scheme for your project.",
|
||||
u"Choose Color Scheme",
|
||||
u"Base Name",
|
||||
u"Please enter in the base name for your distribution. This name is used to generate the names of directories and archive files. Usually, this is the name of your game, plus a version number, like \"moonlight-1.0\".",
|
||||
u"Executable Name",
|
||||
u"Please enter a name for the executables in your distribution. This should not include an extension, as that will be added automatically.",
|
||||
u"Ignore Extensions",
|
||||
u"Please enter a space-separated list of file extensions. Files with these extensions will not be included in the built distributions.",
|
||||
u"Documentation Extensions",
|
||||
u"Please enter a space separated list of documentation extensions. Files in the base directory with these extensions will have a second copy stored outside of the Macintosh application.",
|
||||
u"Thank you for choosing Ren'Py.",
|
||||
u"The distributions have been built. Be sure to test them before release.\n\nNote that unpacking and repacking the Macintosh, Linux, or Combined distributions on Windows is not supported.\n\nPlease announce your release at the {a=http://lemmasoft.renai.us/forums/}Lemma Soft Forums{/a}, and add it to {a=http://games.renpy.org}games.renpy.org{/a}.",
|
||||
u"Building Distributions",
|
||||
u"I've just performed a lint on your project. If it contains errors, you should say no and fix them.\nPlease also check {a=http://www.renpy.org/wiki/renpy/Download_Ren'Py}www.renpy.org{/a} to see if updates or fixes are available.\n\nDo you want to continue?",
|
||||
u"Base Name:",
|
||||
@@ -116,21 +140,6 @@ init python:
|
||||
u"Zip distribution for the Windows x86, Linux x86, Macintosh x86 and Macintosh ppc platforms.",
|
||||
u"Build",
|
||||
u"Start building the distributions.",
|
||||
u"Base Name",
|
||||
u"Please enter in the base name for your distribution. This name is used to generate the names of directories and archive files. Usually, this is the name of your game, plus a version number, like \"moonlight-1.0\".",
|
||||
u"Executable Name",
|
||||
u"Please enter a name for the executables in your distribution. This should not include an extension, as that will be added automatically.",
|
||||
u"Ignore Extensions",
|
||||
u"Please enter a space-separated list of file extensions. Files with these extensions will not be included in the built distributions.",
|
||||
u"Documentation Extensions",
|
||||
u"Please enter a space separated list of documentation extensions. Files in the base directory with these extensions will have a second copy stored outside of the Macintosh application.",
|
||||
u"Scanning...",
|
||||
u"Building Windows...",
|
||||
u"Building Linux...",
|
||||
u"Building Macintosh...",
|
||||
u"Building Combined...",
|
||||
u"Thank you for choosing Ren'Py.",
|
||||
u"The distributions have been built. Be sure to test them before release.\n\nNote that unpacking and repacking the Macintosh, Linux, or Combined distributions on Windows is not supported.\n\nPlease announce your release at the {a=http://lemmasoft.renai.us/forums/}Lemma Soft Forums{/a}, so we can add it to the Ren'Py web site.",
|
||||
u"The editor has been set from the RENPY_EDITOR environment variable, and cannot be changed.",
|
||||
u"Choose Editor",
|
||||
u"Please choose the editor that will be use to edit scripts and display errors. More editors can be downloaded from {a=http://www.renpy.org/wiki/renpy/Editors}the Ren'Py website{/a}.",
|
||||
@@ -145,6 +154,7 @@ init python:
|
||||
u"Something with that name already exists in the projects directory.",
|
||||
u"Creating Project",
|
||||
u"Please wait while we create the project.",
|
||||
u"Could not create the project directory. The error was: %s",
|
||||
u"%s Launcher",
|
||||
u"Launcher Options",
|
||||
u"Using RENPY_EDITOR",
|
||||
@@ -168,7 +178,9 @@ init python:
|
||||
u"Choose Projects Directory",
|
||||
u"Please choose the directory containing your projects.",
|
||||
u"Could not run zenity. The projects directory has been set to the directory immediately above the directory containing Ren'Py.",
|
||||
u"Launches the Ren'Py tutorial game.",
|
||||
u"Now showing the Ren'Py documentation in your web browser.",
|
||||
u"Now showing the Ren'Py Games List in your web browser.",
|
||||
u"Launch",
|
||||
u"Launches the project.",
|
||||
u"Edit Script",
|
||||
@@ -186,12 +198,13 @@ init python:
|
||||
u"Ren'Py",
|
||||
u"Select a project to work with.",
|
||||
u"Create a new project.",
|
||||
u"Ren'Py Games List",
|
||||
u"Visit the Ren'Py games list, at http://games.renpy.org.",
|
||||
u"Causes the launcher to exit.",
|
||||
u"Options",
|
||||
u"Change Ren'Py launcher options.",
|
||||
u"Ren'Py Help",
|
||||
u"Open the Ren'Py documentation in a web browser.",
|
||||
u"Tutorial Game",
|
||||
u"Launches the Ren'Py tutorial game.",
|
||||
]
|
||||
|
||||
|
||||
+5742
File diff suppressed because it is too large
Load Diff
+9
-7
@@ -62,7 +62,8 @@ cdef extern from "renpy.h":
|
||||
|
||||
void scale32_core(object, object,
|
||||
float, float, float, float,
|
||||
float, float, float, float)
|
||||
float, float, float, float,
|
||||
int)
|
||||
|
||||
void scale24_core(object, object,
|
||||
float, float, float, float,
|
||||
@@ -70,7 +71,7 @@ cdef extern from "renpy.h":
|
||||
|
||||
void transform32_core(object, object,
|
||||
float, float, float, float, float, float,
|
||||
int, float)
|
||||
int, float, int)
|
||||
|
||||
void blend32_core(object, object, object, int)
|
||||
|
||||
@@ -95,7 +96,7 @@ import pygame
|
||||
PygameSurface = pygame.Surface
|
||||
|
||||
def version():
|
||||
return (6, 10, 0)
|
||||
return (6, 10, 1)
|
||||
|
||||
def save_png(surf, file, compress=-1):
|
||||
|
||||
@@ -283,7 +284,8 @@ def alpha_munge(pysrc, pydst, srcchan, dstchan, amap):
|
||||
|
||||
def bilinear(pysrc, pydst,
|
||||
source_xoff=0.0, source_yoff=0.0, source_width=None, source_height=None,
|
||||
dest_xoff=0.0, dest_yoff=0.0, dest_width=None, dest_height=None):
|
||||
dest_xoff=0.0, dest_yoff=0.0, dest_width=None, dest_height=None,
|
||||
precise=0):
|
||||
|
||||
if not isinstance(pysrc, PygameSurface):
|
||||
raise Exception("bilinear requires a pygame Surface as its first argument.")
|
||||
@@ -309,7 +311,7 @@ def bilinear(pysrc, pydst,
|
||||
if pysrc.get_bitsize() == 32:
|
||||
scale32_core(pysrc, pydst,
|
||||
source_xoff, source_yoff, source_width, source_height,
|
||||
dest_xoff, dest_yoff, dest_width, dest_height)
|
||||
dest_xoff, dest_yoff, dest_width, dest_height, precise)
|
||||
|
||||
else:
|
||||
scale24_core(pysrc, pydst,
|
||||
@@ -331,7 +333,7 @@ def check(surf):
|
||||
|
||||
def transform(pysrc, pydst,
|
||||
corner_x, corner_y,
|
||||
xdx, ydx, xdy, ydy, a=1.0):
|
||||
xdx, ydx, xdy, ydy, a=1.0, precise=0):
|
||||
|
||||
check(pysrc)
|
||||
check(pydst)
|
||||
@@ -343,7 +345,7 @@ def transform(pysrc, pydst,
|
||||
corner_x, corner_y,
|
||||
xdx, ydx,
|
||||
xdy, ydy,
|
||||
pysrc.get_shifts()[3], a)
|
||||
pysrc.get_shifts()[3], a, precise)
|
||||
|
||||
# pydst.unlock()
|
||||
# pysrc.unlock()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,425 @@
|
||||
# This file contains bindings to integrate pygame (SDL) and OpenGL.
|
||||
|
||||
cdef extern from "pygame/pygame.h":
|
||||
struct SDL_Surface:
|
||||
int w
|
||||
int h
|
||||
int pitch
|
||||
void *pixels
|
||||
|
||||
SDL_Surface *PySurface_AsSurface(object)
|
||||
|
||||
|
||||
cdef extern from "GL/glew.h":
|
||||
ctypedef unsigned int GLenum
|
||||
ctypedef unsigned char GLboolean
|
||||
ctypedef unsigned int GLbitfield
|
||||
ctypedef void GLvoid
|
||||
ctypedef signed char GLbyte
|
||||
ctypedef short GLshort
|
||||
ctypedef int GLint
|
||||
ctypedef unsigned char GLubyte
|
||||
ctypedef unsigned short GLushort
|
||||
ctypedef unsigned int GLuint
|
||||
ctypedef int GLsizei
|
||||
ctypedef float GLfloat
|
||||
ctypedef float GLclampf
|
||||
ctypedef double GLdouble
|
||||
ctypedef double GLclampd
|
||||
|
||||
|
||||
GLenum GLEW_OK
|
||||
GLenum glewInit()
|
||||
GLubyte *glewGetErrorString(GLenum)
|
||||
|
||||
int GL_UNPACK_ROW_LENGTH
|
||||
int GL_PACK_ROW_LENGTH
|
||||
|
||||
void glPixelStorei(
|
||||
GLint pname,
|
||||
GLint param)
|
||||
|
||||
int GL_TEXTURE_2D
|
||||
int GL_RGBA8
|
||||
int GL_RGBA
|
||||
int GL_BGRA
|
||||
int GL_ALPHA
|
||||
int GL_UNSIGNED_BYTE
|
||||
|
||||
void glTexImage2D(
|
||||
GLenum target,
|
||||
GLint level,
|
||||
GLint internalformat,
|
||||
GLsizei width,
|
||||
GLsizei height,
|
||||
GLint border,
|
||||
GLenum format,
|
||||
GLenum type,
|
||||
void *pixels)
|
||||
|
||||
void glTexSubImage2D(
|
||||
int target,
|
||||
int level,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
int width,
|
||||
int height,
|
||||
int format,
|
||||
int type,
|
||||
void *pixels)
|
||||
|
||||
GLenum GL_TEXTURE0_ARB
|
||||
GLenum GL_TEXTURE1_ARB
|
||||
GLenum GL_TEXTURE2_ARB
|
||||
|
||||
GLenum GL_TRIANGLE_STRIP
|
||||
|
||||
void glMultiTexCoord2fARB(GLenum, GLfloat, GLfloat)
|
||||
void glVertex2f(GLfloat, GLfloat)
|
||||
void glBegin(GLenum)
|
||||
void glEnd()
|
||||
void glActiveTextureARB(GLenum)
|
||||
void glBindTexture(GLenum, GLuint texture)
|
||||
|
||||
GLubyte *glGetString(GLenum)
|
||||
|
||||
void glReadPixels(
|
||||
GLint,
|
||||
GLint,
|
||||
GLsizei,
|
||||
GLsizei,
|
||||
GLenum,
|
||||
GLenum,
|
||||
void *)
|
||||
|
||||
|
||||
def init_glew():
|
||||
err = glewInit()
|
||||
|
||||
if err != GLEW_OK:
|
||||
raise Exception("Glew init failed: %s" % <char *> glewGetErrorString(err))
|
||||
|
||||
|
||||
def premultiply(
|
||||
object pysurf,
|
||||
int x,
|
||||
int y,
|
||||
int w,
|
||||
int h,
|
||||
border_left, border_top, border_right, border_bottom):
|
||||
|
||||
"""
|
||||
Creates a string containing the premultiplied image data for
|
||||
for the (x, y, w, h) box inside pysurf. The various border_
|
||||
parameters control the addition of a border on the sides.
|
||||
"""
|
||||
|
||||
# Adjust the alpha if we have an alpha-free image.
|
||||
cdef unsigned char alpha_and
|
||||
cdef unsigned char alpha_or
|
||||
|
||||
if pysurf.get_masks()[3]:
|
||||
alpha_and = 255
|
||||
alpha_or = 0
|
||||
else:
|
||||
alpha_and = 0
|
||||
alpha_or = 255
|
||||
|
||||
# Allocate an uninitialized string.
|
||||
cdef unsigned char *null = NULL
|
||||
rv = null[:w*h*4]
|
||||
|
||||
# Out is where we put the output.
|
||||
cdef unsigned char *out = rv
|
||||
|
||||
# The pixels in the source image.
|
||||
cdef unsigned char *pixels = NULL
|
||||
cdef SDL_Surface *surf
|
||||
|
||||
# Pointer to the current pixel.
|
||||
cdef unsigned char *p
|
||||
|
||||
# Pointer to the current output pixel.
|
||||
cdef unsigned char *op
|
||||
|
||||
# Pointer to the row end.
|
||||
cdef unsigned char *pend
|
||||
|
||||
# alpha value.
|
||||
cdef unsigned int a
|
||||
|
||||
# pixel pointer.
|
||||
cdef unsigned int *pp
|
||||
|
||||
surf = PySurface_AsSurface(pysurf)
|
||||
pixels = <unsigned char *> surf.pixels
|
||||
|
||||
pixels += y * surf.pitch
|
||||
pixels += x * 4
|
||||
|
||||
op = out
|
||||
|
||||
for y from 0 <= y < h:
|
||||
p = pixels + y * surf.pitch
|
||||
pend = p + w * 4
|
||||
|
||||
while p < pend:
|
||||
a = (p[3] & alpha_and) | alpha_or
|
||||
|
||||
op[0] = p[0] * a / 255
|
||||
op[1] = p[1] * a / 255
|
||||
op[2] = p[2] * a / 255
|
||||
op[3] = a
|
||||
|
||||
p += 4
|
||||
op += 4
|
||||
|
||||
if border_left:
|
||||
pp = <unsigned int *> (out)
|
||||
|
||||
for y from 0 <= y < h:
|
||||
pp[0] = pp[1]
|
||||
pp += w
|
||||
|
||||
if border_right:
|
||||
pp = <unsigned int *> (out)
|
||||
pp += w - 2
|
||||
|
||||
for y from 0 <= y < h:
|
||||
pp[1] = pp[0]
|
||||
pp += w
|
||||
|
||||
if border_top:
|
||||
pp = <unsigned int *> (out)
|
||||
|
||||
for x from 0 <= x < w:
|
||||
pp[0] = pp[w]
|
||||
pp += 1
|
||||
|
||||
if border_top:
|
||||
pp = <unsigned int *> (out)
|
||||
pp += (y - 2) * w
|
||||
|
||||
for x from 0 <= x < w:
|
||||
pp[w] = pp[0]
|
||||
pp += 1
|
||||
|
||||
return rv
|
||||
|
||||
|
||||
def load_premultiplied(
|
||||
data, width, height, update, format,
|
||||
):
|
||||
|
||||
cdef char *pixels
|
||||
|
||||
if data:
|
||||
pixels = data
|
||||
else:
|
||||
pixels = NULL
|
||||
|
||||
|
||||
if update:
|
||||
glTexSubImage2D(
|
||||
GL_TEXTURE_2D,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
width,
|
||||
height,
|
||||
format,
|
||||
GL_UNSIGNED_BYTE,
|
||||
pixels)
|
||||
|
||||
else:
|
||||
glTexImage2D(
|
||||
GL_TEXTURE_2D,
|
||||
0,
|
||||
GL_RGBA,
|
||||
width,
|
||||
height,
|
||||
0,
|
||||
format,
|
||||
GL_UNSIGNED_BYTE,
|
||||
pixels)
|
||||
|
||||
|
||||
def store_framebuffer(
|
||||
object pysurf,
|
||||
int format,
|
||||
):
|
||||
|
||||
"""
|
||||
This loads the supplied pygame surface into the numbered
|
||||
texture. The created texture will be of size (width, height),
|
||||
and at position (xoffset, yoffset) relative to the containing
|
||||
image.
|
||||
"""
|
||||
cdef unsigned char *pixels = NULL
|
||||
cdef SDL_Surface *surf
|
||||
|
||||
surf = PySurface_AsSurface(pysurf)
|
||||
pixels = <unsigned char *> surf.pixels
|
||||
|
||||
glPixelStorei(GL_PACK_ROW_LENGTH, surf.pitch / 4)
|
||||
|
||||
glReadPixels(
|
||||
0,
|
||||
0,
|
||||
surf.w,
|
||||
surf.h,
|
||||
format,
|
||||
GL_UNSIGNED_BYTE,
|
||||
pixels)
|
||||
|
||||
|
||||
def draw_rectangle(
|
||||
float sx,
|
||||
float sy,
|
||||
float x,
|
||||
float y,
|
||||
float w,
|
||||
float h,
|
||||
transform,
|
||||
tex0, int tex0x, int tex0y,
|
||||
tex1, int tex1x, int tex1y,
|
||||
tex2, int tex2x, int tex2y,
|
||||
):
|
||||
|
||||
"""
|
||||
This draws a rectangle (textured with up to four textures) to the
|
||||
screen.
|
||||
"""
|
||||
|
||||
# Do we have the given texture?
|
||||
cdef int has_tex0, has_tex1, has_tex2
|
||||
|
||||
# Texture coordinates.
|
||||
cdef float t0u0, t0v0, t0u1, t0v1
|
||||
cdef float t1u0, t1v0, t1u1, t1v1
|
||||
cdef float t2u0, t2v0, t2u1, t2v1
|
||||
|
||||
# Pull apart the transform.
|
||||
cdef float xdx = transform.xdx
|
||||
cdef float xdy = transform.xdy
|
||||
cdef float ydx = transform.ydx
|
||||
cdef float ydy = transform.ydy
|
||||
|
||||
# Transform the vertex coordinates to screen-space.
|
||||
cdef float x0 = (x + 0) * xdx + (y + 0) * xdy + sx
|
||||
cdef float y0 = (x + 0) * ydx + (y + 0) * ydy + sy
|
||||
|
||||
cdef float x1 = (x + w) * xdx + (y + 0) * xdy + sx
|
||||
cdef float y1 = (x + w) * ydx + (y + 0) * ydy + sy
|
||||
|
||||
cdef float x2 = (x + 0) * xdx + (y + h) * xdy + sx
|
||||
cdef float y2 = (x + 0) * ydx + (y + h) * ydy + sy
|
||||
|
||||
cdef float x3 = (x + w) * xdx + (y + h) * xdy + sx
|
||||
cdef float y3 = (x + w) * ydx + (y + h) * ydy + sy
|
||||
|
||||
# Compute the texture coordinates, and set up the textures.
|
||||
cdef float xadd, yadd, xmul, ymul
|
||||
|
||||
if tex0 is not None:
|
||||
|
||||
has_tex0 = 1
|
||||
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB)
|
||||
glBindTexture(GL_TEXTURE_2D, tex0.number)
|
||||
|
||||
xadd = tex0.xadd
|
||||
yadd = tex0.yadd
|
||||
xmul = tex0.xmul
|
||||
ymul = tex0.ymul
|
||||
|
||||
t0u0 = xadd + xmul * (tex0x + 0)
|
||||
t0u1 = xadd + xmul * (tex0x + w)
|
||||
t0v0 = yadd + ymul * (tex0y + 0)
|
||||
t0v1 = yadd + ymul * (tex0y + h)
|
||||
|
||||
else:
|
||||
has_tex0 = 0
|
||||
|
||||
if tex1 is not None:
|
||||
|
||||
has_tex1 = 1
|
||||
|
||||
glActiveTextureARB(GL_TEXTURE1_ARB)
|
||||
glBindTexture(GL_TEXTURE_2D, tex1.number)
|
||||
|
||||
xadd = tex1.xadd
|
||||
yadd = tex1.yadd
|
||||
xmul = tex1.xmul
|
||||
ymul = tex1.ymul
|
||||
|
||||
t1u0 = xadd + xmul * (tex1x + 0)
|
||||
t1u1 = xadd + xmul * (tex1x + w)
|
||||
t1v0 = yadd + ymul * (tex1y + 0)
|
||||
t1v1 = yadd + ymul * (tex1y + h)
|
||||
|
||||
else:
|
||||
has_tex1 = 0
|
||||
|
||||
if tex2 is not None:
|
||||
|
||||
has_tex2 = 1
|
||||
|
||||
glActiveTextureARB(GL_TEXTURE2_ARB)
|
||||
glBindTexture(GL_TEXTURE_2D, tex2.number)
|
||||
|
||||
xadd = tex2.xadd
|
||||
yadd = tex2.yadd
|
||||
xmul = tex2.xmul
|
||||
ymul = tex2.ymul
|
||||
|
||||
t2u0 = xadd + xmul * (tex2x + 0)
|
||||
t2u1 = xadd + xmul * (tex2x + w)
|
||||
t2v0 = yadd + ymul * (tex2y + 0)
|
||||
t2v1 = yadd + ymul * (tex2y + h)
|
||||
|
||||
else:
|
||||
has_tex2 = 0
|
||||
|
||||
|
||||
# Now, actually draw the textured rectangle.
|
||||
|
||||
glBegin(GL_TRIANGLE_STRIP)
|
||||
|
||||
if has_tex0:
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, t0u0, t0v0)
|
||||
if has_tex1:
|
||||
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, t1u0, t1v0)
|
||||
if has_tex2:
|
||||
glMultiTexCoord2fARB(GL_TEXTURE2_ARB, t2u0, t2v0)
|
||||
glVertex2f(x0, y0)
|
||||
|
||||
if has_tex0:
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, t0u1, t0v0)
|
||||
if has_tex1:
|
||||
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, t1u1, t1v0)
|
||||
if has_tex2:
|
||||
glMultiTexCoord2fARB(GL_TEXTURE2_ARB, t2u1, t2v0)
|
||||
glVertex2f(x1, y1)
|
||||
|
||||
if has_tex0:
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, t0u0, t0v1)
|
||||
if has_tex1:
|
||||
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, t1u0, t1v1)
|
||||
if has_tex2:
|
||||
glMultiTexCoord2fARB(GL_TEXTURE2_ARB, t2u0, t2v1)
|
||||
glVertex2f(x2, y2)
|
||||
|
||||
if has_tex0:
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, t0u1, t0v1)
|
||||
if has_tex1:
|
||||
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, t1u1, t1v1)
|
||||
if has_tex2:
|
||||
glMultiTexCoord2fARB(GL_TEXTURE2_ARB, t2u1, t2v1)
|
||||
glVertex2f(x3, y3)
|
||||
|
||||
glEnd()
|
||||
|
||||
|
||||
def get_string(name):
|
||||
return <char *> glGetString(name)
|
||||
+10266
File diff suppressed because it is too large
Load Diff
+387
-227
File diff suppressed because it is too large
Load Diff
+90
-50
@@ -773,7 +773,9 @@ void scale32_core(PyObject *pysrc, PyObject *pydst,
|
||||
float source_xoff, float source_yoff,
|
||||
float source_width, float source_height,
|
||||
float dest_xoff, float dest_yoff,
|
||||
float dest_width, float dest_height) {
|
||||
float dest_width, float dest_height,
|
||||
int precise
|
||||
) {
|
||||
|
||||
|
||||
SDL_Surface *src;
|
||||
@@ -803,9 +805,25 @@ void scale32_core(PyObject *pysrc, PyObject *pydst,
|
||||
srch = src->h;
|
||||
dsth = dst->h;
|
||||
|
||||
xdelta = 255.0 * (source_width - 1) / dest_width;
|
||||
ydelta = 255.0 * (source_height - 1) / dest_height;
|
||||
if (precise) {
|
||||
|
||||
if (dest_width > 1) {
|
||||
xdelta = 256.0 * (source_width - 1) / (dest_width - 1);
|
||||
} else {
|
||||
xdelta = 0;
|
||||
}
|
||||
|
||||
if (dest_height > 1) {
|
||||
ydelta = 256.0 * (source_height - 1) / (dest_height - 1);
|
||||
} else {
|
||||
ydelta = 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
xdelta = 255.0 * (source_width - 1) / dest_width;
|
||||
ydelta = 255.0 * (source_height - 1) / dest_height;
|
||||
}
|
||||
|
||||
for (y = 0; y < dsth; y++) {
|
||||
|
||||
unsigned char *s0;
|
||||
@@ -821,14 +839,14 @@ void scale32_core(PyObject *pysrc, PyObject *pydst,
|
||||
d = dstpixels + dstpitch * y;
|
||||
dend = d + 4 * dstw; // bpp
|
||||
|
||||
sline = source_yoff * 255 + (y + dest_yoff) * ydelta;
|
||||
sline = source_yoff * 256 + (y + dest_yoff) * ydelta;
|
||||
s1frac = (int) sline & 255;
|
||||
s0frac = 256 - s1frac;
|
||||
|
||||
s0 = srcpixels + (sline >> 8) * srcpitch;
|
||||
s1 = s0 + srcpitch;
|
||||
|
||||
scol = source_xoff * 255 + dest_xoff * xdelta;
|
||||
scol = source_xoff * 256 + dest_xoff * xdelta;
|
||||
|
||||
while (d < dend) {
|
||||
|
||||
@@ -969,11 +987,13 @@ void scale24_core(PyObject *pysrc, PyObject *pydst,
|
||||
/* A similar concept to rotozoom, but implemented differently, so we
|
||||
can limit the target area. */
|
||||
int transform32_std(PyObject *pysrc, PyObject *pydst,
|
||||
float corner_x, float corner_y,
|
||||
float xdx, float ydx,
|
||||
float xdy, float ydy,
|
||||
int ashift,
|
||||
float a) {
|
||||
float corner_x, float corner_y,
|
||||
float xdx, float ydx,
|
||||
float xdy, float ydy,
|
||||
int ashift,
|
||||
float a,
|
||||
int precise
|
||||
) {
|
||||
|
||||
SDL_Surface *src;
|
||||
SDL_Surface *dst;
|
||||
@@ -985,7 +1005,7 @@ int transform32_std(PyObject *pysrc, PyObject *pydst,
|
||||
|
||||
// The x and y source pixel coordinates, times 65536. And their
|
||||
// delta-per-dest-x-pixel.
|
||||
int sxi, syi, dsxi, dsyi;
|
||||
int sxi = 0, syi = 0, dsxi = 0, dsyi = 0;
|
||||
|
||||
unsigned char *srcpixels;
|
||||
unsigned char *dstpixels;
|
||||
@@ -1008,23 +1028,31 @@ int transform32_std(PyObject *pysrc, PyObject *pydst,
|
||||
unsigned int amul = (unsigned int) (a * 256);
|
||||
|
||||
// Compute the maximum x and y coordinates.
|
||||
double maxsx = srcw - 1 - EPSILON;
|
||||
double maxsy = srch - 1 - EPSILON;
|
||||
|
||||
// If a delta is too even, subtract epsilon (towards 0) from it.
|
||||
if (xdx && fabs(fmodf(1.0 / xdx, 1)) < EPSILON) {
|
||||
xdx -= (xdx / fabs(xdx)) * EPSILON;
|
||||
}
|
||||
if (xdy && fabs(fmodf(1.0 / xdy, 1)) < EPSILON) {
|
||||
xdy -= (xdy / fabs(xdy)) * EPSILON;
|
||||
}
|
||||
if (ydx && fabs(fmodf(1.0 / ydx, 1)) < EPSILON) {
|
||||
ydx -= (ydx / fabs(ydx)) * EPSILON;
|
||||
}
|
||||
if (ydy && fabs(fmodf(1.0 / ydy, 1)) < EPSILON) {
|
||||
ydy -= (ydy / fabs(ydy)) * EPSILON;
|
||||
double maxsx = srcw - 1;
|
||||
double maxsy = srch - 1;
|
||||
|
||||
// Deal with pre-6.10.1 versions of Ren'Py, which didn't give us
|
||||
// that 1px border that allows us to be precise.
|
||||
if (! precise) {
|
||||
maxsx -= EPSILON;
|
||||
maxsy -= EPSILON;
|
||||
|
||||
// If a delta is too even, subtract epsilon (towards 0) from it.
|
||||
if (xdx && fabs(fmodf(1.0 / xdx, 1)) < EPSILON) {
|
||||
xdx -= (xdx / fabs(xdx)) * EPSILON;
|
||||
}
|
||||
if (xdy && fabs(fmodf(1.0 / xdy, 1)) < EPSILON) {
|
||||
xdy -= (xdy / fabs(xdy)) * EPSILON;
|
||||
}
|
||||
if (ydx && fabs(fmodf(1.0 / ydx, 1)) < EPSILON) {
|
||||
ydx -= (ydx / fabs(ydx)) * EPSILON;
|
||||
}
|
||||
if (ydy && fabs(fmodf(1.0 / ydy, 1)) < EPSILON) {
|
||||
ydy -= (ydy / fabs(ydy)) * EPSILON;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Loop through every line.
|
||||
for (y = 0; y < dsth; y++) {
|
||||
|
||||
@@ -1158,11 +1186,13 @@ int transform32_std(PyObject *pysrc, PyObject *pydst,
|
||||
/* A similar concept to rotozoom, but implemented differently, so we
|
||||
can limit the target area. */
|
||||
int transform32_mmx(PyObject *pysrc, PyObject *pydst,
|
||||
float corner_x, float corner_y,
|
||||
float xdx, float ydx,
|
||||
float xdy, float ydy,
|
||||
int ashift,
|
||||
float a) {
|
||||
float corner_x, float corner_y,
|
||||
float xdx, float ydx,
|
||||
float xdy, float ydy,
|
||||
int ashift,
|
||||
float a,
|
||||
int precise
|
||||
) {
|
||||
|
||||
SDL_Surface *src;
|
||||
SDL_Surface *dst;
|
||||
@@ -1174,7 +1204,7 @@ int transform32_mmx(PyObject *pysrc, PyObject *pydst,
|
||||
|
||||
// The x and y source pixel coordinates, times 65536. And their
|
||||
// delta-per-dest-x-pixel.
|
||||
int sxi, syi, dsxi, dsyi;
|
||||
int sxi = 0, syi = 0, dsxi = 0, dsyi = 0;
|
||||
|
||||
unsigned char *srcpixels;
|
||||
unsigned char *dstpixels;
|
||||
@@ -1200,23 +1230,31 @@ int transform32_mmx(PyObject *pysrc, PyObject *pydst,
|
||||
unsigned int amul = (unsigned int) (a * 256);
|
||||
|
||||
// Compute the maximum x and y coordinates.
|
||||
double maxsx = srcw - 1 - EPSILON;
|
||||
double maxsy = srch - 1 - EPSILON;
|
||||
|
||||
// If a delta is too even, subtract epsilon (towards 0) from it.
|
||||
if (xdx && fabs(fmodf(1.0 / xdx, 1)) < EPSILON) {
|
||||
xdx -= (xdx / fabs(xdx)) * EPSILON;
|
||||
}
|
||||
if (xdy && fabs(fmodf(1.0 / xdy, 1)) < EPSILON) {
|
||||
xdy -= (xdy / fabs(xdy)) * EPSILON;
|
||||
}
|
||||
if (ydx && fabs(fmodf(1.0 / ydx, 1)) < EPSILON) {
|
||||
ydx -= (ydx / fabs(ydx)) * EPSILON;
|
||||
}
|
||||
if (ydy && fabs(fmodf(1.0 / ydy, 1)) < EPSILON) {
|
||||
ydy -= (ydy / fabs(ydy)) * EPSILON;
|
||||
double maxsx = srcw - 1;
|
||||
double maxsy = srch - 1;
|
||||
|
||||
// Deal with pre-6.10.1 versions of Ren'Py, which didn't give us
|
||||
// that 1px border that allows us to be precise.
|
||||
if (! precise) {
|
||||
maxsx -= EPSILON;
|
||||
maxsy -= EPSILON;
|
||||
|
||||
// If a delta is too even, subtract epsilon (towards 0) from it.
|
||||
if (xdx && fabs(fmodf(1.0 / xdx, 1)) < EPSILON) {
|
||||
xdx -= (xdx / fabs(xdx)) * EPSILON;
|
||||
}
|
||||
if (xdy && fabs(fmodf(1.0 / xdy, 1)) < EPSILON) {
|
||||
xdy -= (xdy / fabs(xdy)) * EPSILON;
|
||||
}
|
||||
if (ydx && fabs(fmodf(1.0 / ydx, 1)) < EPSILON) {
|
||||
ydx -= (ydx / fabs(ydx)) * EPSILON;
|
||||
}
|
||||
if (ydy && fabs(fmodf(1.0 / ydy, 1)) < EPSILON) {
|
||||
ydy -= (ydy / fabs(ydy)) * EPSILON;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Loop through every line.
|
||||
for (y = 0; y < dsth; y++) {
|
||||
|
||||
@@ -1397,7 +1435,9 @@ void transform32_core(PyObject *pysrc, PyObject *pydst,
|
||||
float xdx, float ydx,
|
||||
float xdy, float ydy,
|
||||
int ashift,
|
||||
float a) {
|
||||
float a,
|
||||
int precise
|
||||
) {
|
||||
|
||||
#ifdef GCC_MMX
|
||||
static int checked_mmx = 0;
|
||||
@@ -1410,14 +1450,14 @@ void transform32_core(PyObject *pysrc, PyObject *pydst,
|
||||
|
||||
if (has_mmx) {
|
||||
transform32_mmx(pysrc, pydst, corner_x, corner_y,
|
||||
xdx, ydx, xdy, ydy, ashift, a);
|
||||
xdx, ydx, xdy, ydy, ashift, a, precise);
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
transform32_std(pysrc, pydst, corner_x, corner_y,
|
||||
xdx, ydx, xdy, ydy, ashift, a);
|
||||
xdx, ydx, xdy, ydy, ashift, a, precise);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -785,6 +785,7 @@ static void video_image_display(VideoState *is)
|
||||
rect.y = is->ytop + y;
|
||||
rect.w = width;
|
||||
rect.h = height;
|
||||
|
||||
SDL_DisplayYUVOverlay(vp->bmp, &rect);
|
||||
} else {
|
||||
#if 0
|
||||
@@ -1125,7 +1126,7 @@ static void alloc_picture(void *opaque, PyObject *pysurf)
|
||||
is->video_st->codec->height,
|
||||
SDL_YV12_OVERLAY,
|
||||
surf);
|
||||
|
||||
|
||||
vp->width = is->video_st->codec->width;
|
||||
vp->height = is->video_st->codec->height;
|
||||
|
||||
|
||||
+3515
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,275 @@
|
||||
TEGL
|
||||
----
|
||||
|
||||
Tegl is Python script for generating OpenGL extenstions. I wrote it
|
||||
because I was disappointed with some other OpenGL solutions for
|
||||
Python.
|
||||
|
||||
Tegl generates a C extension that can be compiled into module to make
|
||||
OpenGL available to Python programs. (You're on your own compiling
|
||||
it, though.)
|
||||
|
||||
Unlike PyOpenGL, the C extension is a thin wrapper around OpenGL. It
|
||||
performs only minor argument checking. Nevertheless, it is mostly
|
||||
compatible with PyOpenGL, and depending on how the module is
|
||||
generated, it should only need minor changes to migrate from PyOpenGL.
|
||||
(In fact, I was able to migrate a recent application simply by adding
|
||||
a couple wrapper functions that mimicked PyOpenGL semantics.)
|
||||
|
||||
This is version 002.
|
||||
|
||||
|
||||
USAGE
|
||||
-----
|
||||
|
||||
To use, simply run maketegl.py. It will generate two files, tegl.c
|
||||
and teglu.c in the current directory, which you can compile it to
|
||||
create Python GL and GLU modules. The modules comprise (most of)
|
||||
OpenGL 1.1.
|
||||
|
||||
For more control, open maketegl.py with a text editor. At the top are
|
||||
some options for controlling the generated code. You can change the
|
||||
names of the modules, and even combine them into one. You can control
|
||||
whether the "gl" and "GL_" prefixes appear on the exported symbols.
|
||||
|
||||
You can choose to include or exclude various OpenGL extensions, or use
|
||||
more recent versions of OpenGL. I recommend plain OpenGL 1.1 for
|
||||
maximum portability, and selected ARB extensions if you need more.
|
||||
|
||||
There are some other switches I will cover below.
|
||||
|
||||
If you really want fine-tuned control, you can scroll past the options
|
||||
and comment out any functions and constants you don't want. This may
|
||||
be a good idea since currently Tegl modules are quite large when
|
||||
compiled.
|
||||
|
||||
|
||||
|
||||
USING THE MODULE
|
||||
----------------
|
||||
|
||||
Calling OpenGL functions is simple. Just import the module with "from
|
||||
tegl import *" (or just "import tegl as gl" if you have built it
|
||||
without prefixes, or whatever else suits you).
|
||||
|
||||
Most OpenGL functions can be called just as in C:
|
||||
|
||||
glBegin(GL_COMPILE) or gl.Begin(gl.COMPILE)
|
||||
glVertex3d(1.0,2.0,3.0) or gl.Vertex3d(1.0,2.0,3.0)
|
||||
glEnable(GL_CULL_FACE)
|
||||
glRotated(1.0,90.0,0.0,0.0)
|
||||
texon = glIsEnabled(GL_TEXTURE_2D)
|
||||
|
||||
It's usually pretty straightforward to use OpenGL functions that
|
||||
accept data through a pointer: you just pass it a list (or tuple, or
|
||||
numpy array, or any sequence).
|
||||
|
||||
glVertex3dv([1.0,2.0,3.0])
|
||||
glMaterialfv(GL_FRONT,GL_AMBIENT,[0.2,0.2,0.2,1.0])
|
||||
|
||||
OpenGL functions that return data through a pointer are somewhat
|
||||
trickier, you have to pass it an empty sequence that is large enough
|
||||
to contain the data the function returns. The sequence type has to be
|
||||
mutable, of course.
|
||||
|
||||
retval = [None]*4
|
||||
glGetMaterialfv(GL_FRONT,GL_AMBIENT,retval)
|
||||
|
||||
(This is a departure from how PyOpenGL operates; it will simply create
|
||||
an array and return it. But Tegl is intended to be a thin wrapper, so
|
||||
it follows the C usage closely.)
|
||||
|
||||
In many cases, it's preferrable to use a buffer object instead of a
|
||||
Python sequence to pass data to the function; for instance, texture
|
||||
data. In these cases, you would pass in an object that supports
|
||||
buffer protocol, such as a string, a numpy array, or an array from the
|
||||
array module.
|
||||
|
||||
imagedata = Image.open(imgfile).tostring()
|
||||
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,256,256,0,GL_RGBA,
|
||||
GL_UNSIGNED_BYTE,imagedata)
|
||||
|
||||
To use an OpenGL function that returns image data, you need to pass in
|
||||
a object that supports writable buffer protocol. The buffer must be
|
||||
large enough to hold the output of the function, otherwise Bad Things
|
||||
can happen. Strings are not mutable so you'll have to use some other
|
||||
type. Arrays from the array module can be your friend here.
|
||||
|
||||
retval = array.array("B",[0])*640*480*4
|
||||
glReadPixels(0,0,640,480,GL_RGBA,GL_UNSIGNED_BYTE,retval)
|
||||
|
||||
|
||||
The question is, how do you know whether you should pass a buffer type
|
||||
or a sequence type to OpenGL? (Currently, you can only pass one or
|
||||
the other; this may change in a future version.) Here is the general
|
||||
rule of thumb:
|
||||
|
||||
You need to use a buffer if:
|
||||
* The type of the argument in C is GLvoid* (or just void*)
|
||||
* OR the size of the data is theoretically unbounded.
|
||||
|
||||
You need to use a sequence if:
|
||||
* The type if te argument is not GLvoid*
|
||||
* AND the size of the data is fixed or bounded.
|
||||
|
||||
So glMaterialfv takes a sequence argument because it has a type
|
||||
(GLfloat*) and has a size of 4 at most (it's bounded). On the other
|
||||
hand, glTexImage2D uses a buffer argument because the type of the data
|
||||
is GLvoid*, and the image can be arbitrarily large.
|
||||
|
||||
This rule of thumb does not always hold, however. I decided to go
|
||||
against it where it seemed useful.
|
||||
|
||||
Several functions for modifying textures (glGenTextures,
|
||||
glDeleteTextures, glPrioritizeTextures, and glAreTexturesResident)
|
||||
accept arrays of unbounded size, but I felt that sequence types were
|
||||
far more useful here, so I defined a constant (MAX_TEXTURE_ARRAY_SIZE)
|
||||
that lets the user specify a bound on the size. (Otherwise I would
|
||||
have had to muck around with malloc, and I did not want to do that.)
|
||||
Functions for creating and destroying buffer object, occlusion
|
||||
queries, and shader programs (ARB only) are treated likewise.
|
||||
|
||||
glCallList accepts buffer objects. Even though the size of the call
|
||||
list is unbounded, it seemed as if a sequence would be more
|
||||
appropriate. However, a common use case of glCallList (in conjunction
|
||||
with glListBase) is to pass it a string, where each character is the
|
||||
name of a display list that draws that character. Thus I left is as a
|
||||
buffer.
|
||||
|
||||
If I chose wrongly for your application, I apologize. Numpy arrays
|
||||
and arrays from the array module implement both the sequence and
|
||||
buffer protocols; these may be of assistence to you. (Be careful
|
||||
about numpy strides, though.)
|
||||
|
||||
If worse comes to worst, you can change the definition inside the
|
||||
maketegl.py script to suit you.
|
||||
|
||||
|
||||
ADVANCED: THE GIL
|
||||
-----------------
|
||||
|
||||
It's possible that if you send a lot of data to the OpenGL pipeline
|
||||
quickly enough, the OpenGL pipeline could fill up, an an OpenGL call
|
||||
in progress would block until the pipeline clears up. This is
|
||||
possible with functions like glCallList, which runs a display list
|
||||
that could be enormous.
|
||||
|
||||
In threaded programs, the time spent waiting for an OpenGL block could
|
||||
be used for other tasks. In Python, only a single thread can run
|
||||
Python code at a given time (a thread has to have the GIL, global
|
||||
interpreter lock, to run Python code). However, extensions may
|
||||
release the GIL while not manipulating Python objects (which is the
|
||||
case during an OpenGL call).
|
||||
|
||||
Therefore, there is an option in Tegl for releasing the GIL around
|
||||
certain OpenGL calls, thus allowing other Python code to run if it
|
||||
should happen to block. Simply add the name of the function (without
|
||||
the "gl") to the set of functions to release the GIL for at the top of
|
||||
maketegl.py.
|
||||
|
||||
|
||||
UNSUPPORTED FUNCTIONS
|
||||
---------------------
|
||||
|
||||
There are a few OpenGL functions that aren't supported by Tegl simply
|
||||
because they have an unusual signature that the machinery doesn't
|
||||
easily support. In this early release, I didn't bother. Here's the
|
||||
list:
|
||||
|
||||
glGetString
|
||||
glGetPointerv
|
||||
glMultiDrawArrays(ARB)
|
||||
glMultiDrawElements(ARB)
|
||||
glGetBufferPointerv(ARB)
|
||||
glGetVertexAttribPointerv(ARB)
|
||||
glShaderSource(ARB)
|
||||
All glu* functions that implement nurbs, tesselators, and quadrics.
|
||||
|
||||
|
||||
Additionally, a couple functions are supported with limited
|
||||
functionality:
|
||||
|
||||
glMapBuffer(ARB) returns a CObject. This is not too useful from
|
||||
Python; however, you can get at it from a C extension. Also, ctypes
|
||||
and numpy wizards should be able to map a numpy array to the pointer
|
||||
location.
|
||||
|
||||
glShaderSource(ARB) is handcoded, and only supports passing it a
|
||||
single string. (You must still pass a singleton sequence of strings;
|
||||
this is to preserve upward compatibility.) For instance, you'd call
|
||||
it like this:
|
||||
glShaderSourceARB(shaderobj,1,[source],[len(source)])
|
||||
|
||||
|
||||
|
||||
IMPROVEMENTS
|
||||
------------
|
||||
|
||||
The two main improvements I have in mind (aside from fixing up bugs
|
||||
and adding stuff) are these:
|
||||
|
||||
* To take advantage of the parallelism of OpenGL to make the tegl
|
||||
module a lot smaller. Many OpenGL function have the same signature
|
||||
(same argument and return types) and I can save a lot of code by
|
||||
generating one function with that signature, and calling it with a
|
||||
function pointer (and maybe a size index or two).
|
||||
|
||||
* To support sequences and buffers for the same argument at the same
|
||||
time. This isn't as straightforward as it looks, though, since for
|
||||
objects that support both protocols, the results could be different
|
||||
depending on whether it's treated as a buffer or a sequence. I have
|
||||
to figure out what the most reasonable behavior is.
|
||||
|
||||
|
||||
BUGS
|
||||
----
|
||||
|
||||
Yes.
|
||||
|
||||
|
||||
CHANGES FROM 001
|
||||
----------------
|
||||
|
||||
Added #define GL_EXT_PROTOTYPES. Since Tegl depends on the C compiler
|
||||
having prototypes available for typecasting arguments, this is pretty
|
||||
important.
|
||||
|
||||
Added handcoded version of glShaderSource(ARB) that only accepts a
|
||||
single string in the source.
|
||||
|
||||
Fixed specification of gluUnProject4.
|
||||
|
||||
|
||||
LICENCE AND COPYRIGHT
|
||||
---------------------
|
||||
|
||||
maketegl.py and maketegl.txt are copyrighted by Carl Banks.
|
||||
|
||||
These files, which comprise the tegl package, are released under a BSD
|
||||
style license. See the file copying for details.
|
||||
|
||||
|
||||
WHY NOT PYOPENGL
|
||||
----------------
|
||||
|
||||
The standard OpenGL package in Python, PyOpenGL, has some limitations
|
||||
(mostly speedwise) that made it undesirable for me.
|
||||
|
||||
Probably the biggest bottleneck is that PyOpenGL calls glGetError
|
||||
after every call. I understand the rationale for this, but its cost
|
||||
is too high for my needs. Another problem is, as far as I know, it
|
||||
does not allow the user to release the GIL around some GL calls.
|
||||
Thirdly, PyOpenGL 3 is based on ctypes. There's nothing wrong with
|
||||
ctypes, but for a usage where speed really does matter, it's much too
|
||||
slow. PyOpenGL 2 is a C extension, and is much faster than PyOpenGL
|
||||
3, but doesn't support recent OpenGL extensions.
|
||||
|
||||
A minor thing I didn't like was that PyOpenGL didn't get rid of the gl
|
||||
prefixes. I prefer namespaces, and would prefer to simply import a gl
|
||||
module and call functions this way: "gl.End()". But PyOpenGL did not
|
||||
support that; I had to write wrappers to pull the symbols apart.
|
||||
|
||||
But the most irritating thing about PyOpenGL is the setuptools entry
|
||||
points, which mean that you cannot simply import the OpenGL modules;
|
||||
you have to go through setuptools. This, among other things, makes
|
||||
distributing programs using PyOpenGL (such as with py2exe) a pain.
|
||||
+3
-2
@@ -75,7 +75,8 @@ void alphamunge_core(PyObject *pysrc,
|
||||
void scale32_core(PyObject *pysrc,
|
||||
PyObject *pydst,
|
||||
float, float, float, float,
|
||||
float, float, float, float);
|
||||
float, float, float, float,
|
||||
int);
|
||||
|
||||
void scale24_core(PyObject *pysrc,
|
||||
PyObject *pydst,
|
||||
@@ -87,7 +88,7 @@ void transform32_core(PyObject *pysrc,
|
||||
float, float,
|
||||
float, float,
|
||||
float, float,
|
||||
int, float);
|
||||
int, float, int);
|
||||
|
||||
void blend32_core(PyObject *pysrca,
|
||||
PyObject *pysrcb,
|
||||
|
||||
+64
-23
@@ -1,10 +1,10 @@
|
||||
|
||||
#!/usr/bin/env python
|
||||
import distutils.core
|
||||
import os
|
||||
import os.path
|
||||
import platform
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
try:
|
||||
import bdist_mpkg
|
||||
@@ -106,7 +106,26 @@ def add_library(name, optional=False):
|
||||
for i in checked:
|
||||
print "-", i
|
||||
sys.exit(-1)
|
||||
|
||||
|
||||
def cython(fn):
|
||||
"""
|
||||
Use cython to generate `fn`.c from `fn`.pyx, if necessary.
|
||||
"""
|
||||
|
||||
c = fn + ".c"
|
||||
pyx = fn + ".pyx"
|
||||
|
||||
if not os.path.exists(pyx):
|
||||
print pyx, "not in current directory, not running cython."
|
||||
return
|
||||
|
||||
if os.path.exists(c) and os.path.getmtime(c) >= os.path.getmtime(pyx):
|
||||
print pyx, "is not newer than", c
|
||||
return
|
||||
|
||||
subprocess.call(["cython", pyx])
|
||||
|
||||
|
||||
add_include("", "zlib.h")
|
||||
add_include("", "png.h")
|
||||
add_include("SDL", "SDL.h")
|
||||
@@ -116,6 +135,7 @@ add_include("", "libavutil/avstring.h")
|
||||
add_include("", "libavformat/avformat.h")
|
||||
add_include("", "libavcodec/avcodec.h")
|
||||
add_include("", "libswscale/swscale.h")
|
||||
add_include("", "GL/glew.h")
|
||||
|
||||
add_library("libSDL")
|
||||
add_library("libpng")
|
||||
@@ -127,6 +147,16 @@ add_library("libfreetype")
|
||||
add_library("libfribidi")
|
||||
add_library("libz")
|
||||
|
||||
has_libglew = add_library("libGLEW", True)
|
||||
has_libglew32 = add_library("libglew32", True)
|
||||
|
||||
|
||||
cython("_renpy")
|
||||
cython("_renpybidi")
|
||||
cython("_renpy_pysdlgl")
|
||||
cython("sound")
|
||||
cython("winmixer")
|
||||
|
||||
extra_link_args = [ ]
|
||||
|
||||
sdl_libraries = [ 'SDL' ]
|
||||
@@ -155,7 +185,7 @@ except:
|
||||
extensions = [ ]
|
||||
py_modules = [ 'pysdlsound.__init__' ]
|
||||
|
||||
rpe = distutils.core.Extension(
|
||||
extensions.append(distutils.core.Extension(
|
||||
"_renpy",
|
||||
[ "IMG_savepng.c", "core.c", "rwobject.c", "_renpy.c", "subpixel.c" ],
|
||||
include_dirs=include_dirs,
|
||||
@@ -163,11 +193,9 @@ rpe = distutils.core.Extension(
|
||||
extra_compile_args=extra_compile_args,
|
||||
extra_link_args=extra_link_args,
|
||||
libraries=sdl_libraries + png_libraries,
|
||||
)
|
||||
))
|
||||
|
||||
extensions.append(rpe)
|
||||
|
||||
renpy_font = distutils.core.Extension(
|
||||
extensions.append(distutils.core.Extension(
|
||||
"_renpy_font",
|
||||
[ "renpy_ttf.c", "renpy_font.c"],
|
||||
include_dirs=include_dirs,
|
||||
@@ -175,11 +203,9 @@ renpy_font = distutils.core.Extension(
|
||||
extra_compile_args=extra_compile_args,
|
||||
extra_link_args=extra_link_args,
|
||||
libraries=sdl_libraries + [ 'freetype', 'z' ],
|
||||
)
|
||||
))
|
||||
|
||||
extensions.append(renpy_font)
|
||||
|
||||
psse = distutils.core.Extension(
|
||||
extensions.append(distutils.core.Extension(
|
||||
"pysdlsound.sound",
|
||||
[ "pss.c", "rwobject.c", "sound.c", "ffdecode.c" ],
|
||||
include_dirs=include_dirs,
|
||||
@@ -187,37 +213,52 @@ psse = distutils.core.Extension(
|
||||
extra_compile_args=extra_compile_args,
|
||||
extra_link_args=extra_link_args,
|
||||
libraries=sound_libraries + sdl_libraries,
|
||||
)
|
||||
))
|
||||
|
||||
extensions.append(psse)
|
||||
|
||||
if winmixer:
|
||||
wme = distutils.core.Extension(
|
||||
extensions.append(distutils.core.Extension(
|
||||
"pysdlsound.winmixer",
|
||||
[ 'winmixer.c' ],
|
||||
libraries=['winmm'],
|
||||
)
|
||||
|
||||
extensions.append(wme)
|
||||
))
|
||||
|
||||
if linmixer:
|
||||
py_modules.append('pysdlsound.linmixer')
|
||||
|
||||
|
||||
renpybidi = distutils.core.Extension(
|
||||
extensions.append(distutils.core.Extension(
|
||||
"_renpybidi",
|
||||
["_renpybidi.c", "renpybidicore.c"],
|
||||
include_dirs=include_dirs,
|
||||
library_dirs=library_dirs,
|
||||
libraries=['fribidi'],
|
||||
)
|
||||
))
|
||||
|
||||
extensions.append(renpybidi)
|
||||
if has_libglew:
|
||||
glew_libs = [ 'GLEW' ]
|
||||
else:
|
||||
glew_libs = [ 'glew32', "opengl32" ]
|
||||
|
||||
|
||||
extensions.append(distutils.core.Extension(
|
||||
"_renpy_tegl",
|
||||
["_renpy_tegl.c"],
|
||||
extra_compile_args=extra_compile_args,
|
||||
include_dirs=include_dirs,
|
||||
library_dirs=library_dirs,
|
||||
libraries=glew_libs))
|
||||
|
||||
extensions.append(distutils.core.Extension(
|
||||
"_renpy_pysdlgl",
|
||||
["_renpy_pysdlgl.c"],
|
||||
extra_compile_args=extra_compile_args,
|
||||
include_dirs=include_dirs,
|
||||
library_dirs=library_dirs,
|
||||
libraries=glew_libs))
|
||||
|
||||
|
||||
distutils.core.setup(
|
||||
name = "renpy_module",
|
||||
version = "6.9.3",
|
||||
version = "6.11.0",
|
||||
ext_modules = extensions,
|
||||
py_modules = py_modules,
|
||||
package_dir = { '' : 'lib' },
|
||||
|
||||
+3453
File diff suppressed because it is too large
Load Diff
+1825
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
dist/msvcr71.dll
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
dist/msvcr90.dll
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
dist/python26.dll
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright 2004-2007 PyTom <pytom@bishoujo.us>
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation files
|
||||
@@ -25,6 +25,7 @@ import os
|
||||
import os.path
|
||||
import sys
|
||||
import platform
|
||||
import warnings
|
||||
|
||||
# Functions to be customized by distributors. ################################
|
||||
|
||||
@@ -81,17 +82,26 @@ def path_to_renpy_base():
|
||||
|
||||
##############################################################################
|
||||
|
||||
# The version of the Mac Launcher and py4renpy that we use.
|
||||
macos_version = (6, 10, 0)
|
||||
linux_version = (6, 10, 0)
|
||||
# The version of the Mac Launcher and py4renpy that we require.
|
||||
macos_version = (6, 10, 1)
|
||||
linux_version = (6, 10, 1)
|
||||
|
||||
# Doing the version check this way also doubles as an import of ast,
|
||||
# which helps py2exe et al.
|
||||
try:
|
||||
import ast; ast
|
||||
except:
|
||||
raise
|
||||
print "Ren'Py requires at least python 2.6."
|
||||
sys.exit(0)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
if not 'RENPY_NO_VERSION_CHECK' in os.environ:
|
||||
|
||||
# Check for mac compatibility.
|
||||
if "mac_version" in globals():
|
||||
mac_version(macos_version)
|
||||
globals()["mac_version"](macos_version)
|
||||
|
||||
# Check py4renpy compatibility.
|
||||
try:
|
||||
@@ -116,6 +126,9 @@ if __name__ == "__main__":
|
||||
if os.path.exists(renpy_base + "/renpy.zip"):
|
||||
sys.path.append(renpy_base + "/renpy.zip")
|
||||
|
||||
# Ignore warnings that happen.
|
||||
warnings.simplefilter("ignore", DeprecationWarning)
|
||||
|
||||
|
||||
# Start Ren'Py proper.
|
||||
try:
|
||||
|
||||
+29
-9
@@ -1,4 +1,4 @@
|
||||
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation files
|
||||
@@ -27,17 +27,21 @@
|
||||
# ***** ***** ***** ***** ***** ***** **** ***** ***** ***** *****
|
||||
# Be sure to change script_version in launcher/script_version.rpy, too!
|
||||
# Also check to see if we have to update renpy.py.
|
||||
version = "Ren'Py 6.10.0e"
|
||||
version = "Ren'Py 6.11.0j"
|
||||
script_version = 5003000
|
||||
savegame_suffix = "-LT1.save"
|
||||
|
||||
def import_all():
|
||||
# True if this is the first time we've started - even including
|
||||
# utter restarts.
|
||||
first_utter_start = True
|
||||
|
||||
import renpy.game
|
||||
def import_all():
|
||||
|
||||
# Should probably be early, as we will add it as a base to serialized things.
|
||||
import renpy.object
|
||||
|
||||
import renpy.game
|
||||
|
||||
# Adds in the Ren'Py loader.
|
||||
import renpy.loader
|
||||
|
||||
@@ -56,10 +60,12 @@ def import_all():
|
||||
|
||||
import renpy.display
|
||||
import renpy.display.presplash
|
||||
import renpy.display.iliad # Must be before scale.
|
||||
import renpy.display.iliad # Must be before scale and pgrender.
|
||||
import renpy.display.pgrender
|
||||
import renpy.display.scale # Must be before module.
|
||||
import renpy.display.module
|
||||
import renpy.display.render # Most display stuff depends on this.
|
||||
|
||||
import renpy.display.core # object
|
||||
import renpy.display.font
|
||||
import renpy.display.text # core, font
|
||||
@@ -75,8 +81,12 @@ def import_all():
|
||||
import renpy.display.particle
|
||||
import renpy.display.joystick
|
||||
import renpy.display.minigame
|
||||
import renpy.display.screen
|
||||
import renpy.display.error
|
||||
|
||||
import renpy.display.swdraw
|
||||
import renpy.display.gldraw
|
||||
|
||||
# Note: For windows to work, renpy.audio.audio needs to be after
|
||||
# renpy.display.module.
|
||||
import renpy.audio.audio
|
||||
@@ -84,6 +94,7 @@ def import_all():
|
||||
import renpy.audio.sound
|
||||
|
||||
import renpy.ui
|
||||
import renpy.screenlang
|
||||
|
||||
import renpy.lint
|
||||
import renpy.warp
|
||||
@@ -102,15 +113,22 @@ def import_all():
|
||||
|
||||
# This reloads all modules.
|
||||
def reload_all():
|
||||
|
||||
# Shut down the cache thread.
|
||||
display.im.cache.quit()
|
||||
|
||||
import renpy
|
||||
|
||||
# Shut down the cache thread.
|
||||
renpy.display.im.cache.quit()
|
||||
|
||||
# Cleans out the RenpyImporter.
|
||||
import sys
|
||||
sys.meta_path.pop()
|
||||
|
||||
blacklist = [ "renpy", "renpy.bootstrap", "renpy.display", "renpy.display.iliad", "renpy.display.scale" ]
|
||||
blacklist = [ "renpy",
|
||||
"renpy.bootstrap",
|
||||
"renpy.display",
|
||||
"renpy.display.iliad",
|
||||
"renpy.display.pgrender",
|
||||
"renpy.display.scale" ]
|
||||
|
||||
for i in sys.modules.keys():
|
||||
if i.startswith("renpy") and i not in blacklist:
|
||||
@@ -119,5 +137,7 @@ def reload_all():
|
||||
import gc
|
||||
gc.collect()
|
||||
|
||||
renpy.display.draw = None
|
||||
|
||||
import_all()
|
||||
|
||||
|
||||
+59
-38
@@ -1,4 +1,4 @@
|
||||
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation files
|
||||
@@ -82,7 +82,7 @@ class PyExpr(unicode):
|
||||
|
||||
__slots__ = [
|
||||
'filename',
|
||||
'linenumber'
|
||||
'linenumber',
|
||||
]
|
||||
|
||||
def __new__(cls, s, filename, linenumber):
|
||||
@@ -92,7 +92,7 @@ class PyExpr(unicode):
|
||||
return self
|
||||
|
||||
def __getnewargs__(self):
|
||||
return (unicode(self), self.filename, self.linenumber)
|
||||
return (unicode(self), self.filename, self.linenumber) # E1101
|
||||
|
||||
|
||||
class PyCode(object):
|
||||
@@ -104,17 +104,21 @@ class PyCode(object):
|
||||
'bytecode',
|
||||
]
|
||||
|
||||
# All PyCodes known to the system.
|
||||
extent = [ ]
|
||||
|
||||
def __getstate__(self):
|
||||
return (1, self.source, self.location, self.mode)
|
||||
|
||||
def __setstate__(self, state):
|
||||
(_, self.source, self.location, self.mode) = state
|
||||
self.bytecode = None
|
||||
|
||||
|
||||
if renpy.game.script.record_pycode:
|
||||
renpy.game.script.all_pycode.append(self)
|
||||
|
||||
def __init__(self, source, loc=('<none>', 1), mode='exec'):
|
||||
|
||||
if isinstance(source, PyExpr):
|
||||
loc = (source.filename, source.linenumber, source)
|
||||
|
||||
# The source code.
|
||||
self.source = source
|
||||
|
||||
@@ -126,6 +130,9 @@ class PyCode(object):
|
||||
# This will be initialized later on, after we are serialized.
|
||||
self.bytecode = None
|
||||
|
||||
if renpy.game.script.record_pycode:
|
||||
renpy.game.script.all_pycode.append(self)
|
||||
|
||||
def chain_block(block, next):
|
||||
"""
|
||||
This is called to chain together all of the nodes in a block. Node
|
||||
@@ -186,6 +193,7 @@ class Node(object):
|
||||
|
||||
self.filename, self.linenumber = loc
|
||||
self.name = None
|
||||
self.next = None
|
||||
|
||||
def diff_info(self):
|
||||
"""
|
||||
@@ -251,14 +259,6 @@ class Node(object):
|
||||
else:
|
||||
return [ ]
|
||||
|
||||
def get_pycode(self):
|
||||
"""
|
||||
Returns a list of PyCode objects associated with this Node,
|
||||
or None if no objects are associated with it.
|
||||
"""
|
||||
|
||||
return [ ]
|
||||
|
||||
def scry(self):
|
||||
"""
|
||||
Called to return an object with some general, user-definable information
|
||||
@@ -266,7 +266,7 @@ class Node(object):
|
||||
"""
|
||||
|
||||
rv = Scry()
|
||||
rv._next = self.next
|
||||
rv._next = self.next # W0201
|
||||
return rv
|
||||
|
||||
def say_menu_with(expression, callback):
|
||||
@@ -334,7 +334,7 @@ class Say(Node):
|
||||
|
||||
what = self.what
|
||||
if renpy.config.say_menu_text_filter:
|
||||
what = renpy.config.say_menu_text_filter(what)
|
||||
what = renpy.config.say_menu_text_filter(what) # E1102
|
||||
|
||||
say_menu_with(self.with_, renpy.game.interface.set_transition)
|
||||
renpy.exports.say(who, what, interact=getattr(self, 'interact', True))
|
||||
@@ -372,11 +372,24 @@ class Say(Node):
|
||||
|
||||
def scry(self):
|
||||
rv = Node.scry(self)
|
||||
rv.interacts = True
|
||||
|
||||
if self.who is not None:
|
||||
if self.who_fast:
|
||||
who = getattr(renpy.store, self.who)
|
||||
else:
|
||||
who = renpy.python.py_eval(self.who)
|
||||
else:
|
||||
who = None
|
||||
|
||||
if self.interact:
|
||||
renpy.exports.scry_say(who, rv)
|
||||
else:
|
||||
rv.interacts = False
|
||||
|
||||
return rv
|
||||
|
||||
# Copy the descriptor.
|
||||
setattr(Say, "with", Say.with_)
|
||||
setattr(Say, "with", Say.with_) # E1101
|
||||
|
||||
class Init(Node):
|
||||
|
||||
@@ -547,9 +560,6 @@ class Python(Node):
|
||||
self.hide = hide
|
||||
self.code = PyCode(python_code, loc=loc, mode='exec')
|
||||
|
||||
def get_pycode(self):
|
||||
return [ self.code ]
|
||||
|
||||
def diff_info(self):
|
||||
return (Python, self.code.source)
|
||||
|
||||
@@ -582,9 +592,6 @@ class EarlyPython(Node):
|
||||
self.hide = hide
|
||||
self.code = PyCode(python_code, loc=loc, mode='exec')
|
||||
|
||||
def get_pycode(self):
|
||||
return [ self.code ]
|
||||
|
||||
def diff_info(self):
|
||||
return (EarlyPython, self.code.source)
|
||||
|
||||
@@ -624,12 +631,6 @@ class Image(Node):
|
||||
def diff_info(self):
|
||||
return (Image, tuple(self.imgname))
|
||||
|
||||
def get_pycode(self):
|
||||
if self.code:
|
||||
return [ self.code ]
|
||||
else:
|
||||
return [ ]
|
||||
|
||||
def execute(self):
|
||||
|
||||
# Note: We should always check that self.code is None before
|
||||
@@ -1154,7 +1155,7 @@ class Menu(Node):
|
||||
rv.interacts = True
|
||||
return rv
|
||||
|
||||
setattr(Menu, "with", Menu.with_)
|
||||
setattr(Menu, "with", Menu.with_) # E1101
|
||||
|
||||
|
||||
# Goto is considered harmful. So we decided to name it "jump"
|
||||
@@ -1380,12 +1381,6 @@ class Define(Node):
|
||||
def diff_info(self):
|
||||
return (Define, tuple(self.varname))
|
||||
|
||||
def get_pycode(self):
|
||||
if self.code:
|
||||
return [ self.code ]
|
||||
else:
|
||||
return [ ]
|
||||
|
||||
def execute(self):
|
||||
|
||||
value = renpy.python.py_eval_bytecode(self.code.bytecode)
|
||||
@@ -1393,3 +1388,29 @@ class Define(Node):
|
||||
setattr(renpy.store, self.varname, value)
|
||||
|
||||
return self.next
|
||||
|
||||
|
||||
class Screen(Node):
|
||||
|
||||
__slots__ = [
|
||||
'screen',
|
||||
]
|
||||
|
||||
def __init__(self, loc, screen):
|
||||
"""
|
||||
@param name: The name of the image being defined.
|
||||
|
||||
@param expr: An expression yielding a Displayable that is
|
||||
assigned to the image.
|
||||
"""
|
||||
|
||||
super(Screen, self).__init__(loc)
|
||||
|
||||
self.screen = screen
|
||||
|
||||
def diff_info(self):
|
||||
return (Screen, self.screen.name)
|
||||
|
||||
def execute(self):
|
||||
self.screen.define()
|
||||
return self.next
|
||||
|
||||
+168
-85
@@ -1,4 +1,4 @@
|
||||
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation files
|
||||
@@ -61,10 +61,15 @@ PROPERTIES = {
|
||||
"anchor" : (position, position),
|
||||
"xanchor" : position,
|
||||
"yanchor" : position,
|
||||
"xaround" : position,
|
||||
"yaround" : position,
|
||||
"xanchoraround" : float,
|
||||
"yanchoraround" : float,
|
||||
"align" : (float, float),
|
||||
"xalign" : float,
|
||||
"yalign" : float,
|
||||
"rotate" : float,
|
||||
"rotate_pad" : bool,
|
||||
"xzoom" : float,
|
||||
"yzoom" : float,
|
||||
"zoom" : float,
|
||||
@@ -79,15 +84,22 @@ PROPERTIES = {
|
||||
"corner2" : (float, float),
|
||||
"subpixel" : bool,
|
||||
"delay" : float,
|
||||
"xoffset" : int,
|
||||
"yoffset" : int,
|
||||
"offset" : (int, int),
|
||||
}
|
||||
|
||||
|
||||
def correct_type(v, b, ty):
|
||||
"""
|
||||
Corrects the type of v to match ty. b is used to inform the match.
|
||||
"""
|
||||
|
||||
if ty is position:
|
||||
return type(b)(v)
|
||||
if v is None:
|
||||
return None
|
||||
else:
|
||||
return type(b)(v)
|
||||
else:
|
||||
return ty(v)
|
||||
|
||||
@@ -104,15 +116,18 @@ def interpolate(t, a, b, type):
|
||||
if isinstance(b, tuple):
|
||||
return tuple(interpolate(t, i, j, ty) for i, j, ty in zip(a, b, type))
|
||||
|
||||
# Deal with strings or booleans.
|
||||
elif isinstance(b, (str, unicode)):
|
||||
# Deal with booleans, nones, etc.
|
||||
elif b is None or isinstance(b, bool):
|
||||
if t >= 1.0:
|
||||
return a
|
||||
else:
|
||||
return b
|
||||
else:
|
||||
return a
|
||||
|
||||
# Interpolate everything else.
|
||||
else:
|
||||
if a is None:
|
||||
a = 0
|
||||
|
||||
return correct_type(a + t * (b - a), b, type)
|
||||
|
||||
# Interpolate the value of a spline. This code is based on Aenakume's code,
|
||||
@@ -168,6 +183,8 @@ class ATLTransformBase(renpy.object.Object):
|
||||
parameters = renpy.ast.ParameterInfo([ ], [ ], None, None)
|
||||
|
||||
def __init__(self, atl, context, parameters):
|
||||
|
||||
super(ATLTransformBase, self).__init__()
|
||||
|
||||
if parameters is None:
|
||||
parameters = ATLTransformBase.parameters
|
||||
@@ -211,6 +228,11 @@ class ATLTransformBase(renpy.object.Object):
|
||||
requires that t.atl is self.atl.
|
||||
"""
|
||||
|
||||
super(ATLTransformBase, self).take_execution_state(t)
|
||||
|
||||
if t.atl is not self.atl:
|
||||
return
|
||||
|
||||
self.done = t.done
|
||||
self.block = t.block
|
||||
self.atl_state = t.atl_state
|
||||
@@ -316,6 +338,9 @@ class ATLTransformBase(renpy.object.Object):
|
||||
# Hide request.
|
||||
if trans.hide_request:
|
||||
self.transform_event = "hide"
|
||||
|
||||
if trans.replaced_request:
|
||||
self.transform_event = "replaced"
|
||||
|
||||
# Notice transform events.
|
||||
if self.transform_event != self.last_transform_event:
|
||||
@@ -359,6 +384,10 @@ class ATLTransformBase(renpy.object.Object):
|
||||
# The base class for raw ATL statements.
|
||||
class RawStatement(renpy.object.Object):
|
||||
|
||||
def __init__(self, loc):
|
||||
super(RawStatement, self).__init__()
|
||||
self.loc = loc
|
||||
|
||||
# Compiles this RawStatement into a Statement, by using ctx to
|
||||
# evaluate expressions as necessary.
|
||||
def compile(self, ctx):
|
||||
@@ -372,6 +401,10 @@ class RawStatement(renpy.object.Object):
|
||||
# The base class for compiled ATL Statements.
|
||||
class Statement(renpy.object.Object):
|
||||
|
||||
def __init__(self, loc):
|
||||
super(Statement, self).__init__()
|
||||
self.loc = loc
|
||||
|
||||
# trans is the transform we're working on.
|
||||
# st is the time since this statement started executing.
|
||||
# state is the state stored by this statement, or None if
|
||||
@@ -412,7 +445,7 @@ class RawBlock(RawStatement):
|
||||
|
||||
def __init__(self, loc, statements, animation):
|
||||
|
||||
self.loc = loc
|
||||
super(RawBlock, self).__init__(loc)
|
||||
|
||||
# A list of RawStatements in this block.
|
||||
self.statements = statements
|
||||
@@ -435,7 +468,7 @@ class RawBlock(RawStatement):
|
||||
class Block(Statement):
|
||||
def __init__(self, loc, statements):
|
||||
|
||||
self.loc = loc
|
||||
super(Block, self).__init__(loc)
|
||||
|
||||
# A list of statements in the block.
|
||||
self.statements = statements
|
||||
@@ -488,67 +521,54 @@ class Block(Statement):
|
||||
if index >= len(self.statements):
|
||||
return "next", target - start, None
|
||||
|
||||
try:
|
||||
|
||||
# Find the statement and try to run it.
|
||||
stmt = self.statements[index]
|
||||
action, arg, pause = stmt.execute(trans, target - start, child_state, event)
|
||||
# Find the statement and try to run it.
|
||||
stmt = self.statements[index]
|
||||
action, arg, pause = stmt.execute(trans, target - start, child_state, event)
|
||||
|
||||
# On continue, persist our state.
|
||||
if action == "continue":
|
||||
if pause is None:
|
||||
pause = max_pause
|
||||
|
||||
action, arg, pause = "continue", (index, start, loop_start, repeats, times, arg), min(max_pause, pause)
|
||||
break
|
||||
# On continue, persist our state.
|
||||
if action == "continue":
|
||||
if pause is None:
|
||||
pause = max_pause
|
||||
|
||||
elif action == "event":
|
||||
return action, arg, pause
|
||||
|
||||
# On next, advance to the next statement in the block.
|
||||
elif action == "next":
|
||||
index += 1
|
||||
start = target - arg
|
||||
child_state = None
|
||||
action, arg, pause = "continue", (index, start, loop_start, repeats, times, arg), min(max_pause, pause)
|
||||
break
|
||||
|
||||
# On repeat, either terminate the block, or go to
|
||||
# the first statement.
|
||||
elif action == "repeat":
|
||||
|
||||
count, arg = arg
|
||||
loop_end = target - arg
|
||||
duration = loop_end - loop_start
|
||||
|
||||
# Figure how many durations can occur between the
|
||||
# start of the loop and now.
|
||||
new_repeats = int((target - loop_start) / duration)
|
||||
|
||||
if duration <= 0:
|
||||
raise Exception("ATL appears to be in an infinite loop.")
|
||||
|
||||
if count is not None:
|
||||
if repeats + new_repeats >= count:
|
||||
new_repeats = count - repeats
|
||||
loop_start += new_repeats * duration
|
||||
return "next", target - loop_start, None
|
||||
|
||||
repeats += new_repeats
|
||||
loop_start = loop_start + new_repeats * duration
|
||||
start = loop_start
|
||||
index = 0
|
||||
child_state = None
|
||||
|
||||
except:
|
||||
# If an exception occurs when dealing with a statment,
|
||||
# advance to the next statement.
|
||||
|
||||
if renpy.config.debug:
|
||||
raise
|
||||
elif action == "event":
|
||||
return action, arg, pause
|
||||
|
||||
# On next, advance to the next statement in the block.
|
||||
elif action == "next":
|
||||
index += 1
|
||||
start = target
|
||||
start = target - arg
|
||||
child_state = None
|
||||
|
||||
# On repeat, either terminate the block, or go to
|
||||
# the first statement.
|
||||
elif action == "repeat":
|
||||
|
||||
count, arg = arg
|
||||
loop_end = target - arg
|
||||
duration = loop_end - loop_start
|
||||
|
||||
# Figure how many durations can occur between the
|
||||
# start of the loop and now.
|
||||
new_repeats = int((target - loop_start) / duration)
|
||||
|
||||
if duration <= 0:
|
||||
raise Exception("ATL appears to be in an infinite loop.")
|
||||
|
||||
if count is not None:
|
||||
if repeats + new_repeats >= count:
|
||||
new_repeats = count - repeats
|
||||
loop_start += new_repeats * duration
|
||||
return "next", target - loop_start, None
|
||||
|
||||
repeats += new_repeats
|
||||
loop_start = loop_start + new_repeats * duration
|
||||
start = loop_start
|
||||
index = 0
|
||||
child_state = None
|
||||
|
||||
if times:
|
||||
time, tindex = times[0]
|
||||
@@ -583,7 +603,7 @@ class RawMultipurpose(RawStatement):
|
||||
|
||||
def __init__(self, loc):
|
||||
|
||||
self.loc = loc
|
||||
super(RawMultipurpose, self).__init__(loc)
|
||||
|
||||
self.warper = None
|
||||
self.duration = None
|
||||
@@ -722,7 +742,9 @@ class RawMultipurpose(RawStatement):
|
||||
class RawContainsExpr(RawStatement):
|
||||
|
||||
def __init__(self, loc, expr):
|
||||
self.loc = loc
|
||||
|
||||
super(RawContainsExpr, self).__init__(loc)
|
||||
|
||||
self.expression = expr
|
||||
|
||||
def compile(self, ctx):
|
||||
@@ -735,7 +757,9 @@ class RawContainsExpr(RawStatement):
|
||||
class RawChild(RawStatement):
|
||||
|
||||
def __init__(self, loc, child):
|
||||
self.loc = loc
|
||||
|
||||
super(RawChild, self).__init__(loc)
|
||||
|
||||
self.children = [ child ]
|
||||
|
||||
def compile(self, ctx):
|
||||
@@ -751,8 +775,9 @@ class RawChild(RawStatement):
|
||||
class Child(Statement):
|
||||
|
||||
def __init__(self, loc, child, transition):
|
||||
self.loc = loc
|
||||
|
||||
super(Child, self).__init__(loc)
|
||||
|
||||
self.child = renpy.easy.displayable(child)
|
||||
self.transition = transition
|
||||
|
||||
@@ -781,7 +806,9 @@ class Child(Statement):
|
||||
class Interpolation(Statement):
|
||||
|
||||
def __init__(self, loc, warper, duration, properties, revolution, circles, splines):
|
||||
self.loc = loc
|
||||
|
||||
super(Interpolation, self).__init__(loc)
|
||||
|
||||
self.warper = warper
|
||||
self.duration = duration
|
||||
self.properties = properties
|
||||
@@ -819,6 +846,13 @@ class Interpolation(Statement):
|
||||
# Now, the things we change linearly are in the difference
|
||||
# between the new and old states.
|
||||
linear = trans.state.diff(newts)
|
||||
|
||||
# Ensure that we set things, even if they don't actually
|
||||
# change from the old state.
|
||||
for k, v in self.properties:
|
||||
if k not in linear:
|
||||
setattr(trans.state, k, v)
|
||||
|
||||
revolution = None
|
||||
splines = [ ]
|
||||
|
||||
@@ -878,13 +912,14 @@ class Interpolation(Statement):
|
||||
# Linearly interpolate between the things in linear.
|
||||
for k, (old, new) in linear.iteritems():
|
||||
value = interpolate(complete, old, new, PROPERTIES[k])
|
||||
setattr(trans.state, k, value)
|
||||
|
||||
setattr(trans.state, k, value)
|
||||
|
||||
# Handle the revolution.
|
||||
if revolution is not None:
|
||||
startangle, endangle, startradius, endradius = revolution
|
||||
trans.state.angle = interpolate(complete, startangle, endangle)
|
||||
trans.state.radius = interpolate(complete, startradius, endradius)
|
||||
trans.state.angle = interpolate(complete, startangle, endangle, float)
|
||||
trans.state.radius = interpolate(complete, startradius, endradius, float)
|
||||
|
||||
# Handle any splines we might have.
|
||||
for name, values in splines:
|
||||
@@ -904,7 +939,9 @@ class Interpolation(Statement):
|
||||
class RawRepeat(RawStatement):
|
||||
|
||||
def __init__(self, loc, repeats):
|
||||
self.loc = loc
|
||||
|
||||
super(RawRepeat, self).__init__(loc)
|
||||
|
||||
self.repeats = repeats
|
||||
|
||||
def compile(self, ctx):
|
||||
@@ -921,7 +958,9 @@ class RawRepeat(RawStatement):
|
||||
class Repeat(Statement):
|
||||
|
||||
def __init__(self, loc, repeats):
|
||||
self.loc = loc
|
||||
|
||||
super(Repeat, self).__init__(loc)
|
||||
|
||||
self.repeats = repeats
|
||||
|
||||
def execute(self, trans, st, state, event):
|
||||
@@ -933,7 +972,8 @@ class Repeat(Statement):
|
||||
class RawParallel(RawStatement):
|
||||
|
||||
def __init__(self, loc, block):
|
||||
self.loc = loc
|
||||
|
||||
super(RawParallel, self).__init__(loc)
|
||||
self.blocks = [ block ]
|
||||
|
||||
def compile(self, ctx):
|
||||
@@ -945,9 +985,9 @@ class RawParallel(RawStatement):
|
||||
|
||||
|
||||
class Parallel(Statement):
|
||||
|
||||
|
||||
def __init__(self, loc, blocks):
|
||||
self.loc = loc
|
||||
super(Parallel, self).__init__(loc)
|
||||
self.blocks = blocks
|
||||
|
||||
def execute(self, trans, st, state, event):
|
||||
@@ -994,7 +1034,8 @@ class Parallel(Statement):
|
||||
class RawChoice(RawStatement):
|
||||
|
||||
def __init__(self, loc, chance, block):
|
||||
self.loc = loc
|
||||
super(RawChoice, self).__init__(loc)
|
||||
|
||||
self.choices = [ (chance, block) ]
|
||||
|
||||
def compile(self, ctx):
|
||||
@@ -1008,7 +1049,9 @@ class RawChoice(RawStatement):
|
||||
class Choice(Statement):
|
||||
|
||||
def __init__(self, loc, choices):
|
||||
self.loc = loc
|
||||
|
||||
super(Choice, self).__init__(loc)
|
||||
|
||||
self.choices = choices
|
||||
|
||||
def execute(self, trans, st, state, event):
|
||||
@@ -1049,7 +1092,8 @@ class Choice(Statement):
|
||||
class RawTime(RawStatement):
|
||||
|
||||
def __init__(self, loc, time):
|
||||
self.loc = loc
|
||||
|
||||
super(RawTime, self).__init__(loc)
|
||||
self.time = time
|
||||
|
||||
def compile(self, ctx):
|
||||
@@ -1059,7 +1103,8 @@ class RawTime(RawStatement):
|
||||
class Time(Statement):
|
||||
|
||||
def __init__(self, loc, time):
|
||||
self.loc = loc
|
||||
super(Time, self).__init__(loc)
|
||||
|
||||
self.time = time
|
||||
|
||||
def execute(self, trans, st, state, event):
|
||||
@@ -1071,7 +1116,8 @@ class Time(Statement):
|
||||
class RawOn(RawStatement):
|
||||
|
||||
def __init__(self, loc, name, block):
|
||||
self.loc = loc
|
||||
super(RawOn, self).__init__(loc)
|
||||
|
||||
self.handlers = { name : block }
|
||||
|
||||
def compile(self, ctx):
|
||||
@@ -1092,13 +1138,13 @@ class RawOn(RawStatement):
|
||||
class On(Statement):
|
||||
|
||||
def __init__(self, loc, handlers):
|
||||
self.loc = loc
|
||||
super(On, self).__init__(loc)
|
||||
|
||||
self.handlers = handlers
|
||||
|
||||
def execute(self, trans, st, state, event):
|
||||
|
||||
executing(self.loc)
|
||||
|
||||
|
||||
# If it's our first time through, start in the start state.
|
||||
if state is None:
|
||||
@@ -1130,9 +1176,10 @@ class On(Statement):
|
||||
if action == "continue":
|
||||
|
||||
# If it comes from a hide block, indicate that.
|
||||
if name == "hide":
|
||||
if name == "hide" or name == "replaced":
|
||||
trans.hide_response = False
|
||||
|
||||
trans.replaced_response = False
|
||||
|
||||
return "continue", (name, start, arg), pause
|
||||
|
||||
# If we get a next, then try going to the default
|
||||
@@ -1171,7 +1218,8 @@ class On(Statement):
|
||||
class RawEvent(RawStatement):
|
||||
|
||||
def __init__(self, loc, name):
|
||||
self.loc = loc
|
||||
super(RawEvent, self).__init__(loc)
|
||||
|
||||
self.name = name
|
||||
|
||||
def compile(self, ctx):
|
||||
@@ -1181,12 +1229,41 @@ class RawEvent(RawStatement):
|
||||
class Event(Statement):
|
||||
|
||||
def __init__(self, loc, name):
|
||||
self.loc = loc
|
||||
super(Event, self).__init__(loc)
|
||||
|
||||
self.name = name
|
||||
|
||||
def execute(self, trans, st, state, event):
|
||||
return "event", (self.name, st), None
|
||||
|
||||
|
||||
class RawFunction(RawStatement):
|
||||
|
||||
def __init__(self, loc, expr):
|
||||
super(RawFunction, self).__init__(loc)
|
||||
|
||||
self.expr = expr
|
||||
|
||||
def compile(self, ctx):
|
||||
compiling(self.loc)
|
||||
return Function(self.loc, ctx.eval(self.expr))
|
||||
|
||||
|
||||
class Function(Statement):
|
||||
|
||||
def __init__(self, loc, function):
|
||||
super(Function, self).__init__(loc)
|
||||
|
||||
self.function = function
|
||||
|
||||
def execute(self, trans, st, state, event):
|
||||
fr = self.function(trans, st, trans.at)
|
||||
|
||||
if fr is not None:
|
||||
return "continue", None, fr
|
||||
else:
|
||||
return "next", 0, None
|
||||
|
||||
|
||||
# This parses an ATL block.
|
||||
def parse_atl(l):
|
||||
@@ -1271,6 +1348,12 @@ def parse_atl(l):
|
||||
|
||||
statements.append(RawTime(loc, time))
|
||||
|
||||
elif l.keyword('function'):
|
||||
expr = l.require(l.simple_expression)
|
||||
l.expect_noblock('function')
|
||||
|
||||
statements.append(RawFunction(loc, expr))
|
||||
|
||||
elif l.keyword('event'):
|
||||
name = l.require(l.word)
|
||||
l.expect_noblock('event')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation files
|
||||
|
||||
+123
-28
@@ -1,4 +1,4 @@
|
||||
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation files
|
||||
@@ -26,10 +26,10 @@
|
||||
|
||||
import renpy
|
||||
|
||||
import time
|
||||
import pygame
|
||||
import os
|
||||
import atexit
|
||||
import time
|
||||
|
||||
# Import the appropriate modules, or set them to None if we cannot.
|
||||
|
||||
@@ -48,15 +48,18 @@ if 'pss' not in disable:
|
||||
|
||||
if 'mix' not in disable:
|
||||
try:
|
||||
import winmixer as mix
|
||||
import winmixer as mix; mix
|
||||
except:
|
||||
try:
|
||||
import linmixer as mix
|
||||
import linmixer as mix; mix
|
||||
except:
|
||||
pass
|
||||
|
||||
# Save the mixer, and restore it at exit.
|
||||
|
||||
old_wave = None
|
||||
old_midi = None
|
||||
|
||||
if mix:
|
||||
|
||||
mixer_enabled = False
|
||||
@@ -139,6 +142,8 @@ class MusicContext(renpy.python.RevertableObject):
|
||||
|
||||
def __init__(self):
|
||||
|
||||
super(MusicContext, self).__init__()
|
||||
|
||||
# The time this channel was last ordered panned.
|
||||
self.pan_time = None
|
||||
|
||||
@@ -181,7 +186,7 @@ class Channel(object):
|
||||
This stores information about the currently-playing music.
|
||||
"""
|
||||
|
||||
def __init__(self, name, default_loop, stop_on_mute, tight):
|
||||
def __init__(self, name, default_loop, stop_on_mute, tight, file_prefix, file_suffix, buffer_queue):
|
||||
|
||||
# The name assigned to this channel. This is used to look up
|
||||
# information about the channel in the MusicContext object.
|
||||
@@ -245,6 +250,12 @@ class Channel(object):
|
||||
# on queue clear.
|
||||
self.keep_queue = 0
|
||||
|
||||
# A prefix and suffix that are used to create the full filenames.
|
||||
self.file_prefix = file_prefix
|
||||
self.file_suffix = file_suffix
|
||||
|
||||
# Should we buffer upcoming music/video in the queue?
|
||||
self.buffer_queue = buffer_queue
|
||||
|
||||
if default_loop is None:
|
||||
# By default, should we loop the music?
|
||||
@@ -283,7 +294,7 @@ class Channel(object):
|
||||
|
||||
rv = mcd.get(self.name)
|
||||
if rv is None:
|
||||
rv = mcd[self.name] = MusicContext();
|
||||
rv = mcd[self.name] = MusicContext()
|
||||
|
||||
return rv
|
||||
|
||||
@@ -335,6 +346,11 @@ class Channel(object):
|
||||
if depth >= 2:
|
||||
break
|
||||
|
||||
# If we can't buffer things, and we're playing something
|
||||
# give up here.
|
||||
if not self.buffer_queue and depth >= 1:
|
||||
break
|
||||
|
||||
# We can't queue anything if the depth is > 0 and we're
|
||||
# waiting for a synchro_start.
|
||||
if self.synchro_start and depth:
|
||||
@@ -349,7 +365,7 @@ class Channel(object):
|
||||
|
||||
# Blacklist of old file formats we used to support, but we now
|
||||
# ignore.
|
||||
lfn = topq.filename.lower()
|
||||
lfn = topq.filename.lower() + self.file_suffix.lower()
|
||||
for i in (".mod", ".xm", ".mid", ".midi"):
|
||||
if lfn.endswith(i):
|
||||
topq = None
|
||||
@@ -358,7 +374,7 @@ class Channel(object):
|
||||
continue
|
||||
|
||||
try:
|
||||
topf = load(topq.filename)
|
||||
topf = load(self.file_prefix + topq.filename + self.file_suffix)
|
||||
|
||||
if depth == 0:
|
||||
pss.play(self.number, topf, topq.filename, paused=self.synchro_start, fadein=topq.fadein, tight=topq.tight)
|
||||
@@ -368,6 +384,12 @@ class Channel(object):
|
||||
self.playing = True
|
||||
|
||||
except:
|
||||
|
||||
# If playing failed, remove topq.filename from self.loop
|
||||
# so we don't keep trying.
|
||||
while topq.filename in self.loop:
|
||||
self.loop.remove(topq.filename)
|
||||
|
||||
if renpy.config.debug_sound:
|
||||
raise
|
||||
else:
|
||||
@@ -384,7 +406,7 @@ class Channel(object):
|
||||
|
||||
# Queue empty callback.
|
||||
if do_callback and self.callback:
|
||||
self.callback()
|
||||
self.callback() # E1102
|
||||
|
||||
def dequeue(self, even_tight=False):
|
||||
"""
|
||||
@@ -424,11 +446,9 @@ class Channel(object):
|
||||
pss.set_secondary_volume(self.number,
|
||||
self.context.secondary_volume,
|
||||
0)
|
||||
|
||||
self.pan_delay = 0
|
||||
|
||||
if not self.queue and self.callback:
|
||||
self.callback()
|
||||
self.callback() # E1102
|
||||
|
||||
|
||||
def fadeout(self, secs):
|
||||
@@ -448,7 +468,6 @@ class Channel(object):
|
||||
else:
|
||||
pss.fadeout(self.number, int(secs * 1000))
|
||||
|
||||
|
||||
def enqueue(self, filenames, loop=True, synchro_start=False, fadein=0, tight=None):
|
||||
|
||||
for filename in filenames:
|
||||
@@ -482,8 +501,19 @@ class Channel(object):
|
||||
if not pcm_ok:
|
||||
return None
|
||||
|
||||
return pss.playing_name(self.number)
|
||||
rv = pss.playing_name(self.number)
|
||||
|
||||
if rv is None and self.queue:
|
||||
rv = self.queue[0].filename
|
||||
|
||||
if rv is None and self.loop:
|
||||
rv = self.loop[0]
|
||||
|
||||
return rv
|
||||
|
||||
|
||||
|
||||
|
||||
def set_volume(self, volume):
|
||||
self.chan_volume = volume
|
||||
|
||||
@@ -519,14 +549,52 @@ all_channels = [ ]
|
||||
channels = { }
|
||||
|
||||
|
||||
def register_channel(name, mixer=None, loop=None, stop_on_mute=True, tight=False):
|
||||
def register_channel(name, mixer=None, loop=None, stop_on_mute=True, tight=False, file_prefix="", file_suffix="", buffer_queue=False):
|
||||
"""
|
||||
:doc: other
|
||||
|
||||
This registers a new audio channel named `name`. Audio can then be
|
||||
played on the channel by supplying the channel name to the play or
|
||||
queue statements.
|
||||
|
||||
`mixer`
|
||||
The name of the mixer the channel uses. By default, Ren'Py
|
||||
knows about the "music", "sfx", and "voice" mixers. Using
|
||||
other names is possible, but may require changing the
|
||||
preferences screens.
|
||||
|
||||
`loop`
|
||||
If true, sounds on this channel loop by default.
|
||||
|
||||
`stop_on_mute`
|
||||
If true, music on the channel is stopped when the channel is muted.
|
||||
|
||||
`tight`
|
||||
If true, sounds will loop even when fadeout is occuring. This should
|
||||
be set to True for a sound effects or seamless music channel, and False
|
||||
if the music fades out on its own.
|
||||
|
||||
`file_prefix`
|
||||
A prefix that is prepended to the filenames of the sound files being
|
||||
played on this channel.
|
||||
|
||||
`file_suffix`
|
||||
A suffix that is appended to the filenames of the sound files being
|
||||
played on this channel.
|
||||
|
||||
`buffer_queue`
|
||||
Should we buffer the first second or so of a queued file? This should
|
||||
be True for audio, and False for movie playback.
|
||||
"""
|
||||
|
||||
if not renpy.game.init_phase:
|
||||
raise Exception("Can't register channel outside of init phase.")
|
||||
|
||||
c = Channel(name, loop, stop_on_mute, tight)
|
||||
c = Channel(name, loop, stop_on_mute, tight, file_prefix, file_suffix, buffer_queue)
|
||||
c.mixer = mixer
|
||||
all_channels.append(c)
|
||||
channels[name] = c
|
||||
|
||||
|
||||
def alias_channel(name, newname):
|
||||
if not renpy.game.init_phase:
|
||||
@@ -534,6 +602,7 @@ def alias_channel(name, newname):
|
||||
|
||||
c = get_channel(name)
|
||||
channels[newname] = c
|
||||
|
||||
|
||||
def get_channel(name):
|
||||
|
||||
@@ -591,7 +660,6 @@ def init():
|
||||
def quit():
|
||||
|
||||
global pcm_ok
|
||||
global midi_ok
|
||||
global mix_ok
|
||||
|
||||
if not pcm_ok:
|
||||
@@ -664,7 +732,7 @@ def periodic():
|
||||
|
||||
anything_playing = False
|
||||
|
||||
for c in channels:
|
||||
for c in all_channels:
|
||||
vol = c.chan_volume * volumes[c.mixer]
|
||||
max_volume = max(max_volume, vol)
|
||||
|
||||
@@ -751,10 +819,37 @@ def interact():
|
||||
|
||||
periodic()
|
||||
|
||||
def rollback():
|
||||
"""
|
||||
On rollback, we want to stop all the channels with non-empty sounds.
|
||||
"""
|
||||
|
||||
for c in all_channels:
|
||||
if not c.loop:
|
||||
c.fadeout(0)
|
||||
|
||||
|
||||
|
||||
ALLOC_EVENT = pygame.USEREVENT
|
||||
REFRESH_EVENT = pygame.USEREVENT + 1
|
||||
|
||||
|
||||
# The last surface we allocated.
|
||||
last_alloc_surface = None
|
||||
|
||||
def alloc_surface(force):
|
||||
|
||||
global last_alloc_surface
|
||||
|
||||
if renpy.display.video.fullscreen and renpy.display.draw.fullscreen_surface:
|
||||
surf = renpy.display.draw.fullscreen_surface
|
||||
else:
|
||||
surf = renpy.display.video.surface
|
||||
|
||||
if (surf is not last_alloc_surface) or force:
|
||||
last_alloc_surface = surf
|
||||
pss.alloc_event(surf)
|
||||
|
||||
def event(ev):
|
||||
"""
|
||||
Handles an event generated by pss (really, the ffdecode
|
||||
@@ -765,21 +860,21 @@ def event(ev):
|
||||
if not pcm_ok:
|
||||
return False
|
||||
|
||||
|
||||
if ev.type == ALLOC_EVENT:
|
||||
if renpy.display.video.fullscreen or not renpy.display.video.surface:
|
||||
surf = pygame.display.get_surface()
|
||||
else:
|
||||
surf = renpy.display.video.surface
|
||||
|
||||
pss.alloc_event(renpy.display.scale.real(surf))
|
||||
|
||||
|
||||
alloc_surface(True)
|
||||
|
||||
return True
|
||||
|
||||
if ev.type == REFRESH_EVENT:
|
||||
elif ev.type == REFRESH_EVENT:
|
||||
|
||||
alloc_surface(False)
|
||||
|
||||
if renpy.audio.music.get_playing("movie"):
|
||||
pss.refresh_event()
|
||||
|
||||
|
||||
renpy.game.interface.force_redraw = True
|
||||
|
||||
# Return False, as a Movie should get this to know when to
|
||||
# redraw itself.
|
||||
return False
|
||||
|
||||
+14
-3
@@ -1,4 +1,4 @@
|
||||
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation files
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
# The public API for music in games.
|
||||
|
||||
import time
|
||||
import renpy
|
||||
|
||||
# A list of music channels.
|
||||
@@ -34,6 +33,7 @@ from renpy.audio.audio import get_channel, get_serial
|
||||
|
||||
# Part of the public api:
|
||||
from renpy.audio.audio import register_channel, alias_channel
|
||||
register_channel; alias_channel
|
||||
|
||||
def play(filenames, channel="music", loop=None, fadeout=None, synchro_start=False, fadein=0, tight=None, if_changed=False):
|
||||
"""
|
||||
@@ -169,6 +169,17 @@ def queue(filenames, channel="music", loop=None, clear_queue=True, fadein=0, tig
|
||||
if renpy.config.debug_sound:
|
||||
raise
|
||||
|
||||
def playable(filename, channel="music"):
|
||||
"""
|
||||
Return true if the given filename is playable on the channel. This
|
||||
takes into account the prefix and suffix.
|
||||
"""
|
||||
|
||||
c = get_channel(channel)
|
||||
|
||||
return renpy.loader.loadable(c.file_prefix + filename + c.file_suffix)
|
||||
|
||||
|
||||
def stop(channel="music", fadeout=None):
|
||||
"""
|
||||
This stops the music that is currently playing, and dequeues all
|
||||
@@ -333,7 +344,7 @@ def channel_defined(channel):
|
||||
"""
|
||||
|
||||
try:
|
||||
c = renpy.audio.audio.get_channel(channel)
|
||||
renpy.audio.audio.get_channel(channel)
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation files
|
||||
@@ -37,8 +37,6 @@ def play(filename, channel="sound", fadeout=0, fadein=0, tight=False, loop=False
|
||||
fadein=fadein,
|
||||
tight=tight,
|
||||
loop=loop)
|
||||
|
||||
|
||||
|
||||
def queue(filename, channel="sound", clear_queue=True, fadein=0, tight=False, loop=False):
|
||||
renpy.audio.music.queue(filename,
|
||||
|
||||
+95
-82
@@ -26,7 +26,7 @@ import sys
|
||||
|
||||
# Extra things used for distribution.
|
||||
def extra_imports():
|
||||
import datetime
|
||||
import datetime; datetime
|
||||
import encodings.ascii
|
||||
import encodings.utf_8
|
||||
import encodings.zlib_codec
|
||||
@@ -35,29 +35,33 @@ def extra_imports():
|
||||
import encodings.raw_unicode_escape
|
||||
import encodings.mbcs
|
||||
import encodings.utf_16_be
|
||||
import encodings.utf_16_le
|
||||
import math
|
||||
import glob
|
||||
import pickle
|
||||
import platform
|
||||
import encodings.utf_16_le; encodings.utf_16_le
|
||||
import math; math
|
||||
import glob; glob
|
||||
import pickle; pickle
|
||||
import platform; platform
|
||||
import pysdlsound
|
||||
import pysdlsound.sound
|
||||
import pysdlsound.winmixer
|
||||
import pysdlsound.linmixer
|
||||
import difflib
|
||||
import shutil
|
||||
import pysdlsound.linmixer; pysdlsound.linmixer
|
||||
import difflib; difflib
|
||||
import shutil; shutil
|
||||
import renpy.tools.archiver
|
||||
import renpy.tools.add_from
|
||||
import tarfile
|
||||
import bz2
|
||||
import webbrowser
|
||||
import renpy.tools.add_from; renpy.tools.add_from
|
||||
import tarfile; tarfile
|
||||
import bz2; bz2
|
||||
import webbrowser; webbrowser
|
||||
import pygame.locals
|
||||
import pygame.color
|
||||
import pygame.colordict
|
||||
import posixpath
|
||||
import pygame.colordict; pygame.colordict
|
||||
import posixpath; posixpath # W0403
|
||||
import ctypes
|
||||
import ctypes.wintypes
|
||||
import EasyDialogs
|
||||
import ctypes.wintypes; ctypes.wintypes
|
||||
import EasyDialogs; EasyDialogs
|
||||
import argparse; argparse
|
||||
import compiler; compiler
|
||||
import textwrap; textwrap
|
||||
import copy; copy
|
||||
|
||||
trace_file = None
|
||||
trace_local = None
|
||||
@@ -84,21 +88,12 @@ def mac_start(fn):
|
||||
os.system("open " + fn)
|
||||
|
||||
# This code fixes a bug in subprocess.Popen.__del__
|
||||
def popen_del(self, _deadstate=sys.maxint):
|
||||
if not self._child_created:
|
||||
return
|
||||
self.poll(_deadstate=_deadstate)
|
||||
def popen_del(self, *args, **kwargs):
|
||||
return
|
||||
|
||||
try:
|
||||
import subprocess
|
||||
if self.returncode is None and subprocess._active is not None:
|
||||
subprocess._active.append(self)
|
||||
except:
|
||||
pass
|
||||
|
||||
def bootstrap(renpy_base):
|
||||
|
||||
global renpy
|
||||
global renpy # W0602
|
||||
|
||||
os.environ["RENPY_BASE"] = os.path.abspath(renpy_base)
|
||||
|
||||
@@ -226,13 +221,9 @@ def bootstrap(renpy_base):
|
||||
|
||||
# Show the presplash.
|
||||
if not options.lint and not options.compile and not options.version and not options.rmpersistent:
|
||||
import renpy.display.presplash
|
||||
import renpy.display.presplash # W0404
|
||||
renpy.display.presplash.start(gamedir)
|
||||
|
||||
# Fix an exception thrown by garbage collection.
|
||||
import subprocess
|
||||
subprocess.Popen.__del__ = popen_del
|
||||
|
||||
# If we're on a mac, install our own os.start.
|
||||
if sys.platform == "darwin":
|
||||
os.startfile = mac_start
|
||||
@@ -248,53 +239,73 @@ def bootstrap(renpy_base):
|
||||
keep_running = True
|
||||
report_error = None
|
||||
|
||||
while keep_running:
|
||||
try:
|
||||
renpy.game.options = options
|
||||
try:
|
||||
while keep_running:
|
||||
try:
|
||||
renpy.game.options = options
|
||||
|
||||
renpy.config.renpy_base = renpy_base
|
||||
renpy.config.basedir = basedir
|
||||
renpy.config.gamedir = gamedir
|
||||
renpy.config.args = options.args
|
||||
|
||||
renpy.main.main()
|
||||
keep_running = False
|
||||
renpy.config.renpy_base = renpy_base
|
||||
renpy.config.basedir = basedir
|
||||
renpy.config.gamedir = gamedir
|
||||
renpy.config.args = options.args
|
||||
|
||||
except KeyboardInterrupt:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
break
|
||||
|
||||
except renpy.game.UtterRestartException:
|
||||
|
||||
# Only works after a full restart.
|
||||
report_error = renpy.display.error.ReportError()
|
||||
|
||||
# On an UtterRestart, reload Ren'Py.
|
||||
renpy.reload_all()
|
||||
continue
|
||||
|
||||
except renpy.game.ParseErrorException:
|
||||
|
||||
if report_error and report_error.report('a parse error'):
|
||||
renpy.reload_all()
|
||||
keep_running = True
|
||||
else:
|
||||
renpy.main.main()
|
||||
keep_running = False
|
||||
|
||||
except KeyboardInterrupt:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
break
|
||||
|
||||
except renpy.game.UtterRestartException:
|
||||
|
||||
if renpy.display.draw:
|
||||
renpy.display.draw.deinit()
|
||||
renpy.display.draw.quit()
|
||||
|
||||
# Only works after a full restart.
|
||||
report_error = renpy.display.error.ReportError()
|
||||
|
||||
# On an UtterRestart, reload Ren'Py.
|
||||
renpy.reload_all()
|
||||
continue
|
||||
|
||||
except renpy.game.ParseErrorException:
|
||||
|
||||
if report_error and report_error.report('a parse error'):
|
||||
renpy.reload_all()
|
||||
keep_running = True
|
||||
else:
|
||||
keep_running = False
|
||||
|
||||
except Exception, e:
|
||||
report_exception(e)
|
||||
|
||||
if report_error and report_error.report('an exception'):
|
||||
renpy.reload_all()
|
||||
keep_running = True
|
||||
else:
|
||||
keep_running = False
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
finally:
|
||||
|
||||
except Exception, e:
|
||||
report_exception(e)
|
||||
if "RENPY_SHUTDOWN_TRACE" in os.environ:
|
||||
enable_trace(int(os.environ["RENPY_SHUTDOWN_TRACE"]))
|
||||
|
||||
if report_error and report_error.report('an exception'):
|
||||
renpy.reload_all()
|
||||
keep_running = True
|
||||
else:
|
||||
keep_running = False
|
||||
|
||||
if options.leak:
|
||||
memory_profile()
|
||||
renpy.display.im.cache.quit()
|
||||
|
||||
sys.exit(0)
|
||||
if renpy.display.draw:
|
||||
renpy.display.draw.quit()
|
||||
|
||||
# Prevent subprocess from throwing errors while trying to run it's
|
||||
# __del__ method during shutdown.
|
||||
import subprocess # W0403
|
||||
subprocess.Popen.__del__ = popen_del # E1101
|
||||
|
||||
if options.leak:
|
||||
memory_profile()
|
||||
|
||||
|
||||
def report_tb(out, tb):
|
||||
@@ -311,6 +322,8 @@ def report_tb(out, tb):
|
||||
elif 'self' in f.f_locals:
|
||||
obj = f.f_locals['self']
|
||||
|
||||
import renpy
|
||||
|
||||
if isinstance(obj, renpy.execution.Context):
|
||||
obj.report_tb(out)
|
||||
|
||||
@@ -325,12 +338,15 @@ def report_exception(e):
|
||||
type, value, tb = sys.exc_info()
|
||||
|
||||
def safe_utf8(e):
|
||||
m = unicode(e)
|
||||
|
||||
try:
|
||||
m = unicode(e)
|
||||
except:
|
||||
m = str(e)
|
||||
|
||||
if isinstance(m, unicode):
|
||||
return m.encode("utf-8")
|
||||
else:
|
||||
return str(m)
|
||||
return m
|
||||
|
||||
# Outside of the file.
|
||||
traceback.print_tb(tb, None, sys.stdout)
|
||||
@@ -347,8 +363,7 @@ def report_exception(e):
|
||||
|
||||
f.write(codecs.BOM_UTF8)
|
||||
|
||||
print >>f, "I'm sorry, but an exception occured while executing your Ren'Py"
|
||||
print >>f, "script."
|
||||
print >>f, "I'm sorry, but an uncaught exception occurred."
|
||||
print >>f
|
||||
|
||||
print >>f, type.__name__ + ":",
|
||||
@@ -389,8 +404,6 @@ def report_exception(e):
|
||||
|
||||
def memory_profile():
|
||||
|
||||
import renpy
|
||||
|
||||
print "Memory Profile"
|
||||
print
|
||||
print "Showing all objects in memory at program termination."
|
||||
|
||||
+201
-73
@@ -1,4 +1,4 @@
|
||||
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation files
|
||||
@@ -22,6 +22,79 @@
|
||||
# The Character object (and friends).
|
||||
|
||||
import renpy
|
||||
import re
|
||||
|
||||
# This matches the dialogue-relevant text tags.
|
||||
TAG_RE = re.compile(r'(\{\{)|(\{(p|w|nw|fast)(?:\=([^}]*))?\})', re.S)
|
||||
|
||||
class DialogueTextTags(object):
|
||||
"""
|
||||
This object parses the text tags that only make sense in dialogue,
|
||||
like {fast}, {p}, {w}, and {nw}.
|
||||
"""
|
||||
|
||||
def __init__(self, s):
|
||||
|
||||
# The text that we've accumulated, not including any tags.
|
||||
self.text = ""
|
||||
|
||||
# The index in the produced string where each pause starts.
|
||||
self.pause_start = [ 0 ]
|
||||
|
||||
# The index in the produced string where each pause ends.
|
||||
self.pause_end = [ ]
|
||||
|
||||
# The time to delay for each pause. None to delay forever.
|
||||
self.pause_delay = [ ]
|
||||
|
||||
# True if we've encountered the no-wait tag.
|
||||
self.no_wait = False
|
||||
|
||||
i = iter(TAG_RE.split(s))
|
||||
|
||||
while True:
|
||||
|
||||
try:
|
||||
self.text += i.next()
|
||||
|
||||
quoted = i.next()
|
||||
full_tag = i.next()
|
||||
tag = i.next()
|
||||
value = i.next()
|
||||
|
||||
if value is not None:
|
||||
value = float(value)
|
||||
|
||||
if quoted is not None:
|
||||
self.text += quoted
|
||||
continue
|
||||
|
||||
if tag == "p" or tag == "w":
|
||||
self.pause_start.append(len(self.text))
|
||||
self.pause_end.append(len(self.text))
|
||||
self.pause_delay.append(value)
|
||||
|
||||
elif tag == "nw":
|
||||
self.no_wait = True
|
||||
|
||||
elif tag == "fast":
|
||||
self.pause_start = [ len(self.text) ]
|
||||
self.pause_end = [ ]
|
||||
self.pause_delay = [ ]
|
||||
self.no_wait = False
|
||||
|
||||
self.text += full_tag
|
||||
|
||||
except StopIteration:
|
||||
break
|
||||
|
||||
self.pause_end.append(len(self.text))
|
||||
|
||||
if self.no_wait:
|
||||
self.pause_delay.append(0)
|
||||
else:
|
||||
self.pause_delay.append(None)
|
||||
|
||||
|
||||
def predict_show_display_say(who, what, who_args, what_args, window_args, image=False, two_window=False, side_image=None, **kwargs):
|
||||
"""
|
||||
@@ -42,7 +115,8 @@ def predict_show_display_say(who, what, who_args, what_args, window_args, image=
|
||||
rv.append(renpy.game.style.say_who_window.background)
|
||||
|
||||
if image:
|
||||
rv.append(renpy.display.im.image(who, True))
|
||||
if image != "<Dynamic>":
|
||||
rv.append(renpy.display.im.image(who, True))
|
||||
|
||||
if side_image:
|
||||
rv.append(renpy.display.im.image(side_image, True))
|
||||
@@ -56,6 +130,7 @@ def show_display_say(who, what, who_args={}, what_args={}, window_args={},
|
||||
say_vbox_properties={},
|
||||
transform=None,
|
||||
variant=None,
|
||||
screen=None,
|
||||
**kwargs):
|
||||
"""
|
||||
This is called (by default) by renpy.display_say to add the
|
||||
@@ -143,6 +218,33 @@ def show_display_say(who, what, who_args={}, what_args={}, window_args={},
|
||||
what_args = style_args(what_args)
|
||||
window_args = style_args(window_args)
|
||||
|
||||
if screen and renpy.display.screen.has_screen(screen):
|
||||
widget_properties = {
|
||||
"window" : window_args,
|
||||
"what" : what_args,
|
||||
"who" : who_args,
|
||||
}
|
||||
|
||||
tag = screen
|
||||
index = 0
|
||||
|
||||
while renpy.exports.showing(tag):
|
||||
index += 1
|
||||
tag = "%s%d" % (screen, index)
|
||||
|
||||
renpy.display.screen.show_screen(
|
||||
screen,
|
||||
_widget_properties=widget_properties,
|
||||
_transient = True,
|
||||
_tag = tag,
|
||||
who=who,
|
||||
what=what)
|
||||
|
||||
renpy.exports.shown_window()
|
||||
|
||||
return renpy.display.screen.get_widget(screen, "what")
|
||||
|
||||
|
||||
# Apply the transform.
|
||||
if transform:
|
||||
renpy.ui.at(transform)
|
||||
@@ -181,46 +283,57 @@ def show_display_say(who, what, who_args={}, what_args={}, window_args={},
|
||||
|
||||
|
||||
class SlowDone(object):
|
||||
def __init__(self, ctc, ctc_position, callback, interact, type, cb_args):
|
||||
delay = None
|
||||
|
||||
def __init__(self, ctc, ctc_position, callback, interact, type, cb_args, delay):
|
||||
self.ctc = ctc
|
||||
self.ctc_position = ctc_position
|
||||
self.callback = callback
|
||||
self.interact = interact
|
||||
self.type = type
|
||||
self.cb_args = cb_args
|
||||
self.delay = delay
|
||||
|
||||
def __call__(self):
|
||||
|
||||
if self.ctc and self.ctc_position == "fixed":
|
||||
renpy.ui.add(self.ctc)
|
||||
renpy.display.screen.show_screen("_ctc", _transient=True, ctc=self.ctc)
|
||||
renpy.exports.restart_interaction()
|
||||
|
||||
if self.delay is not None:
|
||||
renpy.ui.pausebehavior(self.delay, True)
|
||||
renpy.exports.restart_interaction()
|
||||
|
||||
for c in self.callback:
|
||||
c("slow_done", interact=self.interact, type=self.type, **self.cb_args)
|
||||
|
||||
|
||||
# This function takes care of repeatably showing the screen as part of
|
||||
# an interaction.
|
||||
def display_say(show_function,
|
||||
interact,
|
||||
slow,
|
||||
afm,
|
||||
ctc,
|
||||
ctc_pause,
|
||||
ctc_position,
|
||||
all_at_once,
|
||||
cb_args,
|
||||
with_none,
|
||||
callback,
|
||||
type,
|
||||
checkpoint=True):
|
||||
def display_say(
|
||||
who,
|
||||
what,
|
||||
show_function,
|
||||
interact,
|
||||
slow,
|
||||
afm,
|
||||
ctc,
|
||||
ctc_pause,
|
||||
ctc_position,
|
||||
all_at_once,
|
||||
cb_args,
|
||||
with_none,
|
||||
callback,
|
||||
type,
|
||||
checkpoint=True,
|
||||
ctc_timedpause=None,
|
||||
ctc_force=False):
|
||||
|
||||
ctc = renpy.easy.displayable_or_none(ctc)
|
||||
|
||||
# If we're in fast skipping mode, don't bother with say
|
||||
# statements at all.
|
||||
if interact and renpy.config.skipping == "fast":
|
||||
|
||||
|
||||
# Clears out transients.
|
||||
renpy.exports.with_statement(None)
|
||||
return
|
||||
@@ -236,7 +349,6 @@ def display_say(show_function,
|
||||
callback = [ callback ]
|
||||
|
||||
callback = renpy.config.all_character_callbacks + callback
|
||||
|
||||
|
||||
# Call the begin callback.
|
||||
for c in callback:
|
||||
@@ -258,70 +370,84 @@ def display_say(show_function,
|
||||
renpy.game.context().seen_current(True))):
|
||||
slow = False
|
||||
|
||||
# Figure out which pause we're on. (Or set the pause to None in
|
||||
# order to put us in all-at-once mode.)
|
||||
if not interact:
|
||||
all_at_once = True
|
||||
|
||||
dtt = DialogueTextTags(what)
|
||||
|
||||
if all_at_once:
|
||||
pause = None
|
||||
pause_start = [ dtt.pause_start[0] ]
|
||||
pause_end = [ len(dtt.text) ]
|
||||
pause_delay = [ dtt.pause_delay[-1] ]
|
||||
else:
|
||||
pause = 0
|
||||
pause_start = dtt.pause_start
|
||||
pause_end = dtt.pause_end
|
||||
pause_delay = dtt.pause_delay
|
||||
|
||||
# True if the {nw} tag was found in what_text.
|
||||
no_wait = False
|
||||
|
||||
keep_interacting = True
|
||||
slow_start = 0
|
||||
|
||||
while keep_interacting:
|
||||
for i, (start, end, delay) in enumerate(zip(pause_start, pause_end, pause_delay)):
|
||||
|
||||
last_pause = (i == len(pause_start) - 1)
|
||||
|
||||
# If we're going to do an interaction, then saybehavior needs
|
||||
# to be here.
|
||||
if interact:
|
||||
behavior = renpy.ui.saybehavior(allow_dismiss=renpy.config.say_allow_dismiss)
|
||||
behavior = renpy.ui.saybehavior(allow_dismiss=renpy.config.say_allow_dismiss)
|
||||
else:
|
||||
behavior = None
|
||||
|
||||
# Run the show callback.
|
||||
for c in callback:
|
||||
c("show", interact=interact, type=type, **cb_args)
|
||||
|
||||
what_text = show_function()
|
||||
|
||||
# Show the text.
|
||||
what_text = show_function(who, dtt.text)
|
||||
|
||||
if not isinstance(what_text, renpy.display.text.Text):
|
||||
raise Exception("The say screen (or show_function) must return a Text object.")
|
||||
|
||||
# Update the properties of the what_text widget.
|
||||
|
||||
if pause is not None and pause < what_text.pauses:
|
||||
what_ctc = ctc_pause
|
||||
else:
|
||||
if last_pause:
|
||||
what_ctc = ctc
|
||||
else:
|
||||
if delay is not None:
|
||||
what_ctc = ctc_timedpause or ctc_pause
|
||||
else:
|
||||
what_ctc = ctc_pause
|
||||
|
||||
if not (interact or ctc_force):
|
||||
what_ctc = None
|
||||
|
||||
what_ctc = renpy.easy.displayable_or_none(what_ctc)
|
||||
|
||||
if what_ctc is not None:
|
||||
what_ctc = what_ctc.parameterize(('ctc',), ())
|
||||
|
||||
if delay == 0:
|
||||
what_ctc = None
|
||||
|
||||
# This object is called when the slow text is done.
|
||||
slow_done = SlowDone(what_ctc, ctc_position, callback, interact, type, cb_args)
|
||||
slow_done = SlowDone(what_ctc, ctc_position, callback, interact, type, cb_args, delay)
|
||||
|
||||
what_text.slow = slow
|
||||
what_text.slow_param = slow
|
||||
what_text.slow_done = slow_done
|
||||
what_text.slow_start = slow_start
|
||||
what_text.pause = pause
|
||||
what_text.slow_start = start
|
||||
what_text.slow_end = end
|
||||
|
||||
if what_ctc and ctc_position == "nestled":
|
||||
what_text.tokens.append([ ("widget", what_ctc) ])
|
||||
what_text.set_ctc(what_ctc)
|
||||
|
||||
# Now, re-run update on what_text.
|
||||
what_text.update(retokenize=False)
|
||||
|
||||
keep_interacting = what_text.keep_pausing
|
||||
no_wait |= what_text.no_wait
|
||||
|
||||
if no_wait:
|
||||
slow_done.ctc = None
|
||||
|
||||
for c in callback:
|
||||
c("show_done", interact=interact, type=type, **cb_args)
|
||||
|
||||
if behavior and afm:
|
||||
behavior.set_afm_length(what_text.get_simple_length() - slow_start)
|
||||
behavior.set_afm_length(end - start)
|
||||
|
||||
if interact:
|
||||
|
||||
if interact:
|
||||
rv = renpy.ui.interact(mouse='say', type=type, roll_forward=roll_forward)
|
||||
|
||||
# This is only the case if the user has rolled forward, {nw} happens, or
|
||||
@@ -329,18 +455,14 @@ def display_say(show_function,
|
||||
if rv is False:
|
||||
break
|
||||
|
||||
slow_start = what_text.get_laidout_length()
|
||||
|
||||
if keep_interacting:
|
||||
pause += 1
|
||||
|
||||
for i in renpy.config.say_sustain_callbacks:
|
||||
i()
|
||||
if not last_pause:
|
||||
for i in renpy.config.say_sustain_callbacks:
|
||||
i()
|
||||
|
||||
# Do the checkpoint and with None.
|
||||
if interact:
|
||||
|
||||
if not no_wait:
|
||||
if not dtt.no_wait:
|
||||
if checkpoint:
|
||||
renpy.exports.checkpoint(True)
|
||||
else:
|
||||
@@ -418,14 +540,15 @@ class ADVCharacter(object):
|
||||
|
||||
self.condition = v('condition')
|
||||
self.dynamic = v('dynamic')
|
||||
|
||||
|
||||
self.screen = v('screen')
|
||||
|
||||
self.display_args = dict(
|
||||
interact = d('interact'),
|
||||
slow = d('slow'),
|
||||
afm = d('afm'),
|
||||
ctc = renpy.easy.displayable_or_none(d('ctc')),
|
||||
ctc_pause = renpy.easy.displayable_or_none(d('ctc_pause')),
|
||||
ctc_timedpause = renpy.easy.displayable_or_none(d('ctc_timedpause')),
|
||||
ctc_position = d('ctc_position'),
|
||||
all_at_once = d('all_at_once'),
|
||||
with_none = d('with_none'),
|
||||
@@ -479,13 +602,11 @@ class ADVCharacter(object):
|
||||
def copy(self, name=NotSet, **properties):
|
||||
return type(self)(name, kind=self, **properties)
|
||||
|
||||
|
||||
# This is called before the interaction.
|
||||
def do_add(self, who, what):
|
||||
return
|
||||
|
||||
# A curried version of this is called to cause the interaction to
|
||||
# occur.
|
||||
# This is what shows the screen for a given interaction.
|
||||
def do_show(self, who, what):
|
||||
return self.show_function(
|
||||
who,
|
||||
@@ -493,6 +614,7 @@ class ADVCharacter(object):
|
||||
who_args=self.who_args,
|
||||
what_args=self.what_args,
|
||||
window_args=self.window_args,
|
||||
screen=self.screen,
|
||||
**self.show_args)
|
||||
|
||||
# This is called after the last interaction is done.
|
||||
@@ -505,8 +627,10 @@ class ADVCharacter(object):
|
||||
return
|
||||
|
||||
# This is called to actually do the displaying.
|
||||
def do_display(self, who, what, **display_args):
|
||||
display_say(lambda : self.do_show(who, what),
|
||||
def do_display(self, who, what, **display_args):
|
||||
display_say(who,
|
||||
what,
|
||||
self.do_show,
|
||||
**display_args)
|
||||
|
||||
|
||||
@@ -558,27 +682,31 @@ class ADVCharacter(object):
|
||||
renpy.exports.log(who)
|
||||
renpy.exports.log(what)
|
||||
renpy.exports.log("")
|
||||
|
||||
|
||||
|
||||
def predict(self, what):
|
||||
|
||||
if self.dynamic and self.image:
|
||||
return [ ]
|
||||
|
||||
if self.dynamic:
|
||||
who = "<Dynamic>"
|
||||
else:
|
||||
who = self.name
|
||||
|
||||
return self.do_predict(who, what)
|
||||
|
||||
|
||||
def will_interact(self):
|
||||
|
||||
if not (self.condition is None or renpy.python.py_eval(self.condition)):
|
||||
return False
|
||||
|
||||
return self.display_args['interact']
|
||||
|
||||
|
||||
def Character(name=NotSet, kind=None, **properties):
|
||||
if kind is None:
|
||||
kind = renpy.store.adv
|
||||
|
||||
return type(kind)(name, kind=kind, **properties)
|
||||
|
||||
|
||||
|
||||
|
||||
def DynamicCharacter(name_expr, **properties):
|
||||
return Character(name_expr, dynamic=True, **properties)
|
||||
|
||||
|
||||
+40
-6
@@ -1,4 +1,5 @@
|
||||
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
|
||||
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation files
|
||||
@@ -131,7 +132,7 @@ fade_music = 0.0
|
||||
sticky_positions = False
|
||||
|
||||
# A list of all of the layers that we know about.
|
||||
layers = [ 'master', 'transient', 'overlay' ]
|
||||
layers = [ 'master', 'transient', 'screens', 'overlay' ]
|
||||
|
||||
# A list of layers that should be cleared when we replace
|
||||
# transients.
|
||||
@@ -141,6 +142,10 @@ transient_layers = [ 'transient' ]
|
||||
# overlays.
|
||||
overlay_layers = [ 'overlay' ]
|
||||
|
||||
# A list of layers that should be cleared whe we enter a
|
||||
# new context.
|
||||
context_clear_layers = [ 'screens' ]
|
||||
|
||||
# A list of layers that are displayed atop all other layers, and do
|
||||
# not participate in transitions.
|
||||
top_layers = [ ]
|
||||
@@ -167,7 +172,7 @@ keymap = dict(
|
||||
# disabled.
|
||||
rollback = [ 'K_PAGEUP', 'mousedown_4', 'joy_rollback' ],
|
||||
screenshot = [ 's' ],
|
||||
toggle_fullscreen = [ 'f', 'alt_K_RETURN', 'alt_K_KP_ENTER' ],
|
||||
toggle_fullscreen = [ 'f', 'alt_K_RETURN', 'alt_K_KP_ENTER', 'K_F11' ],
|
||||
toggle_music = [ 'm' ],
|
||||
game_menu = [ 'K_ESCAPE', 'mouseup_3', 'joy_menu' ],
|
||||
hide_windows = [ 'mouseup_2', 'h', 'joy_hide' ],
|
||||
@@ -342,7 +347,7 @@ all_character_callbacks = [ ]
|
||||
autosave_slots = 10
|
||||
|
||||
# How often do we autosave. (Number of interactions, sort of.)
|
||||
autosave_frequency = 200
|
||||
autosave_frequency = int(os.environ.get("RENPY_AUTOSAVE_FREQUENCY", "200"))
|
||||
|
||||
# The callback that is used by the scene statement.
|
||||
scene = renpy.exports.scene
|
||||
@@ -401,9 +406,38 @@ rtl = False
|
||||
# A callback for file opening.
|
||||
file_open_callback = None
|
||||
|
||||
# The size of screenshot thumbnails. (Redefined in common/)
|
||||
thumbnail_width = None
|
||||
thumbnail_height = None
|
||||
|
||||
# The end game transition.
|
||||
end_game_transition = None
|
||||
|
||||
# The default transform.
|
||||
default_transform = None
|
||||
|
||||
# Should we use the child position?
|
||||
transform_uses_child_position = True
|
||||
|
||||
# The action to use when it's time to quit.
|
||||
quit_action = None
|
||||
|
||||
# If not None, a rectangle giving the area of the screen to crop the
|
||||
# screenshots to.
|
||||
screenshot_crop = None
|
||||
|
||||
# Various directories.
|
||||
gamedir = None
|
||||
basedir = None
|
||||
renpy_base = None
|
||||
|
||||
# Should we enable OpenGL mode?
|
||||
gl_enable = True
|
||||
|
||||
del renpy
|
||||
del os
|
||||
|
||||
def init():
|
||||
import renpy
|
||||
global properties
|
||||
import renpy # W0404
|
||||
global style_properties
|
||||
style_properties = renpy.style.style_properties
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation files
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation files
|
||||
@@ -19,4 +19,21 @@
|
||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
# This file intentionally left blank.
|
||||
# The draw object through which all drawing is routed. This object
|
||||
# contains all of the distinction between the software and GL
|
||||
# renderers.
|
||||
draw = None
|
||||
|
||||
# The interface object.
|
||||
interface = None
|
||||
|
||||
# The old OpenGL physical size. Used to restore things after a reload.
|
||||
# (Stashed here since this module doesn't get reloaded.)
|
||||
gl_size = None
|
||||
|
||||
# Should we give up on opengl? This is controlled by shift on initial
|
||||
# start.
|
||||
gl_giveup = None
|
||||
|
||||
# The renderers we prefer to use.
|
||||
prefer_renderers = "gl,sw"
|
||||
|
||||
+5
-28
@@ -1,4 +1,4 @@
|
||||
# Copyright 2004-2009 PyTom <pytom@bishoujo.us>
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation files
|
||||
@@ -22,7 +22,6 @@
|
||||
# This file contains support for state-machine controlled animations.
|
||||
|
||||
import renpy
|
||||
import pygame
|
||||
import random
|
||||
|
||||
class State(object):
|
||||
@@ -77,7 +76,7 @@ class State(object):
|
||||
def motion_copy(self, child):
|
||||
|
||||
if self.image is not None:
|
||||
child = self.mage
|
||||
child = self.image
|
||||
|
||||
return State(self.name, child, *self.atlist)
|
||||
|
||||
@@ -557,34 +556,12 @@ class Blink(renpy.display.core.Displayable):
|
||||
|
||||
|
||||
rend = renpy.display.render.render(self.image, height, width, st, at)
|
||||
|
||||
if not renpy.display.module.can_linmap:
|
||||
return rend
|
||||
|
||||
w, h = rend.get_size()
|
||||
rv = renpy.display.render.Render(w, h)
|
||||
|
||||
if renpy.game.less_updates:
|
||||
alpha = 1.0
|
||||
|
||||
oldsurf = rend.pygame_surface()
|
||||
|
||||
if not (oldsurf.get_masks()[3]):
|
||||
oldsurf = oldsurf.convert_alpha(renpy.game.interface.display.window)
|
||||
|
||||
newsurf = pygame.Surface(oldsurf.get_size(), oldsurf.get_flags(), oldsurf)
|
||||
|
||||
# amap = renpy.display.im.ramp(0, int(alpha * 255.0))
|
||||
# identity = renpy.display.im.identity
|
||||
|
||||
renpy.display.module.linmap(oldsurf, newsurf,
|
||||
256, 256, 256, int(alpha * 256.0))
|
||||
|
||||
renpy.display.render.mutated_surface(newsurf)
|
||||
|
||||
rv.blit(newsurf, (0, 0))
|
||||
rv.depends_on(rend)
|
||||
|
||||
rv.blit(rend, (0, 0))
|
||||
rv.alpha = alpha
|
||||
|
||||
if not renpy.game.less_updates:
|
||||
renpy.display.render.redraw(self, delay)
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user