Compare commits
423 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 | |||
| a067d0c830 | |||
| 2f82c7466d | |||
| 9e9a6b7f8e | |||
| 9db36905c6 | |||
| e5ae260c33 | |||
| 4e3a579eed | |||
| 4cd1e62978 | |||
| babd95540d | |||
| 905de15883 | |||
| 00f31ca351 | |||
| cb82cfae3e | |||
| 1a36f1feb7 | |||
| d1893c6e17 | |||
| 330ec0e68c | |||
| 830304b79e | |||
| dc5940ac56 | |||
| 437cc8784f | |||
| 8e08e6647a | |||
| 60a21a7bbe | |||
| 6251a86cfe | |||
| 580ea88cd0 | |||
| c93734cd9c | |||
| f7e2f0dd1a | |||
| 943b505ec2 | |||
| 75304e781a | |||
| d73326af11 | |||
| 670eca455d | |||
| ab38c2e521 | |||
| 1ded9b2959 | |||
| 7c67db202f | |||
| ba4321956b | |||
| 79e4b5a2fa | |||
| 5b84b0507c | |||
| c15d13e543 | |||
| 3ef27787b4 | |||
| e84e8102b6 | |||
| ee8d1a531a | |||
| 2d4d1903b2 | |||
| d1cc2015ac | |||
| be44f0805c | |||
| 612207510c | |||
| c2875e4a7d | |||
| b8d2433a79 | |||
| 43cc8b425a | |||
| 7962073926 | |||
| 281a35bc66 | |||
| a4f6a18bb8 | |||
| f50adf3ed2 | |||
| f1b78b4a05 | |||
| 7953f8adf1 | |||
| f3062e6f22 | |||
| fe4eda2661 | |||
| 2be10ba84c | |||
| 82b3d0e78e | |||
| 079180f4ce | |||
| 9a3369c27c | |||
| b87e10cdcf | |||
| 229c542d68 | |||
| 3478d079d6 | |||
| a7fc70402e | |||
| 5df6419a59 | |||
| 8b03bc5072 | |||
| 6ca8a37cc6 | |||
| 9fbf1ee1b2 | |||
| 84b7741fa4 | |||
| e6efaa5f9f | |||
| 330c2e247e | |||
| 923f56273c | |||
| 8b761aa689 | |||
| fa538db11f | |||
| e4dff364e1 | |||
| 5d7faf0274 | |||
| ee0cafcf67 | |||
| 94506ad601 | |||
| f0b54ea7f9 | |||
| 11dbf23952 | |||
| 8957aa4f2f | |||
| 7e206549fd | |||
| f365408bbc | |||
| 0bdf5cd904 | |||
| 9ba28e5cd2 | |||
| 49ae49a82e | |||
| 23e9fffd68 | |||
| 1c6df6230d | |||
| 88584747e4 | |||
| d77d1c266b | |||
| d9738a2809 | |||
| a40d997413 | |||
| d444558b06 | |||
| 07164c156b | |||
| 625df4c7ac | |||
| 75a047e18d | |||
| ade3d4f935 | |||
| a0bc604d92 | |||
| 10743adcee | |||
| 4e9af0789c | |||
| 83f7ef6fd7 | |||
| b2850cc6ac | |||
| e41c71da98 | |||
| 0e3468872b | |||
| cd6a49e679 | |||
| 494e1a944b | |||
| 1361825f5d | |||
| b977e20156 | |||
| ff858e599d | |||
| 4c7bdede29 | |||
| 4208836d77 | |||
| 592341f5b1 | |||
| bc41ebadce | |||
| 0deadb41ee | |||
| 076624c4c2 |
+8
-4
@@ -5,10 +5,6 @@ renpy.app
|
||||
**/*.rpyc
|
||||
**/*.rpyb
|
||||
**/*.rpymc
|
||||
_renpy.c
|
||||
nativemidi.c
|
||||
sound.c
|
||||
winmixer.c
|
||||
jedit
|
||||
lint.txt
|
||||
renpy.code
|
||||
@@ -54,3 +50,11 @@ speedtest
|
||||
styles.txt
|
||||
renpygame-demo/game/saves
|
||||
./lib
|
||||
Lucy Sprites.zip
|
||||
translate
|
||||
close_bugs.py
|
||||
.logplayer
|
||||
scite-6.10.zip
|
||||
scite-renpy-20090803.zip
|
||||
module/cython.sh
|
||||
old_demo
|
||||
|
||||
+296
@@ -1,3 +1,295 @@
|
||||
|
||||
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
|
||||
--------------------
|
||||
|
||||
The demo game is in the process of being converted into a new tutorial
|
||||
game, which shows recommended Ren'Py code examples rather than
|
||||
requiring the user to learn from the game itself's source code.
|
||||
|
||||
|
||||
Ren'Py now supports an Animation and Transformation language
|
||||
(ATL). This provides a convenient syntax for animating an image, or
|
||||
transforming it by positioning it, rotating it, zooming it, and
|
||||
adjusting its opacity.
|
||||
|
||||
To a large extent, ATL supersedes the Animation, TransitionAnimation,
|
||||
anim.SMAnimation, anim.Blink, Zoom, FactorZoom, RotoZoom, SizeZoom,
|
||||
LiveCrop, Move, Pan, Position, Motion, and Revolve functions, and
|
||||
perhaps others. As it allows properties to be scripted, ATL is more
|
||||
powerful that all of these functions. (For example, many of these
|
||||
functions can only do relatively simple repeats, while ATL allows
|
||||
complex patterns to be easily specified.)
|
||||
|
||||
ATL can be used in the new transform statement, and new variants of
|
||||
the image, scene, and show statements.
|
||||
|
||||
|
||||
When an image is shown, Ren'Py checks to see if there was a previous
|
||||
image with that tag, and if that image used a transform. If this is
|
||||
true, Ren'Py does two things:
|
||||
|
||||
# If the new image is not a transform, it wraps it in a transform.
|
||||
# The transform is initialized to have the properties of the old transform.
|
||||
|
||||
The generally has the effect of "remembering" the position of images
|
||||
shown on the screen. In some cases, this memory effect may override a
|
||||
position encoded into an image. In that case, the image must be hidden
|
||||
and shown again.
|
||||
|
||||
|
||||
The default positions (left, right, center, truecenter, offscreenleft,
|
||||
and offscreenright) are now defined as ATL transforms. This means that showing
|
||||
an image at such a position will cause the position to be remembered.
|
||||
|
||||
|
||||
Support for Arabic and Hebrew has been added to Ren'Py. To enable this
|
||||
support, config.rtl needs to be set to True. It may also be necessary
|
||||
to set various style properties to do a credible job of right-to-left
|
||||
layout.)
|
||||
|
||||
|
||||
The freetype library has been updated, and we have added support for
|
||||
the use of TrueType collections. Using a name of 0@font.ttc will get
|
||||
the first font in the collection, 1@font.ttc will get the second font,
|
||||
and so on.
|
||||
|
||||
|
||||
The displayable code has been adjusted to consider strings that do not
|
||||
contain at least one dot as image references. Now, one can write
|
||||
"eileen happy" to refer to an image with that name.
|
||||
|
||||
|
||||
A pause statement has been added to Ren'Py.
|
||||
|
||||
|
||||
The new config.auto_load variable allows you to specify a save file
|
||||
that is automatically loaded when Ren'Py starts. For example, setting
|
||||
this to "1" loads the game in save slot 1. This is intended for use by
|
||||
developers, so they can easily return to a point in the game after
|
||||
restarting Ren'Py.
|
||||
|
||||
|
||||
The layout.imagemap_yesno_prompt now supports a prompt_images
|
||||
argument, which is can be used to specify images to replace the
|
||||
text of a yes/no prompt.
|
||||
|
||||
|
||||
The new ui.tag function allows one to specify the image tag of a UI
|
||||
widget. This can have positive interactions with transforms.
|
||||
|
||||
|
||||
Ren'Py now has a define statement, which combines into a single
|
||||
statement running code at init time, and assigning it to a
|
||||
variable. Ren'Py keeps track of these definitions, which may in the
|
||||
future make it easier for editors to determine where something is
|
||||
defined.
|
||||
|
||||
|
||||
The new config.window_overlay_functions variable contains a list of
|
||||
functions that should be called only when once the dialogue window has
|
||||
been shown.
|
||||
|
||||
|
||||
The new config.automatic_images variable, when set correctly, will
|
||||
cause Ren'Py to automatically define images for appropriately-named
|
||||
image files found in the archives and game directory.
|
||||
|
||||
|
||||
Python blocks are now compiled in a mode that allows the python "with"
|
||||
statement. Container displayables now support the context manager
|
||||
protocol, automatically closing at the end of a with block. (Note
|
||||
that the python with statement postdates the Ren'Py with statement,
|
||||
and has totally different semantics.)
|
||||
|
||||
|
||||
The play and queue statements now take optional loop and noloop
|
||||
modifiers, which force looping (or lack of looping) on that channel.
|
||||
The play statement takes an if_changed modifier, which prevents a song
|
||||
from being restarted if it is already playing on the channel. [doc]
|
||||
|
||||
|
||||
Ren'Py now allows save games to be deleted. To do this, select a save
|
||||
game (either with the keyboard, or by hovering the mouse over it), and
|
||||
hit delete.
|
||||
|
||||
|
||||
Buttons now take a keymap argument, which specifies an alternate
|
||||
keymap that is used when the button is focused.
|
||||
|
||||
|
||||
Added the Image Location Picker to the Developer (shift+D) menu. This
|
||||
tool lets the user pick an image, and then pick locations that
|
||||
image. It displays the mouse coordinates, imagemap rectangle, and
|
||||
cropping rectangle.
|
||||
|
||||
|
||||
Added a FPS meter to the Developer (shift+D) menu.
|
||||
|
||||
Added a .001s sleep for frames that are framerate-limited. This should
|
||||
prevent Ren'Py from consuming all CPU unless the game is CPU-bound.
|
||||
|
||||
|
||||
Added config.file_open_callback, which allows Ren'Py to load files
|
||||
from user-definable archive types.
|
||||
|
||||
|
||||
Added the renpy.get_roll_forward function, which is the infrastructure
|
||||
needed to create a button that lets the user roll forward.
|
||||
|
||||
|
||||
Changed MoveTransition to preserve the timebases of the thing being moved
|
||||
in all circumstances.
|
||||
|
||||
|
||||
Ren'Py is now built using SDL-1.2.13. On Linux systems with pulseaudio
|
||||
support, it will use pulseaudio for audio output.
|
||||
|
||||
|
||||
Fixed a bug with archive files that could cause crashing in some
|
||||
circumstances.
|
||||
|
||||
Fixed a bug that prevented {w=1} from working.
|
||||
|
||||
Fixed a bug that prevented style.rebuild from working.
|
||||
|
||||
Fixed a potential segfault bug with certain transforms, zooms, and
|
||||
rotations.
|
||||
|
||||
|
||||
New in Ren'Py 6.9.3
|
||||
-------------------
|
||||
|
||||
@@ -41,6 +333,10 @@ Allow config.layer_clipping to specify layers that are larger than the
|
||||
screen.
|
||||
|
||||
|
||||
The various layouts now change the mouse to the gamemenu or mainmenu
|
||||
mouse, as appropriate.
|
||||
|
||||
|
||||
This distribution include a new NVL-mode tutorial, teaching people how
|
||||
to make NVL-mode games.
|
||||
|
||||
|
||||
+709
-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:
|
||||
|
||||
Regular → Executable
+3
-2
@@ -1,4 +1,4 @@
|
||||
1#!/usr/bin/env python
|
||||
#!/usr/bin/env python
|
||||
|
||||
import collections
|
||||
import glob
|
||||
@@ -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")
|
||||
|
||||
@@ -73,7 +74,7 @@ init python:
|
||||
# print "#:", v
|
||||
# print "#, python-format"
|
||||
|
||||
print >>f, " %r," % unicode(k)
|
||||
print >>f, " u\"%s\"," % unicode(k)
|
||||
|
||||
print >>f, """\
|
||||
]
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# 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.
|
||||
|
||||
python early hide:
|
||||
|
||||
# pause is defined internally, but would look like:
|
||||
#
|
||||
# @renpy.atl_warper
|
||||
# def pause(t):
|
||||
# if t >= 1.0:
|
||||
# return 1.0
|
||||
# else:
|
||||
# return 0.0
|
||||
|
||||
@renpy.atl_warper
|
||||
def linear(t):
|
||||
return t
|
||||
|
||||
@renpy.atl_warper
|
||||
def easeout(x):
|
||||
import math
|
||||
return 1.0 - math.cos(x * math.pi / 2.0)
|
||||
|
||||
@renpy.atl_warper
|
||||
def easein(x):
|
||||
import math
|
||||
return math.cos((1.0 - x) * math.pi / 2.0)
|
||||
|
||||
@renpy.atl_warper
|
||||
def ease(x):
|
||||
import math
|
||||
return .5 - math.cos(math.pi * x) / 2.0
|
||||
@@ -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
|
||||
@@ -15,6 +18,29 @@ init -1210 python:
|
||||
|
||||
if version <= (6, 9, 1):
|
||||
store.library = store.config
|
||||
|
||||
if version <= (6, 9, 3):
|
||||
|
||||
# Before 6.10, these were positions, rather than transforms.
|
||||
store.left = Position(xalign=0.0)
|
||||
store.center = Position(xalign=0.5)
|
||||
store.truecenter = Position(xalign=0.5, yalign=0.5)
|
||||
store.right = Position(xalign=1.0)
|
||||
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::
|
||||
|
||||
|
||||
+43
-17
@@ -1,27 +1,51 @@
|
||||
# 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:
|
||||
xpos 0.0 xanchor 0.0 ypos 1.0 yanchor 1.0
|
||||
|
||||
transform right:
|
||||
xpos 1.0 xanchor 1.0 ypos 1.0 yanchor 1.0
|
||||
|
||||
transform center:
|
||||
xpos 0.5 xanchor 0.5 ypos 1.0 yanchor 1.0
|
||||
|
||||
transform truecenter:
|
||||
xpos 0.5 xanchor 0.5 ypos 0.5 yanchor 0.5
|
||||
|
||||
# Offscreen positions for use with the move transition. Images at
|
||||
# these positions are still shown (and consume
|
||||
# resources)... remember to hide the image after the transition.
|
||||
transform offscreenleft:
|
||||
xpos 0.0 xanchor 1.0 ypos 1.0 yanchor 1.0
|
||||
|
||||
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 ##############################################################
|
||||
|
||||
# These are positions that can be used inside at clauses. We set
|
||||
# them up here so that they can be used throughout the program.
|
||||
left = Position(xalign=0.0)
|
||||
center = Position(xalign=0.5)
|
||||
truecenter = Position(xalign=0.5, yalign=0.5)
|
||||
right = Position(xalign=1.0)
|
||||
|
||||
# Offscreen positions for use with the move transition. Images at
|
||||
# these positions are still shown (and consume
|
||||
# resources)... remember to hide the image after the transition.
|
||||
offscreenleft = Position(xpos=0.0, xanchor=1.0)
|
||||
offscreenright = Position(xpos=1.0, xanchor=0.0)
|
||||
|
||||
# Transitions ############################################################
|
||||
|
||||
# Simple transitions.
|
||||
@@ -140,8 +164,6 @@ init -1110 python:
|
||||
zoomin = MoveTransition(0.5, enter_factory=ZoomInOut(0.01, 1.0))
|
||||
zoomout = MoveTransition(0.5, leave_factory=ZoomInOut(1.0, 0.01))
|
||||
zoominout = MoveTransition(0.5, enter_factory=ZoomInOut(0.01, 1.0), leave_factory=ZoomInOut(1.0, 0.01))
|
||||
|
||||
|
||||
|
||||
# These shake the screen up and down for a quarter second.
|
||||
# The delay needs to be an integer multiple of the period.
|
||||
@@ -165,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,79 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
# This file contains code to perform the OpenGL test. This is always
|
||||
# run - even in software mode - so that the user experience remains
|
||||
# consistent. (But it terminates early in sw-mode.)
|
||||
|
||||
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, timeout):
|
||||
super(__GLTest, self).__init__()
|
||||
|
||||
self.frames = frames
|
||||
self.timeout = timeout
|
||||
|
||||
def render(self, width, height, st, at):
|
||||
self.frames -= 1
|
||||
|
||||
if self.frames <= 0:
|
||||
renpy.timeout(0)
|
||||
|
||||
renpy.redraw(self, 0)
|
||||
|
||||
rv = renpy.Render(width, height)
|
||||
return rv
|
||||
|
||||
|
||||
def event(self, ev, x, y, st):
|
||||
st = st
|
||||
|
||||
if self.frames <= 0:
|
||||
return True
|
||||
|
||||
if st > self.timeout:
|
||||
return False
|
||||
|
||||
renpy.timeout(self.timeout - st)
|
||||
|
||||
label _gl_test:
|
||||
|
||||
# Show the test image.
|
||||
show expression config.gl_test_image
|
||||
|
||||
python hide:
|
||||
|
||||
# If GL is able to render FRAMES in DELAY seconds, we consider it to
|
||||
# be operational, and continue in GL mode. Otherwise, we rever to
|
||||
# software rendering mode.
|
||||
FRAMES = 4
|
||||
DELAY = .25
|
||||
|
||||
import os
|
||||
|
||||
if (not "RENPY_RENDERER" in os.environ) and (renpy.get_renderer_info()["renderer"] == "gl"):
|
||||
|
||||
renpy.pause(0)
|
||||
|
||||
renpy.transition(Dissolve(DELAY))
|
||||
ui.add(__GLTest(FRAMES, DELAY))
|
||||
rv = ui.interact(suppress_overlay=True, suppress_underlay=False)
|
||||
|
||||
if not rv:
|
||||
config.gl_enable = False
|
||||
renpy.display_reset()
|
||||
|
||||
# Hide the test image.
|
||||
scene
|
||||
|
||||
return
|
||||
|
||||
+105
-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"):
|
||||
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):
|
||||
@@ -322,7 +336,7 @@ init -1105 python hide:
|
||||
config.preferences_hotspots = hotspots
|
||||
|
||||
@layout
|
||||
def imagemap_yesno_prompt(ground, idle, hover, hotspots):
|
||||
def imagemap_yesno_prompt(ground, idle, hover, hotspots, prompt_images={ }):
|
||||
|
||||
renpy.load_module("_layout/imagemap_yesno_prompt")
|
||||
|
||||
@@ -330,16 +344,90 @@ init -1105 python hide:
|
||||
config.yesno_prompt_idle = idle
|
||||
config.yesno_prompt_hover = hover
|
||||
config.yesno_prompt_hotspots = hotspots
|
||||
config.yesno_prompt_message_images = prompt_images
|
||||
|
||||
@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.display.show_screen(
|
||||
"yesno_prompt",
|
||||
message=message,
|
||||
yes_action=yes_action,
|
||||
no_action=no_action)
|
||||
|
||||
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()
|
||||
|
||||
|
||||
+160
-33
@@ -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,6 +47,27 @@ 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.
|
||||
save_name = ''
|
||||
@@ -136,11 +155,8 @@ init -1180 python:
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
init -1180 python hide:
|
||||
|
||||
# Called to make a screenshot happen.
|
||||
def screenshot():
|
||||
def _screenshot():
|
||||
import os.path
|
||||
import os
|
||||
import __main__
|
||||
@@ -171,17 +187,25 @@ 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")
|
||||
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:
|
||||
@@ -213,7 +237,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,
|
||||
@@ -330,6 +354,8 @@ label _save_reload_game:
|
||||
renpy.pause(0)
|
||||
renpy.save("reload", "reload save game")
|
||||
|
||||
renpy.music.stop()
|
||||
|
||||
persistent._reload_save = "reload"
|
||||
|
||||
ui.add(Solid((0, 0, 0, 255)))
|
||||
@@ -379,6 +405,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.default_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):
|
||||
@@ -390,7 +427,6 @@ init 1180 python:
|
||||
ui.text("Style Inspector")
|
||||
ui.text("")
|
||||
|
||||
|
||||
if not l:
|
||||
ui.text("Nothing to inspect.")
|
||||
|
||||
@@ -520,10 +556,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")
|
||||
@@ -563,9 +602,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
|
||||
|
||||
@@ -607,7 +651,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
|
||||
|
||||
@@ -616,7 +660,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"
|
||||
@@ -642,6 +685,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)
|
||||
@@ -658,15 +702,23 @@ label _start:
|
||||
|
||||
python hide:
|
||||
renpy.context()._menu = False
|
||||
renpy.context()._main_menu = False
|
||||
|
||||
for i in config.start_callbacks:
|
||||
i()
|
||||
|
||||
# call _check_module from _call__check_module_1
|
||||
|
||||
call _gl_test
|
||||
|
||||
call _load_reload_game from _call__load_reload_game_1
|
||||
|
||||
scene black
|
||||
if not _restart and config.auto_load and renpy.can_load(config.auto_load):
|
||||
$ renpy.load(config.auto_load)
|
||||
|
||||
if config.start_scene_black:
|
||||
scene black
|
||||
else:
|
||||
scene
|
||||
|
||||
if not _restart:
|
||||
$ ui.pausebehavior(0)
|
||||
$ ui.interact(suppress_underlay=True, suppress_overlay=True)
|
||||
@@ -690,20 +742,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.
|
||||
@@ -719,7 +780,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
|
||||
@@ -733,11 +794,77 @@ 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
|
||||
|
||||
init 1180 python hide:
|
||||
|
||||
def create_automatic_images():
|
||||
|
||||
seps = config.automatic_images
|
||||
|
||||
if seps is True:
|
||||
seps = [ ' ', '/', '_' ]
|
||||
|
||||
for dir, fn in renpy.loader.listdirfiles():
|
||||
|
||||
if fn.startswith("_"):
|
||||
continue
|
||||
|
||||
# Only .png and .jpg
|
||||
if not fn.lower().endswith(".png") and not fn.lower().endswith(".jpg"):
|
||||
continue
|
||||
|
||||
# Strip the extension, replace slashes.
|
||||
shortfn = fn[:-4].replace("\\", "/")
|
||||
|
||||
# Determine the name.
|
||||
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:
|
||||
continue
|
||||
|
||||
# Reject if it already exists.
|
||||
if name in renpy.exports.images:
|
||||
continue
|
||||
|
||||
renpy.image(name, fn)
|
||||
|
||||
if config.automatic_images:
|
||||
create_automatic_images()
|
||||
|
||||
|
||||
# Load the developer screen, if necessary.
|
||||
init 1180 python hide:
|
||||
|
||||
if config.developer:
|
||||
renpy.load_module("_developer")
|
||||
|
||||
# Entry point for the developer screen. The rest of it is loaded from
|
||||
# _developer.rpym
|
||||
label _developer:
|
||||
|
||||
if not config.developer:
|
||||
return
|
||||
|
||||
call _enter_menu from _call__enter_menu_4
|
||||
|
||||
jump expression "_developer_screen"
|
||||
|
||||
+4
-6
@@ -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
|
||||
@@ -31,13 +29,13 @@ init -1150 python:
|
||||
label _quit_prompt:
|
||||
$ renpy.loadsave.force_autosave()
|
||||
|
||||
if layout.yesno_prompt(None, u"Are you sure you want to quit?"):
|
||||
if layout.yesno_prompt(None, layout.QUIT):
|
||||
jump _quit
|
||||
else:
|
||||
return
|
||||
|
||||
label _main_menu_prompt:
|
||||
if layout.yesno_prompt(None, u"Are you sure you want to return to the main menu?\nThis will lose unsaved progress."):
|
||||
if layout.yesno_prompt(None, layout.MAIN_MENU):
|
||||
$ renpy.full_restart(transition=config.game_main_transition)
|
||||
else:
|
||||
return
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
+79
-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()
|
||||
|
||||
@@ -255,6 +307,8 @@ init -1100 python:
|
||||
|
||||
return rv
|
||||
|
||||
NVLSpeaker = NVLCharacter
|
||||
|
||||
config.nvl_adv_transition = None
|
||||
config.adv_nvl_transition = None
|
||||
|
||||
|
||||
+1320
File diff suppressed because it is too large
Load Diff
@@ -63,15 +63,19 @@ init -1080 python:
|
||||
|
||||
def init_values(self, sizes):
|
||||
def to_abs_(value, size):
|
||||
if isinstance(value, float):
|
||||
if type(value) == float:
|
||||
return value * size
|
||||
else:
|
||||
return value
|
||||
|
||||
def coord_(c):
|
||||
|
||||
if len(c) == 2:
|
||||
c = c + (0, 0)
|
||||
|
||||
return ( to_abs_(c[0], sizes[0]) - to_abs_(c[2], sizes[2]),
|
||||
to_abs_(c[1], sizes[1]) - to_abs_(c[3], sizes[3]) )
|
||||
|
||||
|
||||
for p in self.points:
|
||||
for i in range(1, len(p)):
|
||||
p[i] = coord_(p[i])
|
||||
@@ -122,8 +126,8 @@ init -1080 python:
|
||||
t3 = t**3
|
||||
|
||||
result = [ t_ppp * start[i] + t_pp * self.points[segment][2][i] + t_p * self.points[segment][3][i] + t3 * end[i] for i in 0,1 ]
|
||||
|
||||
return ( int(result[0]), int(result[1]), 0, 0 )
|
||||
|
||||
return ( absolute(result[0]), absolute(result[1]), 0, 0 )
|
||||
|
||||
def SplineMotion(points, time, child=None, anchors=(0.5, 0.5), repeat=False, bounce=False, anim_timebase=False, style='default', time_warp=None, **properties):
|
||||
return Motion(_SplineInterpolator(points, anchors), time, child, repeat=repeat, bounce=bounce, anim_timebase=anim_timebase, style=style, time_warp=time_warp, add_sizes=True, **properties)
|
||||
|
||||
+180
-19
@@ -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.
|
||||
#
|
||||
@@ -67,6 +70,8 @@ python early hide:
|
||||
fadeout = "None"
|
||||
fadein = "0"
|
||||
channel = None
|
||||
loop = None
|
||||
if_changed = False
|
||||
|
||||
while True:
|
||||
|
||||
@@ -93,25 +98,41 @@ python early hide:
|
||||
renpy.error('expected simple expression')
|
||||
|
||||
continue
|
||||
|
||||
|
||||
if l.keyword('loop'):
|
||||
loop = True
|
||||
continue
|
||||
|
||||
if l.keyword('noloop'):
|
||||
loop = False
|
||||
continue
|
||||
|
||||
if l.keyword('if_changed'):
|
||||
if_changed = True
|
||||
continue
|
||||
|
||||
renpy.error('could not parse statement.')
|
||||
|
||||
return dict(file=file,
|
||||
fadeout=fadeout,
|
||||
fadein=fadein,
|
||||
channel=channel)
|
||||
channel=channel,
|
||||
loop=loop,
|
||||
if_changed=if_changed)
|
||||
|
||||
def execute_play_music(p):
|
||||
|
||||
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"]),
|
||||
fadein=eval(p["fadein"]),
|
||||
channel=channel)
|
||||
channel=channel,
|
||||
loop=p.get("loop", None),
|
||||
if_changed=p.get("if_changed", False))
|
||||
|
||||
def predict_play_music(p):
|
||||
return [ ]
|
||||
@@ -145,24 +166,38 @@ python early hide:
|
||||
renpy.error("queue requires a file")
|
||||
|
||||
channel = None
|
||||
|
||||
if l.keyword('channel'):
|
||||
channel = l.simple_expression()
|
||||
if channel is None:
|
||||
renpy.error('expected simple expression')
|
||||
loop = None
|
||||
|
||||
while not l.eol():
|
||||
|
||||
if l.keyword('channel'):
|
||||
channel = l.simple_expression()
|
||||
if channel is None:
|
||||
renpy.error('expected simple expression')
|
||||
|
||||
if not l.eol():
|
||||
renpy.error("expected end of line")
|
||||
if l.keyword('loop'):
|
||||
loop = True
|
||||
continue
|
||||
|
||||
if l.keyword('noloop'):
|
||||
loop = False
|
||||
continue
|
||||
|
||||
return dict(file=file, channel=channel)
|
||||
renpy.error('expected end of line')
|
||||
|
||||
return dict(file=file, channel=channel, loop=loop)
|
||||
|
||||
def execute_queue_music(p):
|
||||
if p["channel"] is not None:
|
||||
channel = eval(p["channel"])
|
||||
else:
|
||||
channel = 7
|
||||
channel = "music"
|
||||
|
||||
renpy.music.queue(eval(p["file"]), channel=channel)
|
||||
renpy.music.queue(
|
||||
eval(p["file"]),
|
||||
channel=channel,
|
||||
loop=p.get("loop", None))
|
||||
|
||||
|
||||
renpy.statements.register('queue music',
|
||||
parse=parse_queue_music,
|
||||
@@ -194,7 +229,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)
|
||||
|
||||
@@ -211,7 +246,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
|
||||
|
||||
@@ -229,7 +264,7 @@ python early hide:
|
||||
if p["channel"] is not None:
|
||||
channel = eval(p["channel"])
|
||||
else:
|
||||
channel = 0
|
||||
channel = "sound"
|
||||
|
||||
renpy.sound.queue(eval(p["file"]), channel=channel)
|
||||
|
||||
@@ -243,7 +278,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
|
||||
|
||||
@@ -324,7 +359,9 @@ python early hide:
|
||||
lint=lint_stop_generic)
|
||||
|
||||
|
||||
# The "window show" and "window hide" statements.
|
||||
##########################################################################
|
||||
# "window show" and "window hide" statements.
|
||||
|
||||
def parse_window(l):
|
||||
p = l.simple_expression()
|
||||
if not l.eol():
|
||||
@@ -371,7 +408,38 @@ python early hide:
|
||||
parse=parse_window,
|
||||
execute=execute_window_hide,
|
||||
lint=lint_window)
|
||||
|
||||
##########################################################################
|
||||
# Pause statement.
|
||||
|
||||
def parse_pause(l):
|
||||
|
||||
delay = l.simple_expression()
|
||||
|
||||
if not l.eol():
|
||||
renpy.error("expected end of line.")
|
||||
|
||||
return { "delay" : delay }
|
||||
|
||||
def lint_pause(p):
|
||||
|
||||
if p["delay"]:
|
||||
_try_eval(p["delay"], 'pause statement')
|
||||
|
||||
def execute_pause(p):
|
||||
|
||||
if p["delay"]:
|
||||
delay = eval(p["delay"])
|
||||
renpy.with_statement(Pause(delay))
|
||||
else:
|
||||
renpy.pause()
|
||||
|
||||
|
||||
renpy.statements.register('pause',
|
||||
parse=parse_pause,
|
||||
lint=lint_pause,
|
||||
execute=execute_pause)
|
||||
|
||||
|
||||
init -1200 python:
|
||||
|
||||
@@ -384,3 +452,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)
|
||||
|
||||
|
||||
|
||||
|
||||
+22
-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.')
|
||||
@@ -203,6 +210,8 @@ init -1090 python:
|
||||
# Motions, zooms, rotozooms, and transforms.
|
||||
style.motion.xanchor = 0
|
||||
style.motion.yanchor = 0
|
||||
style.motion.xpos = 0
|
||||
style.motion.ypos = 0
|
||||
|
||||
# Windows.
|
||||
style.window.background = Solid((0, 0, 0, 192))
|
||||
@@ -213,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
|
||||
@@ -238,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
|
||||
@@ -295,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
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
# Entry point for the developer console.
|
||||
label _developer:
|
||||
|
||||
if not config.developer:
|
||||
return
|
||||
|
||||
call _enter_menu from _call__enter_menu_4
|
||||
# This file contains code that helps support the development of Ren'Py
|
||||
# games.
|
||||
|
||||
label _developer_screen:
|
||||
|
||||
@@ -13,17 +8,19 @@ 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)
|
||||
|
||||
sg = "developer_menu"
|
||||
|
||||
layout.button("Return", None, clicked=ui.returns(True), size_group=sg)
|
||||
layout.button("Reload Game (Shift+R)", None, clicked=ui.callsinnewcontext("_save_reload_game"), size_group=sg)
|
||||
layout.button("Variable Viewer", None, clicked=ui.jumps("_debugger_screen"), size_group=sg)
|
||||
layout.button("Theme Test", None, clicked=ui.jumps("_theme_test"), size_group=sg)
|
||||
layout.button("Style Hierarchy", None, clicked=ui.jumps("_style_hierarchy"), size_group=sg)
|
||||
layout.button(u"Return", None, clicked=ui.returns(True), size_group=sg)
|
||||
layout.button(u"Reload Game (Shift+R)", None, clicked=ui.callsinnewcontext("_save_reload_game"), size_group=sg)
|
||||
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"Image Location Picker", None, clicked=ui.jumps("_image_location_picker"), size_group=sg)
|
||||
|
||||
ui.close()
|
||||
ui.interact()
|
||||
@@ -95,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:
|
||||
|
||||
@@ -287,3 +284,189 @@ init 1050 python:
|
||||
config.missing_show = __missing_show_callback
|
||||
config.missing_hide = __missing_hide_callback
|
||||
config.overlay_functions.append(__missing_overlay)
|
||||
|
||||
init -1050 python:
|
||||
|
||||
class __FPSMeter(object):
|
||||
|
||||
def __init__(self):
|
||||
self.last_frames = None
|
||||
self.last_time = None
|
||||
|
||||
def __call__(self, st, at):
|
||||
|
||||
if self.last_time is not None:
|
||||
frames = config.frames - self.last_frames
|
||||
time = st - self.last_time
|
||||
|
||||
text = "FPS: %.1f" % (frames / time)
|
||||
|
||||
else:
|
||||
text = "FPS: --.-"
|
||||
|
||||
self.last_frames = config.frames
|
||||
self.last_time = st
|
||||
|
||||
return Text(text, xalign=1.0), .5
|
||||
|
||||
label _fps_meter:
|
||||
|
||||
python hide:
|
||||
def fps_overlay():
|
||||
ui.add(DynamicDisplayable(__FPSMeter()))
|
||||
|
||||
# We normally don't want to change this at runtime... but here
|
||||
# it's okay, because we don't want to save the FPS meter anyway.
|
||||
#
|
||||
# Do as I say, not as I do.
|
||||
config.overlay_functions.append(fps_overlay)
|
||||
|
||||
return
|
||||
|
||||
init python:
|
||||
|
||||
# This is a displayable that can keep track of the mouse coordinates,
|
||||
# and show them to the user.
|
||||
class __ImageLocationPicker(renpy.Displayable):
|
||||
|
||||
def __init__(self, fn, **kwargs):
|
||||
super(__ImageLocationPicker, self).__init__(**kwargs)
|
||||
|
||||
self.child = Image(fn)
|
||||
|
||||
self.mouse = None
|
||||
self.point1 = None
|
||||
self.point2 = None
|
||||
|
||||
def render(self, width, height, st, at):
|
||||
rv = renpy.Render(width, height)
|
||||
|
||||
cr = renpy.render(self.child, width, height, st, at)
|
||||
rv.blit(cr, (0, 0))
|
||||
|
||||
text = [ ]
|
||||
|
||||
|
||||
if self.point1 and self.point2 and not self.point1 == self.point2:
|
||||
x1, y1 = self.point1
|
||||
x2, y2 = self.point2
|
||||
|
||||
x1 = min(x1, cr.width)
|
||||
x2 = min(x2, cr.width)
|
||||
y1 = min(y1, cr.height)
|
||||
y2 = min(y2, cr.height)
|
||||
|
||||
minx = min(x1, x2)
|
||||
miny = min(y1, y2)
|
||||
maxx = max(x1, x2)
|
||||
maxy = max(y1, y2)
|
||||
|
||||
w = maxx - minx
|
||||
h = maxy - miny
|
||||
|
||||
if w and h:
|
||||
|
||||
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),))
|
||||
|
||||
if self.mouse:
|
||||
mx, my = self.mouse
|
||||
if mx < cr.width and my < cr.height:
|
||||
text.append(_("Mouse position: %r") % (self.mouse,))
|
||||
|
||||
text.append(_("Right-click or escape to quit."))
|
||||
|
||||
td = Text("\n".join(text), size=14, color="#fff", outlines=[ (1, "#000", 0, 0 ) ])
|
||||
tr = renpy.render(td, width, height, st, at)
|
||||
|
||||
rv.blit(tr, (0, height - tr.height))
|
||||
|
||||
return rv
|
||||
|
||||
def event(self, ev, x, y, st):
|
||||
import pygame
|
||||
|
||||
self.mouse = (x, y)
|
||||
renpy.redraw(self, 0)
|
||||
|
||||
if ev.type == pygame.MOUSEBUTTONDOWN and ev.button == 1:
|
||||
self.point1 = (x, y)
|
||||
self.point2 = (x, y)
|
||||
|
||||
elif ev.type == pygame.MOUSEMOTION and ev.buttons[0]:
|
||||
self.point2 = (x, y)
|
||||
|
||||
elif ev.type == pygame.MOUSEBUTTONUP and ev.button == 1:
|
||||
self.point2 = (x, y)
|
||||
|
||||
|
||||
label _image_location_picker:
|
||||
|
||||
scene black
|
||||
|
||||
python hide:
|
||||
|
||||
image_files = [
|
||||
fn
|
||||
for dir, fn in renpy.loader.listdirfiles()
|
||||
if fn.lower().endswith(".jpg") or fn.lower().endswith(".png")
|
||||
if not fn[0] == "_"
|
||||
]
|
||||
|
||||
image_files.sort()
|
||||
|
||||
|
||||
xadjustment = ui.adjustment()
|
||||
yadjustment = ui.adjustment()
|
||||
|
||||
|
||||
while True:
|
||||
|
||||
ui.frame()
|
||||
ui.vbox()
|
||||
|
||||
layout.label(u"Image Location Picker", None)
|
||||
|
||||
ui.textbutton(_(u"Done"), clicked=ui.returns(False), size_group="files")
|
||||
|
||||
ui.side(['c', 'b', 'r'], spacing=5)
|
||||
vp = ui.viewport(xadjustment=xadjustment, yadjustment=yadjustment, mousewheel=True)
|
||||
|
||||
ui.vbox()
|
||||
|
||||
for fn in image_files:
|
||||
ui.button(clicked=ui.returns(fn), size_group="files", xminimum=1.0)
|
||||
ui.text(fn, style="button_text", xalign=0.0)
|
||||
|
||||
ui.close()
|
||||
|
||||
ui.bar(adjustment=xadjustment, style='scrollbar')
|
||||
ui.bar(adjustment=yadjustment, style='vscrollbar')
|
||||
ui.close()
|
||||
|
||||
ui.close()
|
||||
|
||||
rv = ui.interact()
|
||||
|
||||
if rv is False:
|
||||
renpy.jump("_developer_screen")
|
||||
|
||||
# Now, allow the user to pick the image.
|
||||
|
||||
ui.keymap(game_menu=ui.returns(True))
|
||||
ui.add(__ImageLocationPicker(rv))
|
||||
ui.interact()
|
||||
|
||||
|
||||
|
||||
# ...
|
||||
|
||||
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')
|
||||
@@ -75,7 +78,7 @@ init python:
|
||||
ui.close()
|
||||
|
||||
_joystick_get_binding()
|
||||
binding = ui.interact()
|
||||
binding = ui.interact(mouse="gamemenu")
|
||||
_joystick_take_binding(binding, key)
|
||||
|
||||
return True
|
||||
@@ -100,7 +103,7 @@ label joystick_preferences_screen:
|
||||
python:
|
||||
layout.navigation("joystick_preferences")
|
||||
_joystick_preferences()
|
||||
ui.interact()
|
||||
ui.interact(mouse="gamemenu")
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
layout.provides('load_save')
|
||||
@@ -73,7 +76,9 @@ init python:
|
||||
|
||||
ui.button(style=style.file_picker_entry[index],
|
||||
clicked=clicked,
|
||||
role=("selected_" if newest else ""))
|
||||
role=("selected_" if newest else ""),
|
||||
keymap={ "save_delete" : ui.returns(("unlink", name)) }
|
||||
)
|
||||
|
||||
ui.hbox(style=style.file_picker_entry_box[index])
|
||||
|
||||
@@ -183,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
|
||||
@@ -193,36 +201,45 @@ init python:
|
||||
# the list of save files.
|
||||
def _file_picker(screen, save):
|
||||
|
||||
# The number of slots in a page.
|
||||
file_page_length = config.file_page_cols * config.file_page_rows
|
||||
|
||||
saved_games = renpy.list_saved_games(regexp=r'(auto-|quick-)?[0-9]+')
|
||||
|
||||
newest = None
|
||||
newest_mtime = None
|
||||
save_info = { }
|
||||
|
||||
for fn, extra_info, screenshot, mtime in saved_games:
|
||||
screenshot = _file_picker_process_screenshot(screenshot)
|
||||
save_info[fn] = (extra_info, screenshot, mtime)
|
||||
|
||||
if not fn.startswith("auto-") and mtime > newest_mtime:
|
||||
newest = fn
|
||||
newest_mtime = mtime
|
||||
|
||||
# The index of the first entry in the page.
|
||||
fpp = __scratch.file_picker_page
|
||||
|
||||
if fpp is None:
|
||||
|
||||
if newest:
|
||||
fpp = _file_picker_file_page(newest)
|
||||
else:
|
||||
fpp = _file_picker_file_page("1")
|
||||
|
||||
|
||||
# Should we update the list of saved games?
|
||||
update = True
|
||||
|
||||
while True:
|
||||
|
||||
|
||||
if update:
|
||||
|
||||
update = False
|
||||
|
||||
# The number of slots in a page.
|
||||
file_page_length = config.file_page_cols * config.file_page_rows
|
||||
|
||||
# The list of saved games.
|
||||
saved_games = renpy.list_saved_games(regexp=r'(auto-|quick-)?[0-9]+')
|
||||
|
||||
# Figure out which game is the newest and so on.
|
||||
newest = None
|
||||
newest_mtime = None
|
||||
save_info = { }
|
||||
|
||||
for fn, extra_info, screenshot, mtime in saved_games:
|
||||
screenshot = _file_picker_process_screenshot(screenshot)
|
||||
save_info[fn] = (extra_info, screenshot, mtime)
|
||||
|
||||
if not fn.startswith("auto-") and mtime > newest_mtime:
|
||||
newest = fn
|
||||
newest_mtime = mtime
|
||||
|
||||
# The index of the first entry in the page.
|
||||
fpp = __scratch.file_picker_page
|
||||
|
||||
if fpp is None:
|
||||
if newest:
|
||||
fpp = _file_picker_file_page(newest)
|
||||
else:
|
||||
fpp = _file_picker_file_page("1")
|
||||
|
||||
|
||||
if fpp < 0:
|
||||
fpp = 0
|
||||
|
||||
@@ -291,9 +308,14 @@ init python:
|
||||
ui.close() # slots
|
||||
ui.close() # whole thing
|
||||
|
||||
result = ui.interact()
|
||||
result = ui.interact(mouse="gamemenu")
|
||||
type, value = result
|
||||
|
||||
if type == "unlink":
|
||||
if layout.yesno_prompt(screen, layout.DELETE_SAVE):
|
||||
renpy.unlink_save(value)
|
||||
update = True
|
||||
|
||||
if type == "return":
|
||||
return value
|
||||
|
||||
@@ -311,7 +333,7 @@ label save_screen:
|
||||
fn = _file_picker("save", True)
|
||||
|
||||
if renpy.can_load(fn):
|
||||
if not layout.yesno_prompt("save", u"Are you sure you want to overwrite your save?"):
|
||||
if not layout.yesno_prompt("save", layout.OVERWRITE_SAVE):
|
||||
continue
|
||||
|
||||
renpy.save(fn, extra_info=store.save_name)
|
||||
@@ -325,7 +347,7 @@ label load_screen:
|
||||
fn = _file_picker("load", False)
|
||||
|
||||
if _load_prompt:
|
||||
if not layout.yesno_prompt("load", u"Loading will lose unsaved progress.\nAre you sure you want to do this?"):
|
||||
if not layout.yesno_prompt("load", layout.LOADING):
|
||||
continue
|
||||
|
||||
renpy.load(fn)
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
layout.provides('main_menu')
|
||||
@@ -50,7 +53,7 @@ label main_menu_screen:
|
||||
|
||||
ui.close()
|
||||
|
||||
ui.interact()
|
||||
ui.interact(mouse="mainmenu")
|
||||
|
||||
return
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -54,7 +57,7 @@ init python:
|
||||
|
||||
ui.close()
|
||||
|
||||
ui.interact()
|
||||
ui.interact(mouse="gamemenu")
|
||||
|
||||
class _Preference(object):
|
||||
"""
|
||||
@@ -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')
|
||||
@@ -49,7 +52,7 @@ init python hide:
|
||||
ui.close()
|
||||
ui.close()
|
||||
|
||||
rv = ui.interact()
|
||||
rv = ui.interact(mouse="gamemenu")
|
||||
renpy.transition(config.intra_transition)
|
||||
return rv
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
layout.provides('main_menu')
|
||||
@@ -62,7 +65,7 @@ label main_menu_screen:
|
||||
|
||||
ui.close() # outer box
|
||||
|
||||
ui.interact()
|
||||
ui.interact(mouse="mainmenu")
|
||||
|
||||
return
|
||||
|
||||
|
||||
@@ -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):
|
||||
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:
|
||||
@@ -63,6 +86,7 @@ init python:
|
||||
clicked=clicked,
|
||||
focus_mask=True,
|
||||
style='imagemap_button',
|
||||
keymap=keymap,
|
||||
)
|
||||
|
||||
return (x1, y1, x2, y2)
|
||||
@@ -73,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(
|
||||
@@ -93,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")
|
||||
@@ -61,7 +64,9 @@ init python:
|
||||
|
||||
import time
|
||||
|
||||
(x1, y1, x2, y2) = ime.button("slot_%d" % index, clicked, newest)
|
||||
(x1, y1, x2, y2) = ime.button(
|
||||
"slot_%d" % index, clicked, newest,
|
||||
keymap={ "save_delete" : ui.returns(("unlink", name)) })
|
||||
|
||||
ui.fixed(xpos=x1, ypos=y1, xmaximum=x2-x1, ymaximum=y2-y1)
|
||||
|
||||
@@ -146,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
|
||||
@@ -157,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)
|
||||
@@ -202,32 +215,39 @@ init python:
|
||||
# The number of slots in a page.
|
||||
file_page_length = __scratch.per_page
|
||||
|
||||
saved_games = renpy.list_saved_games(regexp=r'(auto-|quick-)?[0-9]+')
|
||||
|
||||
newest = None
|
||||
newest_mtime = None
|
||||
save_info = { }
|
||||
|
||||
for fn, extra_info, screenshot, mtime in saved_games:
|
||||
screenshot = _file_picker_process_screenshot(screenshot)
|
||||
save_info[fn] = (extra_info, screenshot, mtime)
|
||||
|
||||
if not fn.startswith("auto-") and mtime > newest_mtime:
|
||||
newest = fn
|
||||
newest_mtime = mtime
|
||||
|
||||
# The index of the first entry in the page.
|
||||
fpp = __scratch.file_picker_page
|
||||
|
||||
if fpp is None:
|
||||
|
||||
if newest:
|
||||
fpp = _file_picker_file_page(newest)
|
||||
else:
|
||||
fpp = _file_picker_file_page("1")
|
||||
|
||||
update = True
|
||||
|
||||
while True:
|
||||
|
||||
if update:
|
||||
|
||||
update = False
|
||||
|
||||
saved_games = renpy.list_saved_games(regexp=r'(auto-|quick-)?[0-9]+')
|
||||
|
||||
newest = None
|
||||
newest_mtime = None
|
||||
save_info = { }
|
||||
|
||||
for fn, extra_info, screenshot, mtime in saved_games:
|
||||
screenshot = _file_picker_process_screenshot(screenshot)
|
||||
save_info[fn] = (extra_info, screenshot, mtime)
|
||||
|
||||
if not fn.startswith("auto-") and mtime > newest_mtime:
|
||||
newest = fn
|
||||
newest_mtime = mtime
|
||||
|
||||
# The index of the first entry in the page.
|
||||
fpp = __scratch.file_picker_page
|
||||
|
||||
if fpp is None:
|
||||
|
||||
if newest:
|
||||
fpp = _file_picker_file_page(newest)
|
||||
else:
|
||||
fpp = _file_picker_file_page("1")
|
||||
|
||||
|
||||
if fpp < 0:
|
||||
fpp = 0
|
||||
|
||||
@@ -240,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):
|
||||
@@ -289,9 +310,14 @@ init python:
|
||||
|
||||
ime.close()
|
||||
|
||||
result = ui.interact()
|
||||
result = ui.interact(mouse="gamemenu")
|
||||
type, value = result
|
||||
|
||||
if type == "unlink":
|
||||
if layout.yesno_prompt(screen, layout.DELETE_SAVE):
|
||||
renpy.unlink_save(value)
|
||||
update = True
|
||||
|
||||
if type == "return":
|
||||
return value
|
||||
|
||||
@@ -309,7 +335,7 @@ label save_screen:
|
||||
fn = _file_picker("save", True)
|
||||
|
||||
if renpy.can_load(fn):
|
||||
if not layout.yesno_prompt("save", u"Are you sure you want to overwrite your save?"):
|
||||
if not layout.yesno_prompt("save", layout.OVERWRITE_SAVE):
|
||||
continue
|
||||
|
||||
renpy.save(fn, extra_info=store.save_name)
|
||||
@@ -322,7 +348,7 @@ label load_screen:
|
||||
fn = _file_picker("load", False)
|
||||
|
||||
if _load_prompt:
|
||||
if not layout.yesno_prompt("load", u"Loading will lose unsaved progress.\nAre you sure you want to do this?"):
|
||||
if not layout.yesno_prompt("load", layout.LOADING):
|
||||
continue
|
||||
|
||||
renpy.load(fn)
|
||||
|
||||
@@ -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,27 +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_hotspots)
|
||||
|
||||
for e in config.main_menu:
|
||||
name = e[0]
|
||||
act = e[1]
|
||||
enable = e[2]
|
||||
config.main_menu_idle,
|
||||
config.main_menu_selected,
|
||||
config.main_menu_hotspots,
|
||||
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,13 +124,16 @@ 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()
|
||||
ui.interact(mouse="gamemenu")
|
||||
|
||||
label 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')
|
||||
@@ -8,15 +11,18 @@ init python hide:
|
||||
style.yesno_prompt = Style(style.prompt, help="a yes/no prompt")
|
||||
style.yesno_prompt_text = Style(style.prompt_text, help="a yes/no prompt (text)")
|
||||
|
||||
# Configuration variables
|
||||
# Define config variables.
|
||||
config.yesno_prompt_ground = None
|
||||
config.yesno_prompt_idle = None
|
||||
config.yesno_prompt_hover = None
|
||||
config.yesno_prompt_hotspots = None
|
||||
config.yesno_prompt_hotspots = None
|
||||
|
||||
config.yesno_prompt_message_images = { }
|
||||
|
||||
|
||||
def yesno_prompt(screen, message):
|
||||
renpy.transition(config.intra_transition)
|
||||
|
||||
|
||||
ime = _ImageMapper(
|
||||
screen,
|
||||
config.yesno_prompt_ground,
|
||||
@@ -31,9 +37,15 @@ init python hide:
|
||||
|
||||
ime.close()
|
||||
|
||||
layout.prompt(message, "yesno")
|
||||
default = config.yesno_prompt_message_images.get(layout.ARE_YOU_SURE, None)
|
||||
message_image = config.yesno_prompt_message_images.get(message, default)
|
||||
|
||||
if message_image:
|
||||
ui.add(message_image)
|
||||
else:
|
||||
layout.prompt(message, "yesno")
|
||||
|
||||
rv = ui.interact()
|
||||
rv = ui.interact(mouse="gamemenu")
|
||||
renpy.transition(config.intra_transition)
|
||||
return rv
|
||||
|
||||
|
||||
@@ -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')
|
||||
@@ -69,125 +72,134 @@ init python:
|
||||
|
||||
def _file_picker(screen):
|
||||
|
||||
@renpy.curry
|
||||
def hovered(thumbnail):
|
||||
if __session.thumbnail is not thumbnail:
|
||||
__session.thumbnail = thumbnail
|
||||
renpy.restart_interaction()
|
||||
while True:
|
||||
|
||||
@renpy.curry
|
||||
def unhovered(thumbnail):
|
||||
if __session.thumbnail is thumbnail:
|
||||
__session.thumbnail = None
|
||||
renpy.restart_interaction()
|
||||
@renpy.curry
|
||||
def hovered(thumbnail):
|
||||
if __session.thumbnail is not thumbnail:
|
||||
__session.thumbnail = thumbnail
|
||||
renpy.restart_interaction()
|
||||
|
||||
__session.thumbnail = None
|
||||
|
||||
layout.navigation(screen)
|
||||
|
||||
newest = None
|
||||
newest_time = None
|
||||
@renpy.curry
|
||||
def unhovered(thumbnail):
|
||||
if __session.thumbnail is thumbnail:
|
||||
__session.thumbnail = None
|
||||
renpy.restart_interaction()
|
||||
|
||||
info = { }
|
||||
|
||||
for name, extra_info, thumbnail, time in renpy.list_saved_games():
|
||||
|
||||
info[name] = (extra_info, thumbnail, time)
|
||||
|
||||
if not name[0] in "0123456789":
|
||||
continue
|
||||
|
||||
if time > newest_time:
|
||||
newest = name
|
||||
newest_time = time
|
||||
|
||||
slots = [ ]
|
||||
|
||||
for i in range(1, config.load_save_slots + 1):
|
||||
slots.append((str(i), str(i)))
|
||||
|
||||
if config.has_quicksave:
|
||||
for i in range(1, config.load_save_quick_slots + 1):
|
||||
slots.append(('quick-'+ str(i), _(u'q') + str(i)))
|
||||
|
||||
if config.has_autosave:
|
||||
for i in range(1, config.load_save_auto_slots + 1):
|
||||
slots.append(('auto-' + str(i), _(u'a') + str(i)))
|
||||
|
||||
ui.frame(style=style.file_picker_frame)
|
||||
ui.side(['c', 'r'], style=style.file_picker_side)
|
||||
|
||||
|
||||
|
||||
if __session.scrollbar_position is None:
|
||||
if newest is None:
|
||||
yoffset = 0
|
||||
else:
|
||||
yoffset = 1.0 * (int(newest) - 1) / len(slots)
|
||||
value = 0
|
||||
|
||||
else:
|
||||
value = __session.scrollbar_position
|
||||
yoffset = None
|
||||
|
||||
adj = ui.adjustment(value=value)
|
||||
ui.viewport(yadjustment=adj, offsets=(0, yoffset), style=style.file_picker_viewport, mousewheel=True)
|
||||
|
||||
ui.vbox(style=style.file_picker_box, focus=renpy.time.time())
|
||||
|
||||
|
||||
for i, (fn, n) in enumerate(slots):
|
||||
|
||||
clicked = ui.returns(fn)
|
||||
|
||||
if screen == "save" and fn.startswith("auto-"):
|
||||
clicked = None
|
||||
|
||||
if screen == "load" and fn not in info:
|
||||
clicked = None
|
||||
|
||||
if fn in info:
|
||||
extra_info, thumbnail, time = info[fn]
|
||||
|
||||
ui.button(style=style.file_picker_entry[i],
|
||||
clicked=clicked,
|
||||
hovered=hovered(thumbnail),
|
||||
unhovered=unhovered(thumbnail),
|
||||
role = "selected_" if (fn == newest) else "")
|
||||
|
||||
s = config.file_entry_format % dict(
|
||||
time=renpy.time.strftime(
|
||||
config.time_format,
|
||||
renpy.time.localtime(time)),
|
||||
save_name=extra_info)
|
||||
|
||||
ui.text(n + ". " + s, style=style.file_picker_text[i])
|
||||
|
||||
else:
|
||||
ui.button(style=style.file_picker_entry[i],
|
||||
clicked=clicked,
|
||||
role = "selected_" if (fn == newest) else "")
|
||||
|
||||
ui.text(n + ". " + _(u"Empty Slot."),
|
||||
style=style.file_picker_text[i])
|
||||
|
||||
ui.close() # vbox/viewport
|
||||
|
||||
ui.bar(adjustment=adj, style=style.file_picker_scrollbar)
|
||||
|
||||
ui.close() # side/window
|
||||
|
||||
# Thumbnail.
|
||||
ui.frame(style=style.thumbnail_frame)
|
||||
ui.add(DynamicDisplayable(_file_picker_thumbnail))
|
||||
|
||||
try:
|
||||
rv = ui.interact()
|
||||
finally:
|
||||
__session.scrollbar_position = adj.value
|
||||
__session.thumbnail = None
|
||||
|
||||
return rv
|
||||
layout.navigation(screen)
|
||||
|
||||
newest = None
|
||||
newest_time = None
|
||||
|
||||
info = { }
|
||||
|
||||
for name, extra_info, thumbnail, time in renpy.list_saved_games():
|
||||
|
||||
info[name] = (extra_info, thumbnail, time)
|
||||
|
||||
if not name[0] in "0123456789":
|
||||
continue
|
||||
|
||||
if time > newest_time:
|
||||
newest = name
|
||||
newest_time = time
|
||||
|
||||
slots = [ ]
|
||||
|
||||
for i in range(1, config.load_save_slots + 1):
|
||||
slots.append((str(i), str(i)))
|
||||
|
||||
if config.has_quicksave:
|
||||
for i in range(1, config.load_save_quick_slots + 1):
|
||||
slots.append(('quick-'+ str(i), _(u'q') + str(i)))
|
||||
|
||||
if config.has_autosave:
|
||||
for i in range(1, config.load_save_auto_slots + 1):
|
||||
slots.append(('auto-' + str(i), _(u'a') + str(i)))
|
||||
|
||||
ui.frame(style=style.file_picker_frame)
|
||||
ui.side(['c', 'r'], style=style.file_picker_side)
|
||||
|
||||
|
||||
|
||||
if __session.scrollbar_position is None:
|
||||
if newest is None:
|
||||
yoffset = 0
|
||||
else:
|
||||
yoffset = 1.0 * (int(newest) - 1) / len(slots)
|
||||
value = 0
|
||||
|
||||
else:
|
||||
value = __session.scrollbar_position
|
||||
yoffset = None
|
||||
|
||||
adj = ui.adjustment(value=value)
|
||||
ui.viewport(yadjustment=adj, offsets=(0, yoffset), style=style.file_picker_viewport, mousewheel=True)
|
||||
|
||||
ui.vbox(style=style.file_picker_box, focus=renpy.time.time())
|
||||
|
||||
|
||||
for i, (fn, n) in enumerate(slots):
|
||||
|
||||
clicked = ui.returns(("select", fn))
|
||||
|
||||
if screen == "save" and fn.startswith("auto-"):
|
||||
clicked = None
|
||||
|
||||
if screen == "load" and fn not in info:
|
||||
clicked = None
|
||||
|
||||
if fn in info:
|
||||
extra_info, thumbnail, time = info[fn]
|
||||
|
||||
ui.button(style=style.file_picker_entry[i],
|
||||
clicked=clicked,
|
||||
hovered=hovered(thumbnail),
|
||||
unhovered=unhovered(thumbnail),
|
||||
role = "selected_" if (fn == newest) else "",
|
||||
keymap = { "save_delete" : ui.returns(("unlink", fn)) },
|
||||
)
|
||||
|
||||
s = config.file_entry_format % dict(
|
||||
time=renpy.time.strftime(
|
||||
config.time_format,
|
||||
renpy.time.localtime(time)),
|
||||
save_name=extra_info)
|
||||
|
||||
ui.text(n + ". " + s, style=style.file_picker_text[i])
|
||||
|
||||
else:
|
||||
ui.button(style=style.file_picker_entry[i],
|
||||
clicked=clicked,
|
||||
role = "selected_" if (fn == newest) else "")
|
||||
|
||||
ui.text(n + ". " + _(u"Empty Slot."),
|
||||
style=style.file_picker_text[i])
|
||||
|
||||
ui.close() # vbox/viewport
|
||||
|
||||
ui.bar(adjustment=adj, style=style.file_picker_scrollbar)
|
||||
|
||||
ui.close() # side/window
|
||||
|
||||
# Thumbnail.
|
||||
ui.frame(style=style.thumbnail_frame)
|
||||
ui.add(DynamicDisplayable(_file_picker_thumbnail))
|
||||
|
||||
try:
|
||||
action, arg = ui.interact(mouse="gamemenu")
|
||||
finally:
|
||||
__session.scrollbar_position = adj.value
|
||||
__session.thumbnail = None
|
||||
|
||||
if action == "select":
|
||||
return arg
|
||||
|
||||
elif action == "unlink":
|
||||
if layout.yesno_prompt("save", layout.DELETE_SAVE):
|
||||
renpy.unlink_save(arg)
|
||||
|
||||
|
||||
label save_screen:
|
||||
@@ -197,7 +209,7 @@ label save_screen:
|
||||
fn = _file_picker("save")
|
||||
|
||||
if renpy.can_load(fn):
|
||||
if not layout.yesno_prompt("save", u"Are you sure you want to overwrite your save?"):
|
||||
if not layout.yesno_prompt("save", layout.OVERWRITE_SAVE):
|
||||
continue
|
||||
|
||||
renpy.save(fn, extra_info=store.save_name)
|
||||
@@ -211,7 +223,7 @@ label load_screen:
|
||||
fn = _file_picker("load")
|
||||
|
||||
if _load_prompt:
|
||||
if not layout.yesno_prompt("load", u"Loading will lose unsaved progress.\nAre you sure you want to do this?"):
|
||||
if not layout.yesno_prompt("load", layout.LOADING):
|
||||
continue
|
||||
|
||||
renpy.load(fn)
|
||||
|
||||
@@ -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 |
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 85 KiB |
@@ -1,106 +0,0 @@
|
||||
# This file contains the code that demonstrates animation.
|
||||
|
||||
init:
|
||||
|
||||
# A simple animation. We interleave the displayables we want to
|
||||
# show with the times we want to show them for.
|
||||
image eileen animated = Animation(
|
||||
"eileen_vhappy.png", 1.0,
|
||||
"eileen_happy.png", 1.0)
|
||||
|
||||
image transanimation = anim.TransitionAnimation(
|
||||
im.Scale("whitehouse.jpg", 400, 300), 1.0, dissolve,
|
||||
im.Scale("washington.jpg", 400, 300), 1.0, dissolve)
|
||||
|
||||
# The blink animation.
|
||||
image blinking text = anim.Blink(Text("Blink", color="#ff0", size=72))
|
||||
|
||||
# A state machine-based animation.
|
||||
image smanim = anim.SMAnimation(
|
||||
|
||||
# The name of the starting state.
|
||||
"r",
|
||||
|
||||
# The states we use, and the displayables we show during those
|
||||
# states.
|
||||
anim.State("r", "#f00"),
|
||||
anim.State("g", "#0f0"),
|
||||
anim.State("b", "#00f"),
|
||||
|
||||
# The edges, given as a state, a time we remain in that state for,
|
||||
# the new state, and the time it takes to transition between the
|
||||
# two of them.
|
||||
#
|
||||
# dissolve only works with solid images. move is also useful here.
|
||||
anim.Edge("r", .5, "g", dissolve),
|
||||
anim.Edge("r", .5, "b", dissolve),
|
||||
|
||||
anim.Edge("g", .5, "r", dissolve),
|
||||
anim.Edge("g", .5, "b", dissolve),
|
||||
|
||||
anim.Edge("b", .5, "r", dissolve),
|
||||
anim.Edge("b", .5, "g", dissolve),
|
||||
)
|
||||
|
||||
label demo_animation:
|
||||
|
||||
|
||||
|
||||
e "Ren'Py supports a number of ways of creating animations."
|
||||
|
||||
e "These animations let you vary images, independent of the user's clicks."
|
||||
|
||||
show eileen animated
|
||||
|
||||
e "For example, I'm switching my expression back and forth, once a second."
|
||||
|
||||
e "Even though you clicked, I'm still doing it."
|
||||
|
||||
e "This is an example of the Animation function at work."
|
||||
|
||||
show eileen happy
|
||||
|
||||
e "The Animation function is limited to simple lists of images, with fixed delays between them."
|
||||
|
||||
e "The sequence can repeat, or can stop after one go-through."
|
||||
|
||||
show eileen happy at right
|
||||
show transanimation at Position(xpos=50, ypos=50, xanchor=0, yanchor=0)
|
||||
with moveinleft
|
||||
|
||||
e "The anim.TransitionAnimation function is similar, but it lets you specify a transition between frames."
|
||||
|
||||
show eileen happy
|
||||
hide transanimation
|
||||
with moveoutleft
|
||||
|
||||
e "If you want more control, you can use the anim.SMAnimation function."
|
||||
|
||||
e "It can randomly change images, and even apply transitions to changes."
|
||||
|
||||
scene smanim
|
||||
show eileen happy
|
||||
with dissolve
|
||||
|
||||
e "Here, we are randomly dissolving the background between red, green, and blue images."
|
||||
|
||||
e "Psychadelic."
|
||||
|
||||
scene bg washington
|
||||
show eileen happy
|
||||
with dissolve
|
||||
|
||||
e "It's probably best if we stop here, before somebody's brain explodes."
|
||||
|
||||
show blinking text at Position(xalign=.5, yalign=.7)
|
||||
|
||||
e "Finally, there's anim.Blink, which can be used to blink things in and out."
|
||||
|
||||
e "I don't know why you'd want to do that to a character, but blinking text seems reasonable for signs and things like that."
|
||||
|
||||
hide blinking text
|
||||
with dissolve
|
||||
|
||||
return
|
||||
|
||||
|
||||
@@ -1,135 +0,0 @@
|
||||
# This file contains some of the basics of Ren'Py. This is stuff you'll use in
|
||||
# just about every game.
|
||||
|
||||
# First, we have an init block that contains many of the definitions we
|
||||
# use in the game
|
||||
init:
|
||||
|
||||
# Here we define the backgrounds that are used by the demo.
|
||||
image bg washington = "washington.jpg"
|
||||
image bg whitehouse = "whitehouse.jpg"
|
||||
|
||||
# And this is the character art we use in the demo.
|
||||
image eileen happy = "eileen_happy.png"
|
||||
image eileen vhappy = "eileen_vhappy.png"
|
||||
image eileen concerned = "eileen_concerned.png"
|
||||
|
||||
# Now, we declare the characters.
|
||||
$ e = Character('Eileen', color="#c8ffc8")
|
||||
|
||||
|
||||
# In a real game, we would have:
|
||||
#
|
||||
# label start:
|
||||
#
|
||||
# here. But since we are inside the demo game, we have to use a different
|
||||
# label.
|
||||
|
||||
label demo_basics:
|
||||
|
||||
e "This is our demonstration of the basics of using Ren'Py. You may want to click the button at the upper-right of the screen, to follow along."
|
||||
|
||||
"Somehow, I realize that Ren'Py supports narration."
|
||||
|
||||
e "Ren'Py supports dialogue, as long as you declare a character first. If it didn't I wouldn't be able to talk to you."
|
||||
|
||||
e "Ren'Py also supports menus, which let you make decisions based on user input."
|
||||
|
||||
|
||||
menu:
|
||||
|
||||
e "Do you think you'd ever use menus in a game?"
|
||||
|
||||
"Yes.":
|
||||
|
||||
jump about_menus_yes
|
||||
|
||||
"No.":
|
||||
|
||||
jump about_menus_no
|
||||
|
||||
"I'm not ready to make that decision yet.":
|
||||
|
||||
jump about_menus_unsure
|
||||
|
||||
label about_menus_yes:
|
||||
|
||||
$ about_menus_choice = "yes"
|
||||
|
||||
e "Menus are the most important way of providing interactivity to a game."
|
||||
|
||||
jump about_menus_done
|
||||
|
||||
label about_menus_no:
|
||||
|
||||
$ about_menus_choice = "no"
|
||||
|
||||
e "That's okay, Ren'Py has been used to make a number of linear games, which we call kinetic novels."
|
||||
|
||||
jump about_menus_done
|
||||
|
||||
label about_menus_unsure:
|
||||
|
||||
$ about_menus_choice = "unsure"
|
||||
|
||||
e "Well, it doesn't really matter. Whatever you decide, Ren'Py is ready for you."
|
||||
|
||||
jump about_menus_done
|
||||
|
||||
|
||||
label about_menus_done:
|
||||
|
||||
e "Ren'Py wouldn't be much of a visual novel engine if it didn't support images."
|
||||
|
||||
scene bg whitehouse
|
||||
with dissolve
|
||||
|
||||
e "The scene statement clears the screen, and optionally lets you place a single new image on the screen."
|
||||
|
||||
show eileen happy
|
||||
with dissolve
|
||||
|
||||
e "The show statement shows images to the user."
|
||||
|
||||
show eileen vhappy
|
||||
with dissolve
|
||||
|
||||
e "Showing an image with the same tag, the same first part of the name, as an already-show image replaces that image."
|
||||
|
||||
show eileen happy at right
|
||||
with dissolve
|
||||
|
||||
e "Images can be shown at different locations on the screen, and you can show as many images on the screen as you want."
|
||||
|
||||
hide eileen happy
|
||||
with dissolve
|
||||
|
||||
e "The hide statement hides images, although with scene statement clearing the screen and the show statement replacing images, it's rarely necessary to do so."
|
||||
|
||||
scene bg washington
|
||||
show eileen happy
|
||||
with dissolve
|
||||
|
||||
e "Finally, the with statement is what we use to perform a transition from one screen to the next."
|
||||
|
||||
e "That's all you need to make a simple game, like a kinetic novel."
|
||||
|
||||
e "But I would be remiss if I didn't mention that Ren'Py can store data, and make decisions based on it."
|
||||
|
||||
if about_menus_choice == "yes":
|
||||
|
||||
e "For example, I remember you wanted to use menus in your game."
|
||||
|
||||
elif about_menus_choice == "no":
|
||||
|
||||
e "For example, I remember you didn't want to use menus."
|
||||
|
||||
else:
|
||||
|
||||
e "For example, I remember you weren't sure about menus."
|
||||
|
||||
e "Ren'Py embeds the Python programming language, which lets you do some very sophisticated things."
|
||||
|
||||
e "But you don't need learn Python if you don't want to."
|
||||
|
||||
return
|
||||
@@ -1,103 +0,0 @@
|
||||
# This file demonstrates the Ren'Py User Experience... the features you get
|
||||
# for free by choosing to use Ren'Py as a visual novel engine.
|
||||
|
||||
init:
|
||||
image popup prefs = "prefs.png"
|
||||
image popup save = "save.png"
|
||||
|
||||
label demo_experience:
|
||||
|
||||
e "One of the goals of Ren'Py is to provide visual novel players with a good user experience."
|
||||
|
||||
e "To ensure this, there are a number of features that are included as part of every Ren'Py game. Here, we'll show off some of these features."
|
||||
|
||||
e "Skipping can be turned on from the game menu, or when the user presses the Tab key. It is also enabled while the user holds down either Ctrl key."
|
||||
|
||||
e "By default it only skips read text, so if it's your first time reading this, it won't do anything. That can be changed from the game menu."
|
||||
|
||||
e "On the second and later times reading a screen of text, it will skip right through it."
|
||||
|
||||
e "Rollback is a feature that lets you go back in time to previous screens, letting you re-read text."
|
||||
|
||||
menu:
|
||||
|
||||
e "Would you like to hear more about rollback?"
|
||||
|
||||
"Yes.":
|
||||
|
||||
jump demo_rollback
|
||||
|
||||
"No.":
|
||||
|
||||
jump demo_rollback_done
|
||||
|
||||
|
||||
label demo_rollback:
|
||||
|
||||
e "You can invoke a rollback by scrolling the mouse wheel up, or by pushing the page up key. That'll bring you back to the previous screen."
|
||||
|
||||
e "While at a previous screen, you can roll forward by scrolling the mouse wheel down, or pushing the page down key."
|
||||
|
||||
e "Rolling forward through a menu will make the same choice you did last time. You can also make a different choice, if you change your mind."
|
||||
|
||||
e "You can try it by rolling back through the last menu, and saying 'No'."
|
||||
|
||||
e "Press page up, or scroll up the mouse wheel."
|
||||
|
||||
show eileen concerned
|
||||
|
||||
e "Well, are you going to try it?"
|
||||
|
||||
e "Your loss."
|
||||
|
||||
e "Moving on."
|
||||
|
||||
show eileen happy
|
||||
|
||||
label demo_rollback_done:
|
||||
|
||||
e "Now, let me show off the game menu. You can access the game menu by right clicking, or by hitting escape. You can get back by doing the same thing, or by clicking \"Return\"."
|
||||
|
||||
e "The game menu lets you do many things."
|
||||
|
||||
show popup save at Position(ypos=.1, yanchor=0, xpos=0, xanchor=1.0)
|
||||
with None
|
||||
|
||||
show popup save at Position(xpos=.1, ypos=.1, xanchor=0, yanchor=0)
|
||||
show eileen happy at right
|
||||
with move
|
||||
|
||||
e "The save screen lets you save a game, while the load screen lets you load the game back in."
|
||||
|
||||
e "Unlike many game engines, Ren'Py supports an unlimited number of save slots."
|
||||
|
||||
show popup prefs at Position(xpos=.1, ypos=.1, xanchor=0, yanchor=0)
|
||||
with dissolve
|
||||
|
||||
e "The preferences screen lets the end-user change some aspects of the behavior of Ren'Py."
|
||||
|
||||
e "The user can choose if the game runs in a window, or fullscreen."
|
||||
|
||||
e "By setting transitions to None, a user can eliminate transitions entirely."
|
||||
|
||||
e "A user can choose if the skipping feature skips all messages, or only seen messages, and if it stops when an in-game menu is selected."
|
||||
|
||||
e "When the text speed setting isn't the maximum, text will be drawn onto the screen one character at a time."
|
||||
|
||||
e "The auto-forward time setting controls how long we will wait before automatically advancing through text."
|
||||
|
||||
e "The auto-forward time is adjusted by the length of the text being shown."
|
||||
|
||||
e "Finally, we allow the user to choose the volume for music, voice, and sound effects."
|
||||
|
||||
e "From the game menu, the user can return to the game, begin skipping, return to the main menu, or quit entirely."
|
||||
|
||||
show popup save at Position(ypos=.1, yanchor=0, xpos=0, xanchor=1.0)
|
||||
show eileen happy at center
|
||||
with move
|
||||
|
||||
hide popup save
|
||||
|
||||
e "And that's part of how Ren'Py gives end-users the experience they expect."
|
||||
|
||||
return
|
||||
@@ -1,166 +0,0 @@
|
||||
init:
|
||||
# Defines a big image we can pan over.
|
||||
image bg onememorial = "1memorial.jpg"
|
||||
|
||||
# Defines a SnowBlossom object, which uses particle motion to show falling
|
||||
# cherry blossom petals.
|
||||
image snowblossom = SnowBlossom(anim.Filmstrip("sakura.png", (20, 20), (2, 1), .15), fast=True)
|
||||
|
||||
# Defines the magic circle image.
|
||||
image magic_circle = "magic.png"
|
||||
|
||||
# Defines an image that zooms between various sizes.
|
||||
image logo sizezoom = Animation(
|
||||
At("logo.png", SizeZoom((100, 300), (300, 100), 1, opaque=False)), 1,
|
||||
At("logo.png", SizeZoom((300, 100), (100, 300), 1, opaque=False)), 1,
|
||||
)
|
||||
|
||||
# Defines a spline motion.
|
||||
init python:
|
||||
spline = SplineMotion([
|
||||
((-0.042, 0.523,),),
|
||||
((0.768, 0.296,), (0.082, 0.507,), (0.772, 0.573,),),
|
||||
((0.292, 0.304,), (0.766, 0.112,), (0.296, 0.123,),),
|
||||
((1.152, 0.509,), (0.288, 0.555,), (1.076, 0.499,),),
|
||||
], 3.0, anchors=(0.5, 0.5))
|
||||
|
||||
label demo_movement:
|
||||
|
||||
|
||||
e "I'm not stuck standing in the middle of the screen, even though I like being the center of attention."
|
||||
|
||||
e "Positions, given with an at clause, specify where I'm standing, while the 'move' transition moves around images that have changed position."
|
||||
|
||||
e "For example..."
|
||||
|
||||
show eileen happy at left
|
||||
with move
|
||||
|
||||
e "The left position has my left side border the left side of the screen."
|
||||
|
||||
show eileen happy at center
|
||||
with move
|
||||
|
||||
e "I can also move to the center..."
|
||||
|
||||
show eileen happy at right
|
||||
with move
|
||||
|
||||
e "and the right."
|
||||
|
||||
e "We don't limit you to these positions either. You can always create your own Position objects."
|
||||
|
||||
# This is necessary to restart the time at which we are
|
||||
# shown.
|
||||
hide eileen happy
|
||||
|
||||
show eileen happy at Move((1.0, 1.0, 1.0, 1.0),
|
||||
(0.0, 1.0, 0.0, 1.0),
|
||||
4.0, repeat=True, bounce=True)
|
||||
|
||||
e "It's also possible to have a movement happen while showing dialogue on the screen, using the Move function."
|
||||
|
||||
e "Move can repeat a movement, and even have it bounce back and forth, like I'm doing now."
|
||||
|
||||
|
||||
show eileen happy at Move((.25, 1.0, 0.0, 1.0),
|
||||
(.75, 1.0, 1.0, 1.0),
|
||||
10.0, repeat=True, bounce=True, subpixel=True)
|
||||
|
||||
with dissolve
|
||||
|
||||
e "Our subpixel mode allows slow moves, of less than a few pixels a second, to be very accurate."
|
||||
|
||||
scene bg onememorial at Pan((0, 800), (0, 0), 10.0)
|
||||
with dissolve
|
||||
|
||||
e "We can pan around an image larger than the screen, using the Pan function in an at clause. That's what we're doing now."
|
||||
|
||||
scene bg whitehouse
|
||||
with dissolve
|
||||
|
||||
# spline is defined near the top of this file.
|
||||
show logo base at spline
|
||||
|
||||
e "SplineMotion allows for more complex movements to be defined."
|
||||
|
||||
hide logo base
|
||||
|
||||
scene bg whitehouse at Zoom((800, 600), (0, 0, 800, 600), (225, 150, 400, 300), 1.0)
|
||||
|
||||
e "We can zoom into images..."
|
||||
|
||||
scene bg whitehouse at Zoom((800, 600), (225, 150, 400, 300), (0, 0, 800, 600), 1.0)
|
||||
|
||||
e "... and zoom back out of them again."
|
||||
|
||||
scene bg whitehouse
|
||||
show eileen happy at FactorZoom(1.0, 0.5, 1.0, opaque=False), center
|
||||
|
||||
e "We can also zoom images by a factor..."
|
||||
|
||||
show eileen happy at FactorZoom(0.5, 1.0, 1.0, opaque=False), center
|
||||
|
||||
e "... and zoom {i}them{/i} out again."
|
||||
|
||||
show eileen happy at left
|
||||
# logo sizezoom is defined at the top of this file.
|
||||
show logo sizezoom at Position(xalign=.75, yalign=.4)
|
||||
with moveinright
|
||||
|
||||
e "We can scale images to arbitrary sizes."
|
||||
|
||||
show eileen happy at center
|
||||
hide logo sizezoom
|
||||
with moveoutright
|
||||
|
||||
with Pause(.5)
|
||||
|
||||
$ renpy.layer_at_list([ Zoom((800, 600), (0, 0, 800, 600), (200, 0, 400, 300), 1)])
|
||||
with Pause(1)
|
||||
$ renpy.layer_at_list([ Zoom((800, 600), (200, 0, 400, 300), (0, 0, 800, 600), 1)])
|
||||
with Pause(1)
|
||||
$ renpy.layer_at_list([ ])
|
||||
|
||||
e "We can apply motions to a layer as a whole."
|
||||
|
||||
show eileen happy
|
||||
show magic_circle at RotoZoom(0, 360, 5, 0, 1, 1, rot_repeat=True, rot_anim_timebase=True, opaque=False, xalign=0.5, yalign=0.5)
|
||||
|
||||
with Pause(1)
|
||||
|
||||
e "We can rotate and zoom images in a single operation."
|
||||
|
||||
e "And when we're no longer feeling so occult, we can zoom them back out again."
|
||||
|
||||
show magic_circle at RotoZoom(0, 360, 5, 1, 0, 1, rot_repeat=True, rot_anim_timebase=True, opaque=False, xalign=0.5, yalign=0.5)
|
||||
|
||||
with Pause(1)
|
||||
|
||||
hide magic_circle
|
||||
|
||||
show eileen happy
|
||||
show logo base at Position(xpos=250, ypos=300, xanchor=0.5, yanchor=0.5), Revolve(0, 360, 4, repeat=True) behind eileen
|
||||
with dissolve
|
||||
|
||||
"We can also revolve an image around in a circle."
|
||||
|
||||
show bg washington
|
||||
hide logo base
|
||||
show snowblossom
|
||||
with dissolve
|
||||
|
||||
e "Finally, Ren'Py has a particle motion system, that can be used for things like falling cherry blossoms, falling snow, and rising bubbles."
|
||||
|
||||
e "The particle motion system uses a factory to create particles over the course of an interaction."
|
||||
|
||||
e "While the SnowBlossom function wraps a factory that provides convenient support for things rising and falling in straight lines, it's also possible to define your own."
|
||||
|
||||
e "The sky's the limit."
|
||||
|
||||
e "Or the ground, in the case of these cherry blossoms."
|
||||
|
||||
hide snowblossom
|
||||
with dissolve
|
||||
|
||||
return
|
||||
@@ -1,57 +0,0 @@
|
||||
# This file contains demonstrations of Ren'Py's multimedia
|
||||
# support. Right now, this is just showing off sound and music, but
|
||||
# Ren'Py does support movies, and we'll add them sometime later.
|
||||
|
||||
image movie = Movie(size=(320, 240), xpos=475, ypos=50, xanchor=0, yanchor=0)
|
||||
|
||||
label demo_multimedia:
|
||||
|
||||
e "Ren'Py supports a number of multimedia functions."
|
||||
|
||||
e "You're probably hearing music playing in the background."
|
||||
|
||||
# This stops the music, and fades it out.
|
||||
stop music fadeout 0.5
|
||||
|
||||
e "We can stop it, with a fadeout..."
|
||||
|
||||
# This plays music.
|
||||
play music "mozart.ogg"
|
||||
|
||||
e "... and start it playing again."
|
||||
|
||||
# This plays a sound effect.
|
||||
play sound "18005551212.ogg"
|
||||
|
||||
e "We can play sound effects on top of the music."
|
||||
|
||||
$ renpy.music.set_pan(-1, 0)
|
||||
$ renpy.music.set_pan( 1, 2)
|
||||
|
||||
e "We can pan the music back and forth."
|
||||
|
||||
$ renpy.music.set_pan(0, .5)
|
||||
|
||||
e "Voice support is included as part of Ren'Py, although we don't yet have a demonstration."
|
||||
|
||||
$ renpy.music.set_volume(0, .5)
|
||||
|
||||
e "Finally, we support playing movie files."
|
||||
|
||||
show movie behind eileen
|
||||
play movie "shuttle.ogv"
|
||||
|
||||
e "We can put a movie on the screen with text and other images."
|
||||
|
||||
stop movie
|
||||
hide movie
|
||||
|
||||
e "We can also play the movie in fullscreen... but with this tiny movie we're using as an example, it's going to look bad."
|
||||
|
||||
$ renpy.movie_cutscene("shuttle.ogv", stop_music=False)
|
||||
|
||||
$ renpy.music.set_volume(1, 1.0)
|
||||
|
||||
e "That's about it for multimedia."
|
||||
|
||||
return
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 95 KiB |
Binary file not shown.
@@ -1,58 +0,0 @@
|
||||
# This file contains the script for the Ren'Py demo game. Execution starts at
|
||||
# the start label.
|
||||
#
|
||||
# Declarations of characters and images used throughout the game can be found
|
||||
# in demo_basics.rpy. Options can be set in options.rpy.
|
||||
|
||||
# The game starts here.
|
||||
label start:
|
||||
|
||||
scene bg washington
|
||||
show eileen vhappy
|
||||
with dissolve
|
||||
|
||||
# Start the background music playing.
|
||||
play music "mozart.ogg"
|
||||
|
||||
window show
|
||||
|
||||
e "Hi, and welcome to the Ren'Py demo game."
|
||||
|
||||
show eileen happy
|
||||
|
||||
e "My name is Eileen, and I'm here to demonstrate some of the features of the Ren'Py visual novel engine."
|
||||
|
||||
# Show the editor button, which is defined in editor.rpy.
|
||||
$ show_editor_button = True
|
||||
|
||||
e "See that button in the upper-right corner of the screen?"
|
||||
|
||||
e "It shows where we are in the script. You can click it, and we'll try to open the file in a text editor."
|
||||
|
||||
e "It's an easy way to see how you can use the features I'm showing off."
|
||||
|
||||
e "We'll only show it for code that's intended to be easy to understand."
|
||||
|
||||
call demos from _call_demos_1
|
||||
|
||||
e "Thank you for viewing the Ren'Py demo."
|
||||
|
||||
e "If you'd like to see a full Ren'Py game, go to the launcher and choose \"Select Project\", then \"the_question\"."
|
||||
|
||||
e "You can download new versions of Ren'Py from http://www.renpy.org/. For help and discussion, check out the Lemma Soft Forums, at http://lemmasoft.renai.us/."
|
||||
|
||||
e "We'd like to thank Piroshki for contributing character art... I've never looked better. We also thank Jake for the magic circle."
|
||||
|
||||
e "The background music was generated using a Musikalisches Würfelspiel attributed to Mozart... even though that's probably wrong."
|
||||
|
||||
show eileen vhappy
|
||||
|
||||
e "We look forward to seeing what you can make with this! Good luck!"
|
||||
|
||||
window hide
|
||||
|
||||
# Returning from the top level quits the game.
|
||||
return
|
||||
|
||||
|
||||
|
||||
+27
-14
@@ -121,7 +121,7 @@ def main():
|
||||
os.chmod("./renpy.app/Contents/MacOS/Ren'Py Launcher", 0755)
|
||||
|
||||
# Compile the various games
|
||||
for i in [ 'demo/game', 'launcher', 'template/game', 'the_question/game' ]:
|
||||
for i in [ 'tutorial/game', 'launcher', 'template/game', 'the_question/game' ]:
|
||||
os.system("./renpy.sh --compile --game " + i)
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ def main():
|
||||
files.extend(tree("common"))
|
||||
more_files.append("console.exe")
|
||||
files.extend(tree("launcher"))
|
||||
files.extend(tree("demo"))
|
||||
files.extend(tree("tutorial"))
|
||||
# files.extend(tree("dse"))
|
||||
files.extend(tree("the_question"))
|
||||
|
||||
@@ -172,13 +172,22 @@ def main():
|
||||
"subpixel.c",
|
||||
"winmixer.c",
|
||||
"winmixer.pyx",
|
||||
"_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')
|
||||
@@ -190,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()
|
||||
@@ -208,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")
|
||||
@@ -229,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)
|
||||
@@ -2,19 +2,16 @@
|
||||
<head>
|
||||
<title>README</title>
|
||||
<style>
|
||||
HTML {
|
||||
background: #eed;
|
||||
}
|
||||
|
||||
BODY {
|
||||
background: #fff;
|
||||
margin: 0px 10% 0px 10%;
|
||||
border-left: 1px solid #888;
|
||||
border-right: 1px solid #888;
|
||||
padding-left: 4em;
|
||||
color: #444;
|
||||
padding-left: 20%;
|
||||
padding-top: 1em;
|
||||
padding-bottom: 1em;
|
||||
padding-right: 1em;
|
||||
padding-right: 20%;
|
||||
font-family: sans-serif;
|
||||
line-height: 1.6em;
|
||||
}
|
||||
|
||||
DT {
|
||||
@@ -22,92 +19,110 @@ font-weight: bold;
|
||||
margin-top: .33em;
|
||||
}
|
||||
|
||||
H3 {
|
||||
color: #600;
|
||||
H2 {
|
||||
color: #000;
|
||||
margin-left: -2.5em;
|
||||
}
|
||||
|
||||
H3 {
|
||||
color: #000;
|
||||
margin-left: -1.5em;
|
||||
}
|
||||
|
||||
.editsection {
|
||||
display: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="renpy_help"></div>
|
||||
<p><a name="Basic_Help" id="Basic_Help"></a></p>
|
||||
<h2><span class="mw-headline">Basic Help</span></h2>
|
||||
<p>To advance through the game, <tt>left-click</tt> or press the <tt>space</tt> or <tt>enter</tt> keys. When at a menu, <tt>left-click</tt> to make a choice, or use the arrow keys to select a choice and <tt>enter</tt> to activate it.</p>
|
||||
<p><a name="Game_Menu" id="Game_Menu"></a></p>
|
||||
<h3><span class="mw-headline">Game Menu</span></h3>
|
||||
<p>When playing a game, <tt>right-click</tt> or press the <tt>escape</tt> key to enter the game menu. The game menu gives the following choices:</p>
|
||||
<dl>
|
||||
<dt>Return</dt>
|
||||
<dd>Returns to the game.</dd>
|
||||
<dt>Save Game</dt>
|
||||
<dd>Allows you to save a game by clicking on a save slot.</dd>
|
||||
<dt>Load Game</dt>
|
||||
<dd>Allows you to load a game by clicking on a save slot. Clicking on "Auto" accesses the automatic save slots.</dd>
|
||||
<dt>Preferences</dt>
|
||||
|
||||
|
||||
|
||||
|
||||
<p><a name="Basic_Help" id="Basic_Help"></a></p>
|
||||
<h2><span class="editsection">[<a href="/w/index.php?title=renpy/Help&action=edit&section=1" title="Edit section: Basic Help">edit</a>]</span> <span class="mw-headline">Basic Help</span></h2>
|
||||
<p>To advance through the game, <tt>left-click</tt> or press the <tt>space</tt> or <tt>enter</tt> keys. When at a menu, <tt>left-click</tt> to make a choice, or use the arrow keys to select a choice and <tt>enter</tt> to activate it.</p>
|
||||
<p><a name="Game_Menu" id="Game_Menu"></a></p>
|
||||
<h3><span class="editsection">[<a href="/w/index.php?title=renpy/Help&action=edit&section=2" title="Edit section: Game Menu">edit</a>]</span> <span class="mw-headline">Game Menu</span></h3>
|
||||
<p>When playing a game, <tt>right-click</tt> or press the <tt>escape</tt> key to enter the game menu. The game menu gives the following choices:</p>
|
||||
<dl>
|
||||
<dt>Return</dt>
|
||||
<dd>Returns to the game.</dd>
|
||||
<dt>Save Game</dt>
|
||||
<dd>Allows you to save a game by clicking on a save slot.</dd>
|
||||
<dt>Load Game</dt>
|
||||
<dd>Allows you to load a game by clicking on a save slot. Clicking on "Auto" accesses the automatic save slots.</dd>
|
||||
<dt>Preferences</dt>
|
||||
<dd>Changes the game preferences (options/configuration):
|
||||
<dl>
|
||||
<dt>Display</dt>
|
||||
<dd>Switches between fullscreen and windowed mode.</dd>
|
||||
<dt>Transitions</dt>
|
||||
<dd>Controls the display of transitions between game screens.</dd>
|
||||
<dt>Text Speed</dt>
|
||||
<dd>Controls the rate at which text displays. The further to the right this slider is, the faster the text will display. All the way to the right causes text to be shown instantly.</dd>
|
||||
<dt>Joystick</dt>
|
||||
<dd>Lets you control the game using a joystick.</dd>
|
||||
<dt>Skip</dt>
|
||||
<dd>Chooses between skipping messages that have been already seen (in any play through the game), and skipping all messages.</dd>
|
||||
<dt>Begin Skipping</dt>
|
||||
<dd>Returns to the game, while skipping.</dd>
|
||||
<dt>After Choices</dt>
|
||||
<dd>Controls if skipping stops upon reaching a menu.</dd>
|
||||
<dt>Auto-Forward Time</dt>
|
||||
<dd>Controls automatic advance. The further to the left this slider is, the shorter the amount of time before the game advances. All the way to the right means text will never auto-forward.</dd>
|
||||
<dt>Music, Sound, and Voice Volume</dt>
|
||||
<dd>Controls the volume of the Music, Sound effect, and Voice channels, respectively. The further to the right these are, the louder the volume.</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>Main Menu</dt>
|
||||
<dd>Returns to the main menu, ending the current game.</dd>
|
||||
<dt>Help</dt>
|
||||
<dd>Shows this help screen.</dd>
|
||||
<dt>Quit</dt>
|
||||
<dd>Exits the game; the game will be closed and ended.</dd>
|
||||
</dl>
|
||||
<p><a name="Key_and_Mouse_Bindings" id="Key_and_Mouse_Bindings"></a></p>
|
||||
<h3><span class="mw-headline">Key and Mouse Bindings</span></h3>
|
||||
<dl>
|
||||
<dt>Left-click, Enter</dt>
|
||||
<dd>Advances through the game, activates menu choices, buttons, and sliders.</dd>
|
||||
<dt>Space</dt>
|
||||
<dd>Advances through the game, but does not activate choices.</dd>
|
||||
<dt>Arrow Keys</dt>
|
||||
<dd>Selects menu choices, buttons, and sliders.</dd>
|
||||
<dt>Ctrl</dt>
|
||||
<dd>Causes skipping to occur while the ctrl key is held down.</dd>
|
||||
<dt>Tab</dt>
|
||||
<dd>Toggles skipping, causing it to occur until tab is pressed again.</dd>
|
||||
<dt>Mousewheel-Up, PageUp</dt>
|
||||
<dd>Causes rollback to occur. Rollback reverses the game back in time, showing prior text and even allowing menu choices to be changed.</dd>
|
||||
<dt>Mousewheel-Down, PageDown</dt>
|
||||
<dd>Causes rollforward to occur, cancelling out a previous rollback.</dd>
|
||||
<dt>Right-click, Escape</dt>
|
||||
<dd>Enters the game menu. When in the game menu, returns to the game.</dd>
|
||||
<dt>Middle-click, H</dt>
|
||||
<dd>Hides the text window and other transient displays.</dd>
|
||||
<dt>F</dt>
|
||||
<dd>Toggles fullscreen mode</dd>
|
||||
<dt>S</dt>
|
||||
<dd>Takes a screenshot, saving it in a file named screenshotxxxx.png, where xxxx is a serial number.</dd>
|
||||
<dt>Alt-H, Command-H</dt>
|
||||
<dd>Hides (iconifies) the window.</dd>
|
||||
<dt>Alt-F4, Command-Q</dt>
|
||||
<dd>Quits the game.</dd>
|
||||
</dl>
|
||||
<p><a name="Legal_Notice" id="Legal_Notice"></a></p>
|
||||
<h2><span class="mw-headline">Legal Notice</span></h2>
|
||||
<p>This game uses source code from a number of open source projects. For a list, and a location where the source code can be downloaded from, please view the <a href="./renpy/LICENSE.txt">LICENSE.txt</a> file in the renpy directory.</p>
|
||||
<dl>
|
||||
<dt>Display</dt>
|
||||
<dd>Switches between fullscreen and windowed mode.</dd>
|
||||
<dt>Transitions</dt>
|
||||
<dd>Controls the display of transitions between game screens.</dd>
|
||||
<dt>Text Speed</dt>
|
||||
<dd>Controls the rate at which text displays. The further to the right this slider is, the faster the text will display. All the way to the right causes text to be shown instantly.</dd>
|
||||
<dt>Joystick</dt>
|
||||
<dd>Lets you control the game using a joystick.</dd>
|
||||
<dt>Skip</dt>
|
||||
<dd>Chooses between skipping messages that have been already seen (in any play through the game), and skipping all messages.</dd>
|
||||
<dt>Begin Skipping</dt>
|
||||
<dd>Returns to the game, while skipping.</dd>
|
||||
<dt>After Choices</dt>
|
||||
<dd>Controls if skipping stops upon reaching a menu.</dd>
|
||||
<dt>Auto-Forward Time</dt>
|
||||
<dd>Controls automatic advance. The further to the left this slider is, the shorter the amount of time before the game advances. All the way to the right means text will never auto-forward.</dd>
|
||||
<dt>Music, Sound, and Voice Volume</dt>
|
||||
<dd>Controls the volume of the Music, Sound effect, and Voice channels, respectively. The further to the right these are, the louder the volume.</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>Main Menu</dt>
|
||||
<dd>Returns to the main menu, ending the current game.</dd>
|
||||
<dt>Help</dt>
|
||||
<dd>Shows this help screen.</dd>
|
||||
<dt>Quit</dt>
|
||||
<dd>Exits the game; the game will be closed and ended.</dd>
|
||||
</dl>
|
||||
<p><a name="Key_and_Mouse_Bindings" id="Key_and_Mouse_Bindings"></a></p>
|
||||
<h3><span class="editsection">[<a href="/w/index.php?title=renpy/Help&action=edit&section=3" title="Edit section: Key and Mouse Bindings">edit</a>]</span> <span class="mw-headline">Key and Mouse Bindings</span></h3>
|
||||
<dl>
|
||||
<dt>Left-click, Enter</dt>
|
||||
<dd>Advances through the game, activates menu choices, buttons, and sliders.</dd>
|
||||
<dt>Space</dt>
|
||||
<dd>Advances through the game, but does not activate choices.</dd>
|
||||
<dt>Arrow Keys</dt>
|
||||
<dd>Selects menu choices, buttons, and sliders.</dd>
|
||||
<dt>Ctrl</dt>
|
||||
<dd>Causes skipping to occur while the ctrl key is held down.</dd>
|
||||
<dt>Tab</dt>
|
||||
<dd>Toggles skipping, causing it to occur until tab is pressed again.</dd>
|
||||
<dt>Mousewheel-Up, PageUp</dt>
|
||||
<dd>Causes rollback to occur. Rollback reverses the game back in time, showing prior text and even allowing menu choices to be changed.</dd>
|
||||
<dt>Mousewheel-Down, PageDown</dt>
|
||||
<dd>Causes rollforward to occur, cancelling out a previous rollback.</dd>
|
||||
<dt>Right-click, Escape</dt>
|
||||
<dd>Enters the game menu. When in the game menu, returns to the game.</dd>
|
||||
<dt>Middle-click, H</dt>
|
||||
<dd>Hides the text window and other transient displays.</dd>
|
||||
<dt>F</dt>
|
||||
<dd>Toggles fullscreen mode</dd>
|
||||
<dt>S</dt>
|
||||
<dd>Takes a screenshot, saving it in a file named screenshotxxxx.png, where xxxx is a serial number.</dd>
|
||||
<dt>Alt-H, Command-H</dt>
|
||||
<dd>Hides (iconifies) the window.</dd>
|
||||
<dt>Alt-F4, Command-Q</dt>
|
||||
<dd>Quits the game.</dd>
|
||||
<dt>Delete</dt>
|
||||
<dd>When a save slot is selected, deletes that save slot.</dd>
|
||||
</dl>
|
||||
<p><a name="Legal_Notice" id="Legal_Notice"></a></p>
|
||||
<h2><span class="editsection">[<a href="/w/index.php?title=renpy/Help&action=edit&section=4" title="Edit section: Legal Notice">edit</a>]</span> <span class="mw-headline">Legal Notice</span></h2>
|
||||
<p>This game uses source code from a number of open source projects. For a list, and a location where the source code can be downloaded from, please view the LICENSE.txt file in the renpy directory, or visit <a href="http://www.renpy.org/wiki/renpy/License" class="external free" title="http://www.renpy.org/wiki/renpy/License" rel="nofollow">http://www.renpy.org/wiki/renpy/License</a> .</p>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
init -1 python:
|
||||
style_backup = renpy.style.backup()
|
||||
|
||||
init python:
|
||||
|
||||
import codecs
|
||||
|
||||
@@ -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
-378
@@ -1,231 +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) ]
|
||||
|
||||
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
|
||||
@@ -365,166 +155,18 @@ label distribute:
|
||||
|
||||
project.save()
|
||||
|
||||
# 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 + "/"
|
||||
|
||||
# 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."))
|
||||
|
||||
@@ -532,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)
|
||||
|
||||
@@ -541,4 +183,3 @@ label distribute:
|
||||
ui.close()
|
||||
interact()
|
||||
|
||||
|
||||
|
||||
+10
-2
@@ -26,7 +26,12 @@ init python:
|
||||
# Should we set up the editor? How about the transient editor?
|
||||
set_editor = "RENPY_EDITOR" not in os.environ
|
||||
set_editor_transient = "RENPY_EDITOR_TRANSIENT" not in os.environ
|
||||
|
||||
|
||||
if set_editor and not set_editor_transient:
|
||||
config.editor_transient = config.editor
|
||||
os.environ['RENPY_EDITOR_TRANSIENT'] = config.editor
|
||||
set_editor_transient = False
|
||||
|
||||
def scan_editor(ef):
|
||||
"""
|
||||
Scans a single editor file to get the meta-information. If it
|
||||
@@ -84,6 +89,9 @@ init python:
|
||||
Sets the system up to respect the value containined in
|
||||
persistent.editor.
|
||||
"""
|
||||
|
||||
if not set_editor:
|
||||
return
|
||||
|
||||
ef = None
|
||||
|
||||
@@ -100,7 +108,7 @@ init python:
|
||||
"persistent" : persistent,
|
||||
"base" : os.path.dirname(ef),
|
||||
}
|
||||
|
||||
|
||||
execfile(ef, ctx, ctx)
|
||||
|
||||
if set_editor:
|
||||
|
||||
+49
-19
@@ -1,12 +1,50 @@
|
||||
# This file contains the various components of the launcher interface.
|
||||
|
||||
init python:
|
||||
init -11 python:
|
||||
style.launcher_base = Style(style.default)
|
||||
|
||||
style.launcher_text = Style(style.launcher_base)
|
||||
style.launcher_text.size = 15
|
||||
style.launcher_text.color = "#333"
|
||||
style.launcher_text.justify = True
|
||||
|
||||
style.launcher_title = Style(style.launcher_base)
|
||||
style.launcher_title.size = 26
|
||||
style.launcher_title.color = "#333"
|
||||
|
||||
style.launcher_button_text = Style(style.launcher_base)
|
||||
style.launcher_button_text.size = 20
|
||||
style.launcher_button_text.color = "#03c"
|
||||
style.launcher_button_text.hover_color = "#088"
|
||||
style.launcher_button_text.insensitive_color = "#aaa"
|
||||
style.launcher_button_text.minwidth = 250
|
||||
|
||||
style.launcher_small_button_text = Style(style.launcher_button_text)
|
||||
style.launcher_small_button_text.size = 15
|
||||
|
||||
style.launcher_tooltip = Style(style.default)
|
||||
style.launcher_tooltip.color = "#fff"
|
||||
style.launcher_tooltip.size = 14
|
||||
|
||||
|
||||
init 11 python hide:
|
||||
|
||||
props = { }
|
||||
for i in style.default.properties:
|
||||
props.update(i)
|
||||
|
||||
if props["font"] == "DejaVuSans.ttf":
|
||||
style.launcher_base.setdefault(font="DejaVuSerif.ttf")
|
||||
|
||||
init 11 python:
|
||||
|
||||
import time
|
||||
|
||||
|
||||
# Settings.
|
||||
config.developer = True
|
||||
|
||||
# Make backup of styles.
|
||||
style_backup = renpy.style.backup()
|
||||
|
||||
# Style customizations. These need to be in a function so that we can
|
||||
# change them when we're choosing a theme.
|
||||
@@ -18,9 +56,7 @@ init python:
|
||||
style.hyperlink_text.hover_color = "#00c"
|
||||
style.hyperlink_text.size = 15
|
||||
style.hyperlink_text.underline = False
|
||||
style.hyperlink_text.font = "DejaVuSerif.ttf"
|
||||
|
||||
|
||||
|
||||
customize_styles()
|
||||
|
||||
tooltip = _(u"Welcome!")
|
||||
@@ -75,16 +111,16 @@ init python:
|
||||
"""
|
||||
|
||||
ui.window(style="default", bottom_margin=4, top_margin=12)
|
||||
ui.text(s, size=26, color="#333", font="DejaVuSerif.ttf")
|
||||
ui.text(s, style="launcher_title")
|
||||
|
||||
def text(s):
|
||||
"""
|
||||
Display text on the screen.
|
||||
"""
|
||||
|
||||
ui.text(s, size=15, color="#333", font="DejaVuSerif.ttf", justify=True)
|
||||
ui.text(s, style="launcher_text")
|
||||
|
||||
def button(s, clicked=None, subtitle="", hovered=None, unhovered=None, size=20):
|
||||
def button(s, clicked=None, subtitle="", hovered=None, unhovered=None):
|
||||
"""
|
||||
Displays a button with caption `s`.
|
||||
"""
|
||||
@@ -100,9 +136,7 @@ init python:
|
||||
hovered=hovered, unhovered=unhovered,
|
||||
top_padding=3, bottom_padding=3)
|
||||
|
||||
ui.text(s, style="default", size=size,
|
||||
color="#03c", hover_color="00c", insensitive_color="#aaa",
|
||||
font="DejaVuSerif.ttf", minwidth=250)
|
||||
ui.text(s, style="launcher_button_text")
|
||||
|
||||
def small_button(s, clicked=None, subtitle="", hovered=None, unhovered=None):
|
||||
"""
|
||||
@@ -119,9 +153,7 @@ init python:
|
||||
hovered=hovered, unhovered=unhovered,
|
||||
top_padding=0, bottom_padding=0)
|
||||
|
||||
ui.text(s, style="default", size=15,
|
||||
color="#03c", hover_color="00c", insensitive_color="#aaa",
|
||||
font="DejaVuSerif.ttf", minwidth=250)
|
||||
ui.text(s, style="launcher_small_button_text")
|
||||
|
||||
def toggle_button(s, checked, clicked=None, subtitle=""):
|
||||
"""
|
||||
@@ -132,17 +164,15 @@ init python:
|
||||
unhovered = untooltips(subtitle)
|
||||
|
||||
if checked:
|
||||
s = u"\u25a3 " + s
|
||||
s = u"{font=DejaVuSans.ttf}\u25a3{/font} " + s
|
||||
else:
|
||||
s = u"\u25a1 " + s
|
||||
s = u"{font=DejaVuSans.ttf}\u25a1{/font} " + s
|
||||
|
||||
ui.button(style="default", clicked=clicked,
|
||||
hovered=hovered, unhovered=unhovered,
|
||||
top_padding=0, bottom_padding=0)
|
||||
|
||||
ui.text(s, style="default", size=15,
|
||||
color="#03c", hover_color="00c", insensitive_color="#aaa",
|
||||
font="DejaVuSerif.ttf", minwidth=250)
|
||||
ui.text(s, style="launcher_small_button_text")
|
||||
|
||||
def scrolled(cancel, yadj=None):
|
||||
|
||||
|
||||
+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"
|
||||
|
||||
|
||||
+4
-1
@@ -9,8 +9,11 @@ label options:
|
||||
|
||||
title(_(u"Launcher Options"))
|
||||
|
||||
editor = persistent.editor
|
||||
if not set_editor:
|
||||
editor = _(u"Using RENPY_EDITOR")
|
||||
|
||||
text_variable(_("Text Editor"), persistent.editor, "editor",
|
||||
text_variable(_("Text Editor"), editor, "editor",
|
||||
_(u"Change the default text editor."))
|
||||
|
||||
ui.null(height=15)
|
||||
|
||||
+3872
-302
File diff suppressed because it is too large
Load Diff
+25
-4
@@ -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"
|
||||
|
||||
@@ -110,7 +115,7 @@ init python:
|
||||
|
||||
project_dirs = [ config.renpy_base ]
|
||||
|
||||
if persistent.projects_directory:
|
||||
if persistent.projects_directory and persistent.projects_directory not in project_dirs:
|
||||
project_dirs.append(persistent.projects_directory)
|
||||
|
||||
for d in project_dirs:
|
||||
@@ -148,7 +153,7 @@ init python:
|
||||
return
|
||||
|
||||
for i in projects:
|
||||
if i.name == "demo":
|
||||
if i.name == "tutorial":
|
||||
i.select()
|
||||
return
|
||||
|
||||
@@ -193,6 +198,21 @@ label select_project:
|
||||
|
||||
interact()
|
||||
|
||||
label launch_tutorial:
|
||||
|
||||
|
||||
python hide:
|
||||
|
||||
if sys.platform == "win32" and sys.argv[0].lower().endswith(".exe"):
|
||||
proc = subprocess.Popen([sys.argv[0], tutorial_path])
|
||||
else:
|
||||
proc = subprocess.Popen([sys.executable, sys.argv[0], tutorial_path])
|
||||
|
||||
set_tooltip(_(u"Tutorial game has been launched."))
|
||||
|
||||
jump top
|
||||
|
||||
|
||||
label launch:
|
||||
|
||||
python hide:
|
||||
@@ -205,7 +225,7 @@ label launch:
|
||||
set_tooltip(_(u"%s has been launched.") % project.name.capitalize())
|
||||
|
||||
store.game_proc = proc
|
||||
|
||||
|
||||
jump top
|
||||
|
||||
|
||||
@@ -269,7 +289,8 @@ label lint:
|
||||
lf = file("lint.txt", "w+")
|
||||
|
||||
if hasattr(sys, "winver") and sys.argv[0].lower().endswith(".exe"):
|
||||
proc = subprocess.Popen([config.renpy_base + "/console.exe", "--lint", project.path], stdin=lf, stdout=lf, stderr=lf)
|
||||
CREATE_NO_WINDOW=0x08000000
|
||||
proc = subprocess.Popen([config.renpy_base + "/console.exe", "--lint", project.path], stdin=lf, stdout=lf, stderr=lf, creationflags=CREATE_NO_WINDOW)
|
||||
else:
|
||||
proc = subprocess.Popen([sys.executable, sys.argv[0], "--lint", project.path], stdout=lf)
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
init python:
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
|
||||
try:
|
||||
import EasyDialogs
|
||||
except ImportError:
|
||||
@@ -25,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:
|
||||
|
||||
@@ -37,8 +39,12 @@ label choose_projects_directory:
|
||||
|
||||
try:
|
||||
|
||||
env = os.environ.copy()
|
||||
if 'RENPY_OLD_LD_LIBRARY_PATH' in env:
|
||||
env['LD_LIBRARY_PATH'] = env['RENPY_OLD_LD_LIBRARY_PATH']
|
||||
|
||||
zen = subprocess.Popen([ "zenity", "--title=Select Projects Directory", "--file-selection", "--directory", "--filename=" + path ],
|
||||
stdout=subprocess.PIPE)
|
||||
env=env, stdout=subprocess.PIPE)
|
||||
|
||||
choice = zen.stdout.read()
|
||||
zen.wait()
|
||||
|
||||
+30
-2
@@ -1,3 +1,7 @@
|
||||
init python:
|
||||
tutorial_path = config.renpy_base + "/tutorial"
|
||||
tutorial_exists = os.path.isdir(tutorial_path)
|
||||
|
||||
label main_menu:
|
||||
return
|
||||
|
||||
@@ -64,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"),
|
||||
@@ -74,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"),
|
||||
@@ -86,7 +94,18 @@ label top:
|
||||
ui.jumps("documentation"),
|
||||
_(u"Open the Ren'Py documentation in a web browser."))
|
||||
|
||||
if tutorial_exists:
|
||||
|
||||
button(_(u"Tutorial Game"),
|
||||
ui.jumps("launch_tutorial"),
|
||||
_(u"Launches the Ren'Py tutorial game."))
|
||||
|
||||
else:
|
||||
|
||||
ui.null()
|
||||
|
||||
ui.null()
|
||||
|
||||
|
||||
ui.close()
|
||||
ui.close()
|
||||
@@ -107,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, 9, 3)
|
||||
$ config.script_version = (6, 11, 0)
|
||||
|
||||
|
||||
+191
-174
@@ -3,190 +3,207 @@ init python:
|
||||
|
||||
TRANSLATION_STRINGS = [
|
||||
|
||||
u'Developer Menu',
|
||||
u'Return to the developer menu',
|
||||
u'Skip Mode',
|
||||
u'Fast Skip Mode',
|
||||
u'Please click to continue.',
|
||||
u'Start Game',
|
||||
u'Load Game',
|
||||
u'Preferences',
|
||||
u'Help',
|
||||
u'Quit',
|
||||
u'Return',
|
||||
u'Save Game',
|
||||
u'Main Menu',
|
||||
u'Are you sure you want to quit?',
|
||||
u'Are you sure you want to return to the main menu?\\nThis will lose unsaved progress.',
|
||||
u'Begin Skipping',
|
||||
u'Empty Slot.',
|
||||
u'Previous',
|
||||
u'Next',
|
||||
u'Yes',
|
||||
u'No',
|
||||
u'Loading will lose unsaved progress.\\nAre you sure you want to do this?',
|
||||
u'Are you sure you want to overwrite your save?',
|
||||
u'The error message was:',
|
||||
u'You may want to try saving in a different slot, or playing for a while and trying again later.',
|
||||
u'Save Failed.',
|
||||
u'Continue Game',
|
||||
u'Test',
|
||||
u'Left',
|
||||
u'Right',
|
||||
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'Toggle Skip',
|
||||
u'Hide Text',
|
||||
u'Menu',
|
||||
u'Display',
|
||||
u'Window',
|
||||
u'Fullscreen',
|
||||
u'Transitions',
|
||||
u'All',
|
||||
u'Some',
|
||||
u'None',
|
||||
u'Skip',
|
||||
u'Seen Messages',
|
||||
u'All Messages',
|
||||
u'After Choices',
|
||||
u'Stop Skipping',
|
||||
u'Keep Skipping',
|
||||
u'Text Speed',
|
||||
u'Auto-Forward Time',
|
||||
u'Music Volume',
|
||||
u'Sound Volume',
|
||||
u'Joystick...',
|
||||
u'Joystick Configuration',
|
||||
u'Voice Volume',
|
||||
u'Auto',
|
||||
u'Quick',
|
||||
u'The patterns did not match any files, so no archive was created.',
|
||||
u'Archiving Files...',
|
||||
u'Success',
|
||||
u'The files have been added to the archive, and moved into the \\"archived\\" directory. Future runs of the archiver will archive files in both the \\"game\\" and \\"archived\\" directories.',
|
||||
u'Archiver',
|
||||
u'The archiver allows you to obfuscate your game by including files in an archive file.',
|
||||
u'Archive Name:',
|
||||
u'The name of the archive to create.',
|
||||
u'Include Patterns:',
|
||||
u'Files matching these patterns are included in the archive.',
|
||||
u'Exclude Patterns:',
|
||||
u'Files matching these patterns are excluded from the archive.',
|
||||
u'Archive',
|
||||
u'Build the archive.',
|
||||
u'Cancel',
|
||||
u'Archive Name',
|
||||
u'The name of the archive file to create, without the .rpa extension.\\n\\nThe \\"data\\" archive is loaded automatically. Other archives must be added to config.archives.',
|
||||
u'Include Patterns',
|
||||
u'This is a space-separated list of file patterns. Files matching these patterns are added to the archive.\\n\\nAsterisks (*) can be used as a wildcard.',
|
||||
u'This is a space-separated list of file patterns. Files matching these patterns are excluded from the archive. If a file is matched by both an exclude and include pattern, the exclude takes precedence.\\n\\nAsterisks (*) can be used as a wildcard.',
|
||||
u'Scanning Files...',
|
||||
u'Could not modify options.rpy. Perhaps it was changed too much.',
|
||||
u'Theme changed to %s.',
|
||||
u'Planetarium',
|
||||
u'The options.rpy file does not exist in the game directory, so this launcher cannot change the theme.',
|
||||
u"Are you sure?",
|
||||
u"Are you sure you want to delete this save?",
|
||||
u"Are you sure you want to overwrite your save?",
|
||||
u"Loading will lose unsaved progress.\nAre you sure you want to do this?",
|
||||
u"Are you sure you want to quit?",
|
||||
u"Are you sure you want to return to the main menu?\nThis will lose unsaved progress.",
|
||||
u"Skip Mode",
|
||||
u"Fast Skip Mode",
|
||||
u"Please click to continue.",
|
||||
u"Start Game",
|
||||
u"Load Game",
|
||||
u"Preferences",
|
||||
u"Help",
|
||||
u"Quit",
|
||||
u"Return",
|
||||
u"Save Game",
|
||||
u"Main Menu",
|
||||
u"Begin Skipping",
|
||||
u"Empty Slot.",
|
||||
u"Previous",
|
||||
u"Next",
|
||||
u"Yes",
|
||||
u"No",
|
||||
u"The error message was:",
|
||||
u"You may want to try saving in a different slot, or playing for a while and trying again later.",
|
||||
u"Save Failed.",
|
||||
u"Continue Game",
|
||||
u"Test",
|
||||
u"Left",
|
||||
u"Right",
|
||||
u"Not Assigned",
|
||||
u"Up",
|
||||
u"Down",
|
||||
u"Select/Dismiss",
|
||||
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",
|
||||
u"Display",
|
||||
u"Window",
|
||||
u"Fullscreen",
|
||||
u"Transitions",
|
||||
u"All",
|
||||
u"Some",
|
||||
u"None",
|
||||
u"Skip",
|
||||
u"Seen Messages",
|
||||
u"All Messages",
|
||||
u"After Choices",
|
||||
u"Stop Skipping",
|
||||
u"Keep Skipping",
|
||||
u"Text Speed",
|
||||
u"Auto-Forward Time",
|
||||
u"Music Volume",
|
||||
u"Sound Volume",
|
||||
u"Joystick...",
|
||||
u"Joystick Configuration",
|
||||
u"Voice Volume",
|
||||
u"Developer Menu",
|
||||
u"Return to the developer menu",
|
||||
u"Reload Game (Shift+R)",
|
||||
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.",
|
||||
u"Archiving Files...",
|
||||
u"Success",
|
||||
u"The files have been added to the archive, and moved into the \"archived\" directory. Future runs of the archiver will archive files in both the \"game\" and \"archived\" directories.",
|
||||
u"Archiver",
|
||||
u"The archiver allows you to obfuscate your game by including files in an archive file.",
|
||||
u"Archive Name:",
|
||||
u"The name of the archive to create.",
|
||||
u"Include Patterns:",
|
||||
u"Files matching these patterns are included in the archive.",
|
||||
u"Exclude Patterns:",
|
||||
u"Files matching these patterns are excluded from the archive.",
|
||||
u"Archive",
|
||||
u"Build the archive.",
|
||||
u"Cancel",
|
||||
u"Archive Name",
|
||||
u"The name of the archive file to create, without the .rpa extension.\n\nThe \"data\" archive is loaded automatically. Other archives must be added to config.archives.",
|
||||
u"Include Patterns",
|
||||
u"This is a space-separated list of file patterns. Files matching these patterns are added to the archive.\n\nAsterisks (*) can be used as a wildcard.",
|
||||
u"This is a space-separated list of file patterns. Files matching these patterns are excluded from the archive. If a file is matched by both an exclude and include pattern, the exclude takes precedence.\n\nAsterisks (*) can be used as a wildcard.",
|
||||
u"Scanning Files...",
|
||||
u"Could not modify options.rpy. Perhaps it was changed too much.",
|
||||
u"Theme changed to %s.",
|
||||
u"Planetarium",
|
||||
u"The options.rpy file does not exist in the game directory, so this launcher cannot change the theme.",
|
||||
u"Themes control the basic look of interface elements. You'll be able to pick a color scheme next.",
|
||||
u'Choose Theme',
|
||||
u'Please choose a color scheme for your project.',
|
||||
u'Choose Color Scheme',
|
||||
u'Building Distributions',
|
||||
u'Base Name:',
|
||||
u'Used to generate the names of directories and archive files.',
|
||||
u'Executable Name:',
|
||||
u'Used to generate the names of executables and runnable programs.',
|
||||
u'Ignore Extensions:',
|
||||
u'Files with these extensions will not be included in the distributions.',
|
||||
u'Documentation Extensions:',
|
||||
u'Files with these extensions will be treated as documentation, when building the Macintosh application.',
|
||||
u'Distributions to Build:',
|
||||
u'Windows x86',
|
||||
u'Zip distribution for the 32-bit Windows platform.',
|
||||
u'Linux x86',
|
||||
u'Tar.Bz2 distribution for the Linux x86 platform.',
|
||||
u'Macintosh Universal',
|
||||
u'Single application distribution for the Macintosh x86 and ppc platforms.',
|
||||
u'Windows/Linux/Mac Combined',
|
||||
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"Choose Theme",
|
||||
u"Please choose a color scheme for your project.",
|
||||
u"Choose Color Scheme",
|
||||
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:",
|
||||
u"Used to generate the names of directories and archive files.",
|
||||
u"Executable Name:",
|
||||
u"Used to generate the names of executables and runnable programs.",
|
||||
u"Ignore Extensions:",
|
||||
u"Files with these extensions will not be included in the distributions.",
|
||||
u"Documentation Extensions:",
|
||||
u"Files with these extensions will be treated as documentation, when building the Macintosh application.",
|
||||
u"Distributions to Build:",
|
||||
u"Windows x86",
|
||||
u"Zip distribution for the 32-bit Windows platform.",
|
||||
u"Linux x86",
|
||||
u"Tar.Bz2 distribution for the Linux x86 platform.",
|
||||
u"Macintosh Universal",
|
||||
u"Single application distribution for the Macintosh x86 and ppc platforms.",
|
||||
u"Windows/Linux/Mac Combined",
|
||||
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"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}.",
|
||||
u'Error',
|
||||
u'Press enter when done.',
|
||||
u'Welcome!',
|
||||
u'The string cannot be empty. Please enter some text.',
|
||||
u'Non-ASCII filenames are not allowed. This is because Zip files cannot reliably represent non-ASCII filenames.',
|
||||
u'Processed %d of %d files.',
|
||||
u'New Project',
|
||||
u'Please type the name of your new project.',
|
||||
u'Something with that name already exists in the projects directory.',
|
||||
u'Creating Project',
|
||||
u'Please wait while we create the project.',
|
||||
u'%s Launcher',
|
||||
u'Launcher Options',
|
||||
u'Change the default text editor.',
|
||||
u'Projects Directory',
|
||||
u"Error",
|
||||
u"Press enter when done.",
|
||||
u"The string cannot be empty. Please enter some text.",
|
||||
u"Non-ASCII filenames are not allowed. This is because Zip files cannot reliably represent non-ASCII filenames.",
|
||||
u"Processed %d of %d files.",
|
||||
u"Welcome!",
|
||||
u"New Project",
|
||||
u"Please type the name of your new project.",
|
||||
u"Something with that name already exists in the projects directory.",
|
||||
u"Creating Project",
|
||||
u"Please wait while we create the project.",
|
||||
u"%s Launcher",
|
||||
u"Launcher Options",
|
||||
u"Using RENPY_EDITOR",
|
||||
u"Change the default text editor.",
|
||||
u"Projects Directory",
|
||||
u"Select the directory Ren'Py searches for projects.",
|
||||
u'Select Project',
|
||||
u'%s has been launched.',
|
||||
u'Opening game directory:\\n%s',
|
||||
u'No editor has been selected.',
|
||||
u'No files to edit.',
|
||||
u'Launching the editor failed.',
|
||||
u'Launched editor with %d script files.',
|
||||
u'Lint',
|
||||
u'Lint in progress.',
|
||||
u'Lint complete.',
|
||||
u'Deleting persistent data.',
|
||||
u'Delete Persistent',
|
||||
u'Persistent data has been deleted.',
|
||||
u'Choose Projects Directory',
|
||||
u'Please choose the directory containing your projects.',
|
||||
u"Select Project",
|
||||
u"Tutorial game has been launched.",
|
||||
u"%s has been launched.",
|
||||
u"Opening game directory:\n%s",
|
||||
u"No editor has been selected.",
|
||||
u"No files to edit.",
|
||||
u"Launching the editor failed.",
|
||||
u"Launched editor with %d script files.",
|
||||
u"Lint",
|
||||
u"Lint in progress.",
|
||||
u"Lint complete.",
|
||||
u"Deleting persistent data.",
|
||||
u"Delete Persistent",
|
||||
u"Persistent data has been deleted.",
|
||||
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'Launch',
|
||||
u'Launches the project.',
|
||||
u'Edit Script',
|
||||
u'Edits the script of the project.',
|
||||
u'Game Directory',
|
||||
u"Now showing the Ren'Py Games List in your web browser.",
|
||||
u"Launch",
|
||||
u"Launches the project.",
|
||||
u"Edit Script",
|
||||
u"Edits the script of the project.",
|
||||
u"Game Directory",
|
||||
u"Opens the project's game directory.",
|
||||
u'Check Script (Lint)',
|
||||
u'Checks the script of the project for likely errors.',
|
||||
u'Changes the theme used by the project.',
|
||||
u'Deletes the persistent data associated with the project.',
|
||||
u'Archive Files',
|
||||
u'Archives files found in the game and archived directories.',
|
||||
u'Build Distributions',
|
||||
u'Builds distributions of the project.',
|
||||
u"Check Script (Lint)",
|
||||
u"Checks the script of the project for likely errors.",
|
||||
u"Changes the theme used by the project.",
|
||||
u"Deletes the persistent data associated with the project.",
|
||||
u"Archive Files",
|
||||
u"Archives files found in the game and archived directories.",
|
||||
u"Build Distributions",
|
||||
u"Builds distributions of the project.",
|
||||
u"Ren'Py",
|
||||
u'Select a project to work with.',
|
||||
u'Create a new project.',
|
||||
u'Causes the launcher to exit.',
|
||||
u'Options',
|
||||
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",
|
||||
]
|
||||
|
||||
|
||||
+5742
File diff suppressed because it is too large
Load Diff
+9
-8
@@ -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)
|
||||
|
||||
@@ -94,9 +95,8 @@ import pygame
|
||||
|
||||
PygameSurface = pygame.Surface
|
||||
|
||||
# Update this in 00library.rpy as well!
|
||||
def version():
|
||||
return 6009000
|
||||
return (6, 10, 1)
|
||||
|
||||
def save_png(surf, file, compress=-1):
|
||||
|
||||
@@ -284,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.")
|
||||
@@ -310,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,
|
||||
@@ -332,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)
|
||||
@@ -344,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,387 @@
|
||||
# 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):
|
||||
|
||||
"""
|
||||
Creates a string containing the premultiplied image data for
|
||||
for the (x, y, w, h) box inside pysurf.
|
||||
"""
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
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
|
||||
|
||||
return rv
|
||||
|
||||
|
||||
def load_premultiplied(data, width, height, update):
|
||||
|
||||
cdef char *pixels
|
||||
|
||||
if data:
|
||||
pixels = data
|
||||
else:
|
||||
pixels = NULL
|
||||
|
||||
|
||||
if update:
|
||||
glTexSubImage2D(
|
||||
GL_TEXTURE_2D,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
width,
|
||||
height,
|
||||
GL_BGRA,
|
||||
GL_UNSIGNED_BYTE,
|
||||
pixels)
|
||||
|
||||
else:
|
||||
glTexImage2D(
|
||||
GL_TEXTURE_2D,
|
||||
0,
|
||||
GL_RGBA,
|
||||
width,
|
||||
height,
|
||||
0,
|
||||
GL_BGRA,
|
||||
GL_UNSIGNED_BYTE,
|
||||
pixels)
|
||||
|
||||
|
||||
def store_framebuffer(
|
||||
object pysurf,
|
||||
):
|
||||
|
||||
"""
|
||||
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,
|
||||
GL_BGRA,
|
||||
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
+1446
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
cdef extern from "fribidi/fribidi.h":
|
||||
int FRIBIDI_TYPE_LTR
|
||||
int FRIBIDI_TYPE_ON
|
||||
int FRIBIDI_TYPE_RTL
|
||||
int FRIBIDI_TYPE_WR
|
||||
int FRIBIDI_TYPE_WL
|
||||
|
||||
cdef extern object renpybidi_log2vis(object, int *)
|
||||
|
||||
WLTR = FRIBIDI_TYPE_WL
|
||||
LTR = FRIBIDI_TYPE_LTR
|
||||
ON = FRIBIDI_TYPE_ON
|
||||
RTL = FRIBIDI_TYPE_RTL
|
||||
WRTL = FRIBIDI_TYPE_WR
|
||||
|
||||
def log2vis(s, int direction=FRIBIDI_TYPE_ON):
|
||||
|
||||
s = s.encode("utf8")
|
||||
s = renpybidi_log2vis(s, &direction)
|
||||
return s.decode("utf8"), direction
|
||||
|
||||
+247
-142
@@ -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) {
|
||||
|
||||
@@ -960,15 +978,22 @@ void scale24_core(PyObject *pysrc, PyObject *pydst,
|
||||
}
|
||||
|
||||
#define I(a, b, mul) ((((((b - a) * mul)) >> 8) + a) & 0xff00ff)
|
||||
|
||||
|
||||
/** This appears to limit the expansion, such that 1/x yields a max
|
||||
expansion of lg x */
|
||||
#define EPSILON (1.0 / 256.0)
|
||||
|
||||
/****************************************************************************/
|
||||
/* A similar concept to rotozoom, but implemented differently, so we
|
||||
can limit the target area. */
|
||||
void transform32_std(PyObject *pysrc, PyObject *pydst,
|
||||
float corner_x, float corner_y,
|
||||
float xdx, float ydx,
|
||||
float xdy, float ydy,
|
||||
int ashift, float a) {
|
||||
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,
|
||||
int precise
|
||||
) {
|
||||
|
||||
SDL_Surface *src;
|
||||
SDL_Surface *dst;
|
||||
@@ -978,12 +1003,13 @@ void transform32_std(PyObject *pysrc, PyObject *pydst,
|
||||
int srcw, srch;
|
||||
int dstw, dsth;
|
||||
|
||||
// The x and y source pixel coordinates, times 65536. And their
|
||||
// delta-per-dest-x-pixel.
|
||||
int sxi = 0, syi = 0, dsxi = 0, dsyi = 0;
|
||||
|
||||
unsigned char *srcpixels;
|
||||
unsigned char *dstpixels;
|
||||
|
||||
float lsx, lsy; // The position of the current line in the source.
|
||||
float sx, sy; // The position of the current pixel in the source.
|
||||
|
||||
src = PySurface_AsSurface(pysrc);
|
||||
dst = PySurface_AsSurface(pydst);
|
||||
|
||||
@@ -998,81 +1024,113 @@ void transform32_std(PyObject *pysrc, PyObject *pydst,
|
||||
srch = src->h;
|
||||
dsth = dst->h;
|
||||
|
||||
unsigned int amul = (int) (a * 256);
|
||||
// Compute the coloring multiplier.
|
||||
unsigned int amul = (unsigned int) (a * 256);
|
||||
|
||||
// Compute the maximum x and y coordinates.
|
||||
double maxsx = srcw - 1;
|
||||
double maxsy = srch - 1;
|
||||
|
||||
lsx = corner_x * 65536;
|
||||
lsy = corner_y * 65536;
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
xdx *= 65536;
|
||||
ydx *= 65536;
|
||||
xdy *= 65536;
|
||||
ydy *= 65536;
|
||||
|
||||
|
||||
// Scaled subtracted srcw and srch.
|
||||
float fsw = (srcw - 1) * 65536 - 1;
|
||||
float fsh = (srch - 1) * 65536 - 1;
|
||||
|
||||
for (y = 0; y < dsth; y++, lsx += xdy, lsy += ydy) {
|
||||
|
||||
sx = lsx;
|
||||
sy = lsy;
|
||||
|
||||
// Loop through every line.
|
||||
for (y = 0; y < dsth; y++) {
|
||||
|
||||
// unsigned char *d = dstpixels + dstpitch * y;
|
||||
// unsigned char *dend = d + 4 * dstw;
|
||||
// The source coordinates of the leftmost pixel in the line.
|
||||
double leftsx = corner_x + y * xdy;
|
||||
double leftsy = corner_y + y * ydy;
|
||||
|
||||
float minx = 0;
|
||||
float maxx = dstw - 1;
|
||||
// Min and max x-extent to draw on the current line.
|
||||
double minx = 0;
|
||||
double maxx = dstw - 1;
|
||||
|
||||
if (xdx != 0) {
|
||||
float d1 = -lsx / xdx;
|
||||
float d2 = (fsw - lsx) / xdx;
|
||||
// Figure out the x-extent based on xdx.
|
||||
if (xdx) {
|
||||
double x1 = (0.0 - leftsx) / xdx;
|
||||
double x2 = (maxsx - leftsx) / xdx;
|
||||
|
||||
minx = fmaxf(minx, fminf(d1, d2));
|
||||
maxx = fminf(maxx, fmaxf(d1, d2));
|
||||
if (x1 < x2) {
|
||||
minx = fmax(x1, minx);
|
||||
maxx = fmin(x2, maxx);
|
||||
} else {
|
||||
minx = fmax(x2, minx);
|
||||
maxx = fmin(x1, maxx);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (leftsx < 0 || leftsx > maxsx) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Figure out the x-extent based on ydx.
|
||||
if (ydx) {
|
||||
double x1 = (0.0 - leftsy) / ydx;
|
||||
double x2 = (maxsy - leftsy) / ydx;
|
||||
|
||||
if (x1 < x2) {
|
||||
minx = fmax(x1, minx);
|
||||
maxx = fmin(x2, maxx);
|
||||
} else {
|
||||
minx = fmax(x2, minx);
|
||||
maxx = fmin(x1, maxx);
|
||||
}
|
||||
|
||||
} else if ( lsx < 0 || lsx >= fsw) {
|
||||
continue;
|
||||
} else {
|
||||
if (leftsy < 0 || leftsy > maxsy) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (ydx != 0) {
|
||||
float d1 = -lsy / ydx;
|
||||
float d2 = (fsh - lsy) / ydx;
|
||||
|
||||
minx = fmaxf(minx, fminf(d1, d2));
|
||||
maxx = fminf(maxx, fmaxf(d1, d2));
|
||||
} else if ( lsy < 0 || lsy >= fsh) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (minx > maxx) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
minx = ceil(minx);
|
||||
maxx = floor(maxx);
|
||||
|
||||
if (minx >= maxx) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// The start and end of line pointers.
|
||||
unsigned char *d = dstpixels + dstpitch * y;
|
||||
unsigned char *dend = d + 4 * (int) maxx;
|
||||
|
||||
// Advance start of line by 4.
|
||||
d += 4 * (int) minx;
|
||||
|
||||
sx = lsx + minx * xdx;
|
||||
sy = lsy + minx * ydx;
|
||||
|
||||
int sxi = (int) sx;
|
||||
int syi = (int) sy;
|
||||
int xdxi = (int) xdx;
|
||||
int ydxi = (int) ydx;
|
||||
// Starting coordinates and deltas.
|
||||
sxi = (int) ((leftsx + minx * xdx) * 65536);
|
||||
syi = (int) ((leftsy + minx * ydx) * 65536);
|
||||
dsxi = (int) (xdx * 65536);
|
||||
dsyi = (int) (ydx * 65536);
|
||||
|
||||
while (d <= dend) {
|
||||
int px, py;
|
||||
px = sxi >> 16;
|
||||
py = syi >> 16;
|
||||
|
||||
|
||||
int px = sxi >> 16;
|
||||
int py = syi >> 16;
|
||||
|
||||
unsigned char *sp = srcpixels + py * srcpitch + px * 4;
|
||||
|
||||
int yfrac = (syi >> 8) & 0xff; // ((short) sy) & 0xff;
|
||||
int xfrac = (sxi >> 8) & 0xff; // ((short) sx) & 0xff;
|
||||
unsigned int yfrac = (syi >> 8) & 0xff; // ((short) sy) & 0xff;
|
||||
unsigned int xfrac = (sxi >> 8) & 0xff; // ((short) sx) & 0xff;
|
||||
|
||||
unsigned int pal = *(unsigned int *) sp;
|
||||
unsigned int pbl = *(unsigned int *) (sp + 4);
|
||||
@@ -1104,46 +1162,53 @@ void transform32_std(PyObject *pysrc, PyObject *pydst,
|
||||
dh = I(dh, rh, alpha);
|
||||
|
||||
* (unsigned int *) d = (dh << 8) | dl;
|
||||
|
||||
|
||||
d += 4;
|
||||
sxi += xdxi;
|
||||
syi += ydxi;
|
||||
sxi += dsxi;
|
||||
syi += dsyi;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Py_END_ALLOW_THREADS
|
||||
Py_END_ALLOW_THREADS;
|
||||
|
||||
|
||||
// This is bogus, and only serves to ensure that the FPU
|
||||
// computes these variables at the right times.
|
||||
return sxi + syi + dsxi + dsyi;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef GCC_MMX
|
||||
|
||||
/****************************************************************************/
|
||||
/* 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;
|
||||
|
||||
int y;
|
||||
int srcpitch, dstpitch;
|
||||
|
||||
int srcw, srch;
|
||||
int dstw, dsth;
|
||||
|
||||
// The x and y source pixel coordinates, times 65536. And their
|
||||
// delta-per-dest-x-pixel.
|
||||
int sxi = 0, syi = 0, dsxi = 0, dsyi = 0;
|
||||
|
||||
unsigned char *srcpixels;
|
||||
unsigned char *dstpixels;
|
||||
|
||||
float lsx, lsy; // The position of the current line in the source.
|
||||
float sx, sy; // The position of the current pixel in the source.
|
||||
unsigned int px, py;
|
||||
unsigned int sxi, syi;
|
||||
unsigned int xdxi, ydxi;
|
||||
|
||||
src = PySurface_AsSurface(pysrc);
|
||||
dst = PySurface_AsSurface(pydst);
|
||||
|
||||
@@ -1163,63 +1228,101 @@ int transform32_mmx(PyObject *pysrc, PyObject *pydst,
|
||||
|
||||
// Compute the coloring multiplier.
|
||||
unsigned int amul = (unsigned int) (a * 256);
|
||||
|
||||
// Compute the maximum x and y coordinates.
|
||||
double maxsx = srcw - 1;
|
||||
double maxsy = srch - 1;
|
||||
|
||||
lsx = corner_x * 65536;
|
||||
lsy = corner_y * 65536;
|
||||
|
||||
xdx *= 65536;
|
||||
ydx *= 65536;
|
||||
xdy *= 65536;
|
||||
ydy *= 65536;
|
||||
|
||||
// Scaled subtracted srcw and srch.
|
||||
float fsw = (srcw - 1) * 65536 - 1;
|
||||
float fsh = (srch - 1) * 65536 - 1;
|
||||
|
||||
for (y = 0; y < dsth; y++, lsx += xdy, lsy += ydy) {
|
||||
|
||||
float minx = 0;
|
||||
float maxx = dstw - 1;
|
||||
|
||||
if (xdx != 0) {
|
||||
float d1 = -lsx / xdx;
|
||||
float d2 = (fsw - lsx) / xdx;
|
||||
|
||||
minx = fmaxf(minx, fminf(d1, d2));
|
||||
maxx = fminf(maxx, fmaxf(d1, d2));
|
||||
|
||||
} else if ( lsx < 0 || lsx >= fsw) {
|
||||
continue;
|
||||
// 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 (ydx != 0) {
|
||||
float d1 = -lsy / ydx;
|
||||
float d2 = (fsh - lsy) / ydx;
|
||||
|
||||
minx = fmaxf(minx, fminf(d1, d2));
|
||||
maxx = fminf(maxx, fmaxf(d1, d2));
|
||||
} else if ( lsy < 0 || lsy >= fsh) {
|
||||
continue;
|
||||
if (xdy && fabs(fmodf(1.0 / xdy, 1)) < EPSILON) {
|
||||
xdy -= (xdy / fabs(xdy)) * EPSILON;
|
||||
}
|
||||
|
||||
if (minx > maxx) {
|
||||
continue;
|
||||
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++) {
|
||||
|
||||
// The source coordinates of the leftmost pixel in the line.
|
||||
double leftsx = corner_x + y * xdy;
|
||||
double leftsy = corner_y + y * ydy;
|
||||
|
||||
// Min and max x-extent to draw on the current line.
|
||||
double minx = 0;
|
||||
double maxx = dstw - 1;
|
||||
|
||||
// Figure out the x-extent based on xdx.
|
||||
if (xdx) {
|
||||
double x1 = (0.0 - leftsx) / xdx;
|
||||
double x2 = (maxsx - leftsx) / xdx;
|
||||
|
||||
if (x1 < x2) {
|
||||
minx = fmax(x1, minx);
|
||||
maxx = fmin(x2, maxx);
|
||||
} else {
|
||||
minx = fmax(x2, minx);
|
||||
maxx = fmin(x1, maxx);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (leftsx < 0 || leftsx > maxsx) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Figure out the x-extent based on ydx.
|
||||
if (ydx) {
|
||||
double x1 = (0.0 - leftsy) / ydx;
|
||||
double x2 = (maxsy - leftsy) / ydx;
|
||||
|
||||
if (x1 < x2) {
|
||||
minx = fmax(x1, minx);
|
||||
maxx = fmin(x2, maxx);
|
||||
} else {
|
||||
minx = fmax(x2, minx);
|
||||
maxx = fmin(x1, maxx);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (leftsy < 0 || leftsy > maxsy) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
minx = ceil(minx);
|
||||
maxx = floor(maxx);
|
||||
|
||||
if (minx >= maxx) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// The start and end of line pointers.
|
||||
unsigned char *d = dstpixels + dstpitch * y;
|
||||
unsigned char *dend = d + 4 * (int) maxx;
|
||||
|
||||
// Advance start of line by 4.
|
||||
d += 4 * (int) minx;
|
||||
|
||||
sx = (lsx + minx * xdx);
|
||||
sy = (lsy + minx * ydx);
|
||||
|
||||
sxi = (unsigned int) sx;
|
||||
syi = (unsigned int) sy;
|
||||
xdxi = (int) xdx;
|
||||
ydxi = (int) ydx;
|
||||
// Starting coordinates and deltas.
|
||||
sxi = (int) ((leftsx + minx * xdx) * 65536);
|
||||
syi = (int) ((leftsy + minx * ydx) * 65536);
|
||||
dsxi = (int) (xdx * 65536);
|
||||
dsyi = (int) (ydx * 65536);
|
||||
|
||||
// No floating point allowed between here and the end of the
|
||||
// while loop.
|
||||
@@ -1235,8 +1338,8 @@ int transform32_mmx(PyObject *pysrc, PyObject *pydst,
|
||||
|
||||
while (d <= dend) {
|
||||
|
||||
px = sxi >> 16;
|
||||
py = syi >> 16;
|
||||
int px = sxi >> 16;
|
||||
int py = syi >> 16;
|
||||
|
||||
unsigned char *sp = srcpixels + py * srcpitch + px * 4;
|
||||
|
||||
@@ -1310,19 +1413,19 @@ int transform32_mmx(PyObject *pysrc, PyObject *pydst,
|
||||
movd_r2m(mm1, *(unsigned int *)d);
|
||||
|
||||
d += 4;
|
||||
sxi += xdxi;
|
||||
syi += ydxi;
|
||||
sxi += dsxi;
|
||||
syi += dsyi;
|
||||
}
|
||||
|
||||
emms();
|
||||
}
|
||||
|
||||
Py_END_ALLOW_THREADS
|
||||
Py_END_ALLOW_THREADS;
|
||||
|
||||
|
||||
// This is bogus, and only serves to ensure that the FPU
|
||||
// computes these variables at the right times.
|
||||
return sxi + syi + xdxi + ydxi;
|
||||
// This is bogus, and only serves to ensure that the FPU
|
||||
// computes these variables at the right times.
|
||||
return sxi + syi + dsxi + dsyi;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1332,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;
|
||||
@@ -1345,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,
|
||||
|
||||
+3
-2
@@ -601,12 +601,13 @@ static void font_dealloc(PyFontObject* self)
|
||||
|
||||
static int font_init(PyFontObject *self, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
int index = 0;
|
||||
int fontsize;
|
||||
RENPY_TTF_Font* font = NULL;
|
||||
PyObject* fileobj;
|
||||
|
||||
self->font = NULL;
|
||||
if(!PyArg_ParseTuple(args, "Oi|iff", &fileobj, &fontsize))
|
||||
if(!PyArg_ParseTuple(args, "Oi|i", &fileobj, &fontsize, &index))
|
||||
return -1;
|
||||
|
||||
if(!font_initialized)
|
||||
@@ -674,7 +675,7 @@ static int font_init(PyFontObject *self, PyObject *args, PyObject *kwds)
|
||||
return -1;
|
||||
}
|
||||
// Py_BEGIN_ALLOW_THREADS
|
||||
font = RENPY_TTF_OpenFontIndexRW(rw, 1, fontsize, 0);
|
||||
font = RENPY_TTF_OpenFontIndexRW(rw, 1, fontsize, index);
|
||||
// Py_END_ALLOW_THREADS
|
||||
#else
|
||||
Py_DECREF(fileobj);
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
#include <Python.h>
|
||||
#include <fribidi/fribidi.h>
|
||||
|
||||
/* This is easier than trying to figure out the header that alloca is */
|
||||
/* defined in. */
|
||||
void *alloca(size_t size);
|
||||
|
||||
PyObject *renpybidi_log2vis(PyObject *s, int *direction) {
|
||||
char *src;
|
||||
int size;
|
||||
FriBidiChar *srcuni;
|
||||
int unisize;
|
||||
FriBidiChar *dstuni;
|
||||
char *dst;
|
||||
|
||||
src = PyString_AsString(s);
|
||||
|
||||
if (src == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size = PyString_Size(s);
|
||||
|
||||
srcuni = (FriBidiChar *) alloca(size * 4);
|
||||
dstuni = (FriBidiChar *) alloca(size * 4);
|
||||
dst = (char *) alloca(size * 4);
|
||||
|
||||
unisize = fribidi_charset_to_unicode(FRIBIDI_CHAR_SET_UTF8, src, size, srcuni);
|
||||
|
||||
fribidi_log2vis(
|
||||
srcuni,
|
||||
unisize,
|
||||
direction,
|
||||
dstuni,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
fribidi_unicode_to_charset(FRIBIDI_CHAR_SET_UTF8, dstuni, unisize, dst);
|
||||
|
||||
return PyString_FromString(dst);
|
||||
}
|
||||
+83
-24
@@ -4,6 +4,7 @@ import os
|
||||
import os.path
|
||||
import platform
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
try:
|
||||
import bdist_mpkg
|
||||
@@ -16,7 +17,6 @@ extra_compile_args = [ "-O3", "-funroll-loops" ]
|
||||
# extra_compile_args = [ "-O0", "-ggdb" ]
|
||||
# extra_compile_args = [ "-O0", "-gstabs" ]
|
||||
|
||||
|
||||
# This environment variable should have the full path to the installed
|
||||
# Ren'Py dependencies.
|
||||
install = os.environ.get("RENPY_DEPS_INSTALL", None)
|
||||
@@ -75,7 +75,7 @@ def add_include(prefix, file):
|
||||
if dir not in include_dirs:
|
||||
include_dirs.append(dir)
|
||||
|
||||
def add_library(name):
|
||||
def add_library(name, optional=False):
|
||||
"""
|
||||
This looks for a library named name in the <i> and <i>/lib, for all
|
||||
<i> in install. When found, it adds it to library_dirs.
|
||||
@@ -96,14 +96,36 @@ def add_library(name):
|
||||
|
||||
if dir not in library_dirs:
|
||||
library_dirs.append(dir)
|
||||
return
|
||||
return True
|
||||
|
||||
if optional:
|
||||
return False
|
||||
|
||||
print "Couldn't find library %s." % name
|
||||
print "The paths searched were:"
|
||||
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")
|
||||
@@ -113,23 +135,37 @@ 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("libz")
|
||||
add_library("libpng")
|
||||
add_library("libavformat")
|
||||
add_library("libavcodec")
|
||||
add_library("libavutil")
|
||||
has_swscale = add_library("libswscale", True)
|
||||
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' ]
|
||||
sound_libraries = [ "avformat", "avcodec", "avutil", "z" ]
|
||||
png_libraries = [ 'png', "z" ]
|
||||
|
||||
sound_libraries = [ "avformat", "avcodec", "avutil", "z" ]
|
||||
if has_swscale:
|
||||
sound_libraries.insert(0, "swscale")
|
||||
|
||||
# The following turn on optional modules.
|
||||
winmixer = None
|
||||
linmixer = None
|
||||
@@ -149,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,
|
||||
@@ -157,23 +193,19 @@ 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,
|
||||
library_dirs=library_dirs,
|
||||
extra_compile_args=extra_compile_args,
|
||||
extra_link_args=extra_link_args,
|
||||
libraries=sdl_libraries + [ 'freetype' ],
|
||||
)
|
||||
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,
|
||||
@@ -181,25 +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')
|
||||
|
||||
extensions.append(distutils.core.Extension(
|
||||
"_renpybidi",
|
||||
["_renpybidi.c", "renpybidicore.c"],
|
||||
include_dirs=include_dirs,
|
||||
library_dirs=library_dirs,
|
||||
libraries=['fribidi'],
|
||||
))
|
||||
|
||||
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.1",
|
||||
version = "6.11.0",
|
||||
ext_modules = extensions,
|
||||
py_modules = py_modules,
|
||||
package_dir = { '' : 'lib' },
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user