Compare commits
235 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 | |||
| 943b421779 | |||
| c21acfb108 | |||
| 8ae58964d8 | |||
| 0cf0135a00 | |||
| 11d8a8a249 | |||
| 8edacbf9f1 | |||
| e6f49527b6 | |||
| 9b897f7ffc | |||
| bc06c75cf2 | |||
| ef324e2f9f | |||
| 002ed104de | |||
| 211fd59d66 | |||
| 3827198240 | |||
| 760d975d5b | |||
| ad25bd6597 | |||
| 9edc9aa741 | |||
| 061f481d10 | |||
| f33839212d | |||
| ac46d25470 | |||
| efdf7d4e30 | |||
| 76d942ebb3 | |||
| 24881174ce | |||
| 88a44ea1a9 | |||
| d0aed4a284 | |||
| 47f5cce2c3 | |||
| 534f669e1d | |||
| 2f422080e9 | |||
| 6efbd90a7c | |||
| 446b5fd32f | |||
| 705dc5f53b | |||
| c5dba9f4a1 | |||
| 904c2ebe73 | |||
| 275f52814f | |||
| 693cf9f8c9 | |||
| 35c2ec5a83 | |||
| 3b60efd744 | |||
| daac5d8ebf | |||
| 1fab6d8707 | |||
| aaff11668a | |||
| 536341a819 | |||
| b9c468e446 | |||
| 03edec9785 | |||
| da70a85d75 | |||
| 4ba170b8d8 | |||
| 72ae15c635 | |||
| 1179066dda | |||
| 62d0093bee | |||
| 55c0d3b4a7 | |||
| 92014eafdd | |||
| b1be4c8ed4 | |||
| 06f36dd8d1 | |||
| 3a15f5c717 | |||
| 031f3338b1 |
@@ -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
|
||||
|
||||
@@ -1,3 +1,397 @@
|
||||
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
|
||||
-------------------
|
||||
|
||||
This release includes Launcher2, a near-total rewrite of the Ren'Py
|
||||
launcher. Among the more important changes are:
|
||||
|
||||
* The launcher now supports a project directory. It is no longer
|
||||
necessary to move projects around when upgrading Ren'Py.
|
||||
|
||||
* The launcher has support for selecting the editor to use. While we
|
||||
ship with jEdit support, other editors can be downloaded from the
|
||||
Ren'Py web site.
|
||||
|
||||
* When building distributions, the launcher now allows the user to
|
||||
choose which distributions are built.
|
||||
|
||||
* The Macintosh distribution now places all non-documentation files
|
||||
inside a single application.
|
||||
|
||||
* There is a new combined distribution, which includes support for
|
||||
Windows, Linux, and Macintosh in a single zip file.
|
||||
|
||||
|
||||
The new ui.detached function allows one to use the ui functions to
|
||||
define displayables without adding them to a layer.
|
||||
|
||||
|
||||
Ren'Py will now search for a directory named "Ren'Py Data" in the
|
||||
directories above your Ren'Py installation. If found, save data will
|
||||
be placed in that directory, rather than the system-specific default
|
||||
location. This should help make it easier to develop Ren'Py games when
|
||||
using a USB drive.
|
||||
|
||||
|
||||
The save location for screenshots has now been standardized. It is now
|
||||
the directory containing the executable used to start Ren'Py, be it a
|
||||
.exe, .py, .sh, or .app. (The latter is handled specially.)
|
||||
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Fixed a long-standing problem that could cause Rollback to operate
|
||||
incorrectly with object that were unreachable at the time of the
|
||||
Rollback.
|
||||
|
||||
Fixed a problem that prevented animations from displaying correctly
|
||||
when the animation was displayed more than once.
|
||||
|
||||
Fixed a problem that could cause children of the various
|
||||
MultiBox-based displayables (Fixed, HBox, VBox, and LiveComposite) to
|
||||
display animations incorrectly.
|
||||
|
||||
|
||||
New in Ren'Py 6.9.2
|
||||
-------------------
|
||||
|
||||
The semantics for play and queue have changed slightly. Now, when a
|
||||
play statement is followed by one or more queue statements, the first
|
||||
file in each play or queue statement will be played. For example:
|
||||
|
||||
play music "a.ogg"
|
||||
queue music "b.ogg"
|
||||
queue music "c.ogg"
|
||||
|
||||
will play "a.ogg", "b.ogg", and then loop "c.ogg". This change also
|
||||
applies to renpy.music.play and renpy.music.queue.
|
||||
|
||||
|
||||
Rollback was changed so that doing anything other than a roll-forward
|
||||
while in rollback mode exits rollback immediately.
|
||||
|
||||
|
||||
The library alias for config has been removed.
|
||||
|
||||
|
||||
Fixed a regression that caused dissolves to be terribly slow.
|
||||
|
||||
Fixed a bug that caused Ren'Py to crash when playing music on Windows
|
||||
when Data Execution Prevention was enabled. DEP is enabled by default
|
||||
on 64-bit Windows Vista.
|
||||
|
||||
Fixed a bug that caused Ren'Py to crash when a window icon was used on
|
||||
a computer with a 16-bit or 8-bit screen depth.
|
||||
|
||||
Fixed a bug that caused ui.sizer to malfunction.
|
||||
|
||||
Fixed a repeated word in "The Question".
|
||||
|
||||
Fixed a bug that could cause it to take two tries to define a joystick
|
||||
button.
|
||||
|
||||
|
||||
|
||||
New in Ren'Py 6.9.1
|
||||
-------------------
|
||||
|
||||
|
||||
@@ -22,8 +22,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
Please see each individual source file for a list of copyright
|
||||
holders. The pictures of Eileen in the demo are Copyright 2006
|
||||
Piroshki, under the same terms.
|
||||
holders. The artwork in the demo is released by various copyright
|
||||
holders, under the same terms.
|
||||
|
||||
|
||||
The Ren'Py module, the Ren'Py windows binaries, and the various Ren'Py
|
||||
launchers may contain code taken from the following projects:
|
||||
@@ -36,6 +37,7 @@ launchers may contain code taken from the following projects:
|
||||
* SDL_mixer (LGPL)
|
||||
* Freetype (LGPL)
|
||||
* FFmpeg (LGPL)
|
||||
* Fribidi (LGPL)
|
||||
* jpeg (JPEG License)
|
||||
* libpng (PNG license)
|
||||
* zlib (Zlib License)
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
1#!/usr/bin/env python
|
||||
|
||||
import glob
|
||||
import re
|
||||
from sets import Set as set
|
||||
import sys
|
||||
|
||||
seen_files = set()
|
||||
seen_strings = set()
|
||||
|
||||
def tl(fn, s):
|
||||
|
||||
s = eval(s)
|
||||
|
||||
if len(s) < 3:
|
||||
return
|
||||
|
||||
if s in seen_strings:
|
||||
return
|
||||
|
||||
if fn not in seen_files:
|
||||
print >>out
|
||||
print >>out, " # Translatable strings found in", fn
|
||||
print >>out
|
||||
seen_files.add(fn)
|
||||
|
||||
print >>out, " config.translations[%r] = %r" % (s, s)
|
||||
seen_strings.add(s)
|
||||
|
||||
def process(fn):
|
||||
|
||||
data = file(fn).read()
|
||||
|
||||
for m in re.finditer(r'\bu\"(\\"|[^"])+\"', data):
|
||||
tl(fn, m.group(0))
|
||||
|
||||
for m in re.finditer(r"\bu\'(\\'|[^'])+\'", data):
|
||||
tl(fn, m.group(0))
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# out = file("extras/translations.rpy", "w")
|
||||
out = sys.stdout
|
||||
|
||||
print >>out, "# This file contains a list of all of the phrases you can translate"
|
||||
print >>out, "# from the Ren'Py launcher."
|
||||
print >>out, ""
|
||||
print >>out, "init python:"
|
||||
|
||||
for fn in glob.glob("launcher/*.rpy"):
|
||||
process(fn)
|
||||
@@ -0,0 +1,84 @@
|
||||
1#!/usr/bin/env python
|
||||
|
||||
import collections
|
||||
import glob
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
|
||||
# A map from string to filename, line number where the string is found.
|
||||
strings = collections.defaultdict(list)
|
||||
|
||||
def process(fn):
|
||||
|
||||
lineno = 0
|
||||
|
||||
for data in file(fn, "r"):
|
||||
|
||||
lineno += 1
|
||||
|
||||
matches = [ ]
|
||||
|
||||
matches += re.finditer(r'\bu\"(\\"|[^"])+\"', data)
|
||||
matches += re.finditer(r"\bu\'(\\'|[^'])+\'", data)
|
||||
|
||||
for m in matches:
|
||||
s = m.group(0)[2:-1]
|
||||
|
||||
if "\\u" in s:
|
||||
continue
|
||||
|
||||
if len(s) == 1:
|
||||
continue
|
||||
|
||||
strings[s].append("%s:%d" % (fn, lineno))
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
files = [ ]
|
||||
|
||||
files += glob.glob("launcher2/*.rpy")
|
||||
files += glob.glob("common/*.rpy")
|
||||
files += glob.glob("common/_layout/*.rpym")
|
||||
files += glob.glob("common/_compat/*.rpym")
|
||||
|
||||
for fn in files:
|
||||
process(fn)
|
||||
|
||||
|
||||
converse = [ ]
|
||||
|
||||
for k, v in strings.iteritems():
|
||||
v = " ".join(sorted(v))
|
||||
converse.append((v, k))
|
||||
|
||||
converse.sort()
|
||||
|
||||
print """\
|
||||
# Ren'Py Visual Novel Engine
|
||||
# Copyright (C) 2009 PyTom <pytom@bishoujo.us>
|
||||
# This file is distributed under the same license as the Ren'Py package.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: mainline\\n"
|
||||
"Report-Msgid-Bugs-To: PyTom <pytom@bishoujo.us>\\n"
|
||||
"POT-Creation-Date: %s\\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\\n"
|
||||
"MIME-Version: 1.0\\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\\n"
|
||||
"Content-Transfer-Encoding: 8bit\\n"
|
||||
""" % time.strftime("%Y-%m-%d %H:%M%z")
|
||||
|
||||
for v, k in converse:
|
||||
print
|
||||
print "#:", v
|
||||
print "#, python-format"
|
||||
print "msgid \"%s\"" % k
|
||||
print "msgstr \"\""
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import collections
|
||||
import glob
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
import os
|
||||
|
||||
# A map from string to filename, line number where the string is found.
|
||||
strings = collections.defaultdict(list)
|
||||
|
||||
def process(fn):
|
||||
|
||||
lineno = 0
|
||||
|
||||
for data in file(fn, "r"):
|
||||
|
||||
lineno += 1
|
||||
|
||||
matches = [ ]
|
||||
|
||||
matches += re.finditer(r'\bu\"(\\"|[^"])+\"', data)
|
||||
matches += re.finditer(r"\bu\'(\\'|[^'])+\'", data)
|
||||
|
||||
for m in matches:
|
||||
s = m.group(0)[2:-1]
|
||||
|
||||
if "\\u" in s:
|
||||
continue
|
||||
|
||||
if len(s) == 1:
|
||||
continue
|
||||
|
||||
strings[s].append("%s:%d" % (fn, lineno))
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
files = [ ]
|
||||
|
||||
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")
|
||||
|
||||
if "launcher/strings.rpy" in files:
|
||||
files.remove("launcher/strings.rpy")
|
||||
|
||||
for fn in files:
|
||||
process(fn)
|
||||
|
||||
converse = [ ]
|
||||
|
||||
for k, v in strings.iteritems():
|
||||
v = " ".join(sorted(v))
|
||||
converse.append((v, k))
|
||||
|
||||
converse.sort()
|
||||
|
||||
f = file("launcher/strings.rpy", "w")
|
||||
|
||||
files = set(i for i in os.listdir("launcher") if i.endswith(".rpy"))
|
||||
|
||||
print >>f, """\
|
||||
init python:
|
||||
LAUNCHER_RPYS = %r
|
||||
|
||||
TRANSLATION_STRINGS = [
|
||||
""" % files
|
||||
|
||||
for v, k in converse:
|
||||
# print
|
||||
# print "#:", v
|
||||
# print "#, python-format"
|
||||
|
||||
print >>f, " u\"%s\"," % unicode(k)
|
||||
|
||||
print >>f, """\
|
||||
]
|
||||
"""
|
||||
@@ -1,48 +0,0 @@
|
||||
1#!/usr/bin/env python
|
||||
|
||||
import glob
|
||||
import re
|
||||
from sets import Set as set
|
||||
import sys
|
||||
|
||||
seen_files = set()
|
||||
seen_strings = set()
|
||||
|
||||
def tl(fn, s):
|
||||
|
||||
s = eval(s)
|
||||
|
||||
if s in seen_strings:
|
||||
return
|
||||
|
||||
if fn not in seen_files:
|
||||
print >>out
|
||||
print >>out, " # Translatable strings found in", fn
|
||||
print >>out
|
||||
seen_files.add(fn)
|
||||
|
||||
print >>out, " config.translations[%r] = %r" % (s, s)
|
||||
seen_strings.add(s)
|
||||
|
||||
def process(fn):
|
||||
|
||||
data = file(fn).read()
|
||||
|
||||
for m in re.finditer(r'\bu\"(\\"|[^"])+\"', data):
|
||||
tl(fn, m.group(0))
|
||||
|
||||
for m in re.finditer(r"\bu\'(\\'|[^'])+\'", data):
|
||||
tl(fn, m.group(0))
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# out = file("extras/translations.rpy", "w")
|
||||
out = sys.stdout
|
||||
|
||||
print >>out, "# This file contains a list of all of the phrases you can translate"
|
||||
print >>out, "# from the Ren'Py common code."
|
||||
print >>out, ""
|
||||
print >>out, "init python:"
|
||||
|
||||
for fn in glob.glob("common/*.rpy") + glob.glob("common/_layout/*.rpym") + glob.glob("common/_compat/*.rpym"):
|
||||
process(fn)
|
||||
@@ -0,0 +1,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
|
||||
@@ -13,6 +16,21 @@ init -1210 python:
|
||||
if version <= (6, 5, 0):
|
||||
layout.compat()
|
||||
|
||||
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)
|
||||
|
||||
|
||||
|
||||
init 1210 python hide::
|
||||
|
||||
# This returns true if the script_version is <= the
|
||||
|
||||
@@ -1,26 +1,53 @@
|
||||
# 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:
|
||||
reset
|
||||
center
|
||||
|
||||
python:
|
||||
config.default_transform = right
|
||||
|
||||
|
||||
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 ############################################################
|
||||
|
||||
@@ -140,8 +167,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 +190,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()
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -288,13 +286,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 +321,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 +329,25 @@ 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.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."
|
||||
|
||||
@@ -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,18 @@ init -1180 python:
|
||||
# preference when the game is first run.
|
||||
config.default_text_cps = 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 = [ ]
|
||||
|
||||
# This is updated to give the user an idea of where a save is
|
||||
# taking place.
|
||||
save_name = ''
|
||||
@@ -129,10 +139,13 @@ init -1180 python:
|
||||
return
|
||||
|
||||
_preferences.fullscreen = False
|
||||
|
||||
import webbrowser
|
||||
webbrowser.open_new("file:///" + config.basedir + "/" + config.help)
|
||||
|
||||
|
||||
try:
|
||||
import webbrowser
|
||||
webbrowser.open_new("file:///" + config.basedir + "/" + config.help)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
init -1180 python hide:
|
||||
|
||||
@@ -140,18 +153,36 @@ init -1180 python hide:
|
||||
def screenshot():
|
||||
import os.path
|
||||
import os
|
||||
|
||||
pattern = os.environ.get("RENPY_SCREENSHOT_PATTERN", "screenshot%04d.png")
|
||||
import __main__
|
||||
|
||||
pattern = os.environ.get("RENPY_SCREENSHOT_PATTERN", "screenshot%04d.png")
|
||||
|
||||
# Pick the directory to save into.
|
||||
dest = config.renpy_base.rstrip("/")
|
||||
|
||||
# Guess if we're an OSX App.
|
||||
if dest.endswith("/Contents/Resources/autorun"):
|
||||
# Go up 4 directories.
|
||||
dest = os.path.dirname(dest)
|
||||
dest = os.path.dirname(dest)
|
||||
dest = os.path.dirname(dest)
|
||||
dest = os.path.dirname(dest)
|
||||
|
||||
# Try to pick a filename.
|
||||
i = 1
|
||||
while True:
|
||||
fn = pattern % i
|
||||
fn = dest + "/" + pattern % i
|
||||
if not os.path.exists(fn):
|
||||
break
|
||||
i += 1
|
||||
|
||||
renpy.screenshot(fn)
|
||||
|
||||
try:
|
||||
renpy.screenshot(fn)
|
||||
except:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
def dump_styles():
|
||||
if config.developer:
|
||||
renpy.style.write_text("styles.txt")
|
||||
@@ -297,25 +328,6 @@ label _hide_windows:
|
||||
|
||||
|
||||
# This code here handles check for the correct version of the Ren'Py module.
|
||||
|
||||
label _check_module:
|
||||
|
||||
if not config.module_warning:
|
||||
return
|
||||
|
||||
python hide:
|
||||
module_info = _(u"While Ren'Py games may be playable without the renpy module, some features may be disabled. For more information, read the module/README.txt file or go to http://www.bishoujo.us/renpy/.")
|
||||
|
||||
if renpy.module_version() == 0:
|
||||
_show_exception(_(u"renpy module not found."),
|
||||
_(u"The renpy module could not be loaded on your system.") + "\n\n" + module_info)
|
||||
elif renpy.module_version() < config.module_version:
|
||||
_show_exception(_(u"Old renpy module found."),
|
||||
_(u"An old version (%d) of the Ren'Py module was found on your system, while this game requires version %d.") % (renpy.module_version(), config.module_version) + "\n\n" + module_info)
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
label _save_reload_game:
|
||||
python hide:
|
||||
@@ -328,6 +340,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)))
|
||||
@@ -518,6 +532,9 @@ 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.
|
||||
@@ -660,9 +677,11 @@ label _start:
|
||||
for i in config.start_callbacks:
|
||||
i()
|
||||
|
||||
call _check_module from _call__check_module_1
|
||||
call _load_reload_game from _call__load_reload_game_1
|
||||
|
||||
if not _restart and config.auto_load and renpy.can_load(config.auto_load):
|
||||
$ renpy.load(config.auto_load)
|
||||
|
||||
scene black
|
||||
|
||||
if not _restart:
|
||||
@@ -690,18 +709,24 @@ label _start:
|
||||
# Clean out any residual scene from the splashscreen.
|
||||
scene black
|
||||
|
||||
if _restart is None:
|
||||
$ renpy.transition(config.end_splash_transition)
|
||||
else:
|
||||
$ renpy.transition(_restart[0])
|
||||
jump expression _restart[1]
|
||||
|
||||
# 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.
|
||||
@@ -739,3 +764,69 @@ label _main_menu_screen:
|
||||
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"
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -255,6 +258,8 @@ init -1100 python:
|
||||
|
||||
return rv
|
||||
|
||||
NVLSpeaker = NVLCharacter
|
||||
|
||||
config.nvl_adv_transition = None
|
||||
config.adv_nvl_transition = None
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,13 +98,27 @@ 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):
|
||||
|
||||
@@ -111,7 +130,9 @@ python early hide:
|
||||
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,16 +166,26 @@ 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:
|
||||
@@ -162,7 +193,11 @@ python early hide:
|
||||
else:
|
||||
channel = 7
|
||||
|
||||
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,
|
||||
@@ -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,39 @@ 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:
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -203,6 +201,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))
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -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=2)
|
||||
|
||||
# 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.
|
||||
@@ -58,8 +71,10 @@ init -1120:
|
||||
|
||||
if _voice.play and not config.skipping:
|
||||
renpy.sound.play(_voice.play, channel=2)
|
||||
store._last_voice_play = _voice.play
|
||||
elif not _voice.sustain:
|
||||
renpy.sound.stop(channel=2)
|
||||
store._last_voice_play = _voice.play
|
||||
|
||||
_voice.play = None
|
||||
_voice.sustain = False
|
||||
|
||||
@@ -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,6 @@
|
||||
# Entry point for the developer console.
|
||||
label _developer:
|
||||
|
||||
if not config.developer:
|
||||
return
|
||||
|
||||
call _enter_menu from _call__enter_menu_4
|
||||
# This file contains the developer screen, which contains tools that might
|
||||
# be of interest to people making Ren'Py games.
|
||||
|
||||
label _developer_screen:
|
||||
|
||||
@@ -19,11 +15,13 @@ label _developer_screen:
|
||||
|
||||
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()
|
||||
@@ -287,3 +285,185 @@ 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")
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
|
||||
# See LICENSE.txt for license details.
|
||||
|
||||
init python:
|
||||
|
||||
layout.provides('joystick_preferences')
|
||||
@@ -28,8 +31,6 @@ init python:
|
||||
style.js_prefs_button.xminimum = 0.5
|
||||
style.js_prefs_box.box_first_spacing = 10
|
||||
|
||||
|
||||
|
||||
config.joystick_keys = [
|
||||
(u'Left', 'joy_left'),
|
||||
(u'Right', 'joy_right'),
|
||||
@@ -42,8 +43,6 @@ init python:
|
||||
(u'Hide Text', 'joy_hide'),
|
||||
(u'Menu', 'joy_menu'),
|
||||
]
|
||||
|
||||
|
||||
|
||||
def _joystick_select_binding():
|
||||
|
||||
@@ -55,8 +54,8 @@ init python:
|
||||
layout.button(_(label) + " - " + _(_preferences.joymap.get(key, u"Not Assigned")), "prefs_js", clicked=my_clicked, index=label)
|
||||
|
||||
def _joystick_get_binding():
|
||||
ui.add(renpy.display.joystick.JoyBehavior())
|
||||
ui.saybehavior()
|
||||
ui.add(renpy.display.joystick.JoyBehavior())
|
||||
|
||||
def _joystick_take_binding(binding, key):
|
||||
|
||||
@@ -79,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
|
||||
@@ -104,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])
|
||||
|
||||
@@ -193,36 +198,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 +305,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 +330,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 +344,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):
|
||||
"""
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -157,8 +162,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 +212,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 +257,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 +307,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 +332,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 +345,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')
|
||||
@@ -40,7 +43,7 @@ init python:
|
||||
def __show_preferences():
|
||||
|
||||
ime = _ImageMapper(
|
||||
"prefs",
|
||||
"preferences",
|
||||
config.preferences_ground,
|
||||
config.preferences_idle,
|
||||
config.preferences_hover,
|
||||
@@ -127,7 +130,7 @@ init python:
|
||||
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')
|
||||
|
||||
@@ -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')
|
||||
|
||||
|
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
|
||||
|
Before Width: | Height: | Size: 95 KiB |
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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,6 +172,9 @@ def main():
|
||||
"subpixel.c",
|
||||
"winmixer.c",
|
||||
"winmixer.pyx",
|
||||
"_renpybidi.c",
|
||||
"renpybidicore.c",
|
||||
"_renpybidi.pyx",
|
||||
]
|
||||
|
||||
for i in module_files:
|
||||
@@ -229,6 +232,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,8 +1,8 @@
|
||||
#bodyContent {
|
||||
font-size: 136%;
|
||||
font-size: medium;
|
||||
background: #fff;
|
||||
margin-left: 3em;
|
||||
margin-right: 3em;
|
||||
margin-left: 20%;
|
||||
margin-right: 20%;
|
||||
padding: 1.5em;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ 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
|
||||
No jpgs yet.
|
||||
cp `find www.renpy.org -name \*.jpg -type f` images
|
||||
|
||||
rm -Rf reference tutorials
|
||||
python2.5 process.py
|
||||
|
||||
@@ -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,144 @@
|
||||
import binascii
|
||||
|
||||
|
||||
def a2b(a):
|
||||
return binascii.a2b_hex(''.join(a.split()))
|
||||
|
||||
|
||||
resources = {
|
||||
260 : a2b('''
|
||||
01 00 ff ff 00 00 00 00 00 00 00 00 c8 00 c0 80
|
||||
02 00 00 00 00 00 b8 00 29 00 00 00 00 00 00 00
|
||||
08 00 90 01 00 01 4d 00 53 00 20 00 53 00 68 00
|
||||
65 00 6c 00 6c 00 20 00 44 00 6c 00 67 00 00 00
|
||||
00 00 00 00 00 00 00 00 01 00 01 50 7f 00 14 00
|
||||
32 00 0e 00 01 00 00 00 ff ff 80 00 4f 00 4b 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 04 08 00 50
|
||||
07 00 07 00 aa 00 0c 00 ea 03 00 00 ff ff 81 00
|
||||
00 00 00 00
|
||||
'''),
|
||||
261 : a2b('''
|
||||
01 00 ff ff 00 00 00 00 00 00 00 00 c8 00 c0 80
|
||||
04 00 00 00 00 00 b8 00 3a 00 00 00 00 00 00 00
|
||||
08 00 90 01 00 01 4d 00 53 00 20 00 53 00 68 00
|
||||
65 00 6c 00 6c 00 20 00 44 00 6c 00 67 00 00 00
|
||||
00 00 00 00 00 00 00 00 80 00 81 50 07 00 14 00
|
||||
aa 00 0c 00 ec 03 00 00 ff ff 81 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 01 00 01 50 7f 00 25 00
|
||||
32 00 0e 00 01 00 00 00 ff ff 80 00 4f 00 4b 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 50
|
||||
4a 00 25 00 32 00 0e 00 02 00 00 00 ff ff 80 00
|
||||
43 00 61 00 6e 00 63 00 65 00 6c 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 04 08 00 50 07 00 07 00
|
||||
aa 00 0c 00 eb 03 00 00 ff ff 81 00 00 00 00 00
|
||||
'''),
|
||||
262 : a2b('''
|
||||
01 00 ff ff 00 00 00 00 00 00 00 00 c8 00 c0 80
|
||||
04 00 00 00 00 00 b8 00 29 00 00 00 00 00 00 00
|
||||
08 00 90 01 00 01 4d 00 53 00 20 00 53 00 68 00
|
||||
65 00 6c 00 6c 00 20 00 44 00 6c 00 67 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 01 50 7f 00 14 00
|
||||
32 00 0e 00 06 00 00 00 ff ff 80 00 59 00 65 00
|
||||
73 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
04 08 00 50 07 00 07 00 aa 00 0c 00 ed 03 00 00
|
||||
ff ff 81 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 01 50 07 00 14 00 32 00 0e 00 07 00 00 00
|
||||
ff ff 80 00 4e 00 6f 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 01 50 4b 00 14 00 32 00 0e 00
|
||||
02 00 00 00 ff ff 80 00 43 00 61 00 6e 00 63 00
|
||||
65 00 6c 00 00 00 00 00
|
||||
'''),
|
||||
263 : a2b('''
|
||||
01 00 ff ff 00 00 00 00 00 00 00 00 80 00 ca 80
|
||||
03 00 00 00 00 00 e2 00 29 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 81 50 07 00 14 00
|
||||
97 00 0e 00 eb 03 00 00 6d 00 73 00 63 00 74 00
|
||||
6c 00 73 00 5f 00 70 00 72 00 6f 00 67 00 72 00
|
||||
65 00 73 00 73 00 33 00 32 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 04 08 00 50 07 00 07 00
|
||||
d4 00 0c 00 ea 03 00 00 ff ff 81 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 50 a9 00 14 00
|
||||
32 00 0e 00 02 00 00 00 ff ff 80 00 43 00 61 00
|
||||
6e 00 63 00 65 00 6c 00 00 00 00 00
|
||||
'''),
|
||||
264 : a2b('''
|
||||
01 00 ff ff 00 00 00 00 00 00 00 00 c8 00 c0 80
|
||||
04 00 00 00 00 00 b8 00 3a 00 00 00 00 00 00 00
|
||||
08 00 90 01 00 01 4d 00 53 00 20 00 53 00 68 00
|
||||
65 00 6c 00 6c 00 20 00 44 00 6c 00 67 00 00 00
|
||||
00 00 00 00 00 00 00 00 a0 00 81 50 07 00 14 00
|
||||
aa 00 0c 00 ec 03 00 00 ff ff 81 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 01 00 01 50 7f 00 25 00
|
||||
32 00 0e 00 01 00 00 00 ff ff 80 00 4f 00 4b 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 50
|
||||
4a 00 25 00 32 00 0e 00 02 00 00 00 ff ff 80 00
|
||||
43 00 61 00 6e 00 63 00 65 00 6c 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 04 08 00 50 07 00 07 00
|
||||
aa 00 0c 00 eb 03 00 00 ff ff 81 00 00 00 00 00
|
||||
'''),
|
||||
265 : a2b('''
|
||||
01 00 ff ff 00 00 00 00 00 00 00 00 c8 00 c8 80
|
||||
12 00 00 00 00 00 d9 00 fc 00 00 00 00 00 00 00
|
||||
08 00 90 01 00 01 4d 00 53 00 20 00 53 00 68 00
|
||||
65 00 6c 00 6c 00 20 00 44 00 6c 00 67 00 00 00
|
||||
00 00 00 00 00 00 00 00 01 00 01 50 6c 00 ea 00
|
||||
30 00 0e 00 01 00 00 00 ff ff 80 00 4f 00 4b 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 50
|
||||
a2 00 ea 00 30 00 0e 00 02 00 00 00 ff ff 80 00
|
||||
43 00 61 00 6e 00 63 00 65 00 6c 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 07 00 00 50 06 00 06 00
|
||||
cc 00 4e 00 ff ff ff ff ff ff 80 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 03 00 21 50 48 00 12 00
|
||||
84 00 64 00 03 00 00 00 ff ff 85 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 02 50 0c 00 24 00
|
||||
c0 00 08 00 04 00 00 00 ff ff 82 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 80 00 81 50 0c 00 30 00
|
||||
c0 00 0e 00 05 00 00 00 ff ff 81 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 01 50 9c 00 42 00
|
||||
30 00 0e 00 06 00 00 00 ff ff 80 00 41 00 64 00
|
||||
64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
07 00 00 50 06 00 54 00 cb 00 3c 00 ff ff ff ff
|
||||
ff ff 80 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
03 00 21 50 48 00 61 00 84 00 64 00 07 00 00 00
|
||||
ff ff 85 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 02 50 0c 00 72 00 c0 00 08 00 08 00 00 00
|
||||
ff ff 82 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 01 50 9c 00 7e 00 30 00 0e 00 09 00 00 00
|
||||
ff ff 80 00 41 00 64 00 64 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 01 50 06 00 96 00
|
||||
42 00 0e 00 0a 00 00 00 ff ff 80 00 41 00 64 00
|
||||
64 00 20 00 66 00 69 00 6c 00 65 00 2e 00 2e 00
|
||||
2e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 01 50 4e 00 96 00 42 00 0e 00 0b 00 00 00
|
||||
ff ff 80 00 41 00 64 00 64 00 20 00 6e 00 65 00
|
||||
77 00 20 00 66 00 69 00 6c 00 65 00 2e 00 2e 00
|
||||
2e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 01 50 06 00 a8 00 42 00 0e 00 0c 00 00 00
|
||||
ff ff 80 00 41 00 64 00 64 00 20 00 66 00 6f 00
|
||||
6c 00 64 00 65 00 72 00 2e 00 2e 00 2e 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 07 00 00 50
|
||||
06 00 c6 00 cc 00 1e 00 ff ff ff ff ff ff 80 00
|
||||
43 00 6f 00 6d 00 6d 00 61 00 6e 00 64 00 20 00
|
||||
6c 00 69 00 6e 00 65 00 3a 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 80 00 81 50 0c 00 d2 00
|
||||
c0 00 0e 00 0e 00 00 00 ff ff 81 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 02 50 0c 00 14 00
|
||||
3c 00 08 00 1e 00 00 00 ff ff 82 00 4f 00 70 00
|
||||
74 00 69 00 6f 00 6e 00 3a 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 02 50 0c 00 63 00
|
||||
3c 00 08 00 46 00 00 00 ff ff 82 00 43 00 6f 00
|
||||
6d 00 6d 00 61 00 6e 00 64 00 3a 00 00 00 00 00
|
||||
'''),
|
||||
270 : a2b('''
|
||||
01 00 ff ff 00 00 00 00 00 00 00 00 48 04 00 44
|
||||
02 00 00 00 00 00 23 01 1a 00 00 00 00 00 00 00
|
||||
08 00 00 00 00 00 4d 00 53 00 20 00 53 00 68 00
|
||||
65 00 6c 00 6c 00 20 00 44 00 6c 00 67 00 00 00
|
||||
00 00 00 00 00 00 00 00 01 00 02 50 00 00 07 00
|
||||
23 01 08 00 ff ff ff ff ff ff 82 00 53 00 74 00
|
||||
61 00 74 00 69 00 63 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 02 40 00 00 12 00 23 01 08 00
|
||||
5f 04 00 00 ff ff 82 00 73 00 74 00 63 00 33 00
|
||||
32 00 00 00 00 00
|
||||
'''),
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
# Name: None
|
||||
# Version: 1
|
||||
# Description: Disables the automatic launching of an editor.
|
||||
|
||||
config.editor = None
|
||||
config.editor_transient = None
|
||||
@@ -0,0 +1,177 @@
|
||||
init python:
|
||||
import renpy.tools.archiver as archiver
|
||||
import os
|
||||
import os.path
|
||||
import fnmatch
|
||||
|
||||
label archiver:
|
||||
|
||||
python hide:
|
||||
|
||||
# Get the options
|
||||
name = project.info.get('archive_name', "data")
|
||||
include = project.info.get('archive_include', "*.png *.gif *.jpg")
|
||||
exclude = project.info.get('archive_exclude', "presplash.png")
|
||||
|
||||
# Allow the user to set the options.
|
||||
while True:
|
||||
|
||||
set_tooltip("")
|
||||
|
||||
screen()
|
||||
ui.vbox()
|
||||
|
||||
title(_(u"Archiver"))
|
||||
|
||||
text(_(u"The archiver allows you to obfuscate your game by including files in an archive file."))
|
||||
|
||||
ui.null(height=15)
|
||||
|
||||
text_variable(_(u"Archive Name:"), name, "name",
|
||||
_(u"The name of the archive to create."))
|
||||
|
||||
text_variable(_(u"Include Patterns:"), include, "include",
|
||||
_(u"Files matching these patterns are included in the archive."))
|
||||
|
||||
text_variable(_(u"Exclude Patterns:"), exclude, "exclude",
|
||||
_(u"Files matching these patterns are excluded from the archive."))
|
||||
|
||||
ui.null(height=15)
|
||||
|
||||
button(_(u"Archive"), ui.returns("archive"), _(u"Build the archive."))
|
||||
button(_(u"Cancel"), ui.jumps("top"), "")
|
||||
|
||||
ui.close()
|
||||
|
||||
act = interact()
|
||||
|
||||
if act == "name":
|
||||
name = input(
|
||||
_(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."),
|
||||
name)
|
||||
|
||||
elif act == "include":
|
||||
include = input(
|
||||
_(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."),
|
||||
include)
|
||||
|
||||
elif act == "exclude":
|
||||
exclude = input(
|
||||
_(u"Include Patterns"),
|
||||
_(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."),
|
||||
exclude)
|
||||
|
||||
elif act == "archive":
|
||||
break
|
||||
|
||||
# Store the options.
|
||||
|
||||
project.info["archive_name"] = name
|
||||
project.info["archive_include"] = include
|
||||
project.info["archive_exclude"] = exclude
|
||||
|
||||
project.save()
|
||||
|
||||
|
||||
# Break up the extension lists.
|
||||
|
||||
include = [ i.strip() for i in include.split() ]
|
||||
exclude = [ i.strip() for i in exclude.split() ]
|
||||
|
||||
# Get the gamedir and the archived dir.
|
||||
gamedir = os.path.join(project.path, "game")
|
||||
archived = os.path.join(project.path, "archived")
|
||||
|
||||
# The prefix of the archive file.
|
||||
prefix = os.path.join(gamedir, name)
|
||||
|
||||
archived_files = set()
|
||||
files = [ ]
|
||||
|
||||
# Choose files to archive.
|
||||
|
||||
set_tooltip("")
|
||||
|
||||
info(
|
||||
_(u"Scanning Files..."),
|
||||
"")
|
||||
|
||||
for bdir in (gamedir, archived):
|
||||
|
||||
for dirname, dirs, filenames in os.walk(bdir):
|
||||
|
||||
dirs[:] = [ i for i in dirs if not i[0] == '.' ]
|
||||
|
||||
for fn in filenames:
|
||||
|
||||
fullfn = dirname + "/" + fn
|
||||
shortfn = fullfn[len(bdir)+1:]
|
||||
|
||||
if fn[0] == ".":
|
||||
continue
|
||||
|
||||
if shortfn in archived_files:
|
||||
continue
|
||||
|
||||
should_archive = False
|
||||
|
||||
for i in include:
|
||||
if fnmatch.fnmatch(fn, i):
|
||||
should_archive = True
|
||||
|
||||
for i in exclude:
|
||||
if fnmatch.fnmatch(fn, i):
|
||||
should_archive = False
|
||||
|
||||
if not should_archive:
|
||||
continue
|
||||
|
||||
files.append((fullfn, shortfn))
|
||||
archived_files.add(shortfn)
|
||||
|
||||
if not files:
|
||||
error(_(u"The patterns did not match any files, so no archive was created."))
|
||||
|
||||
# Actually archiving files.
|
||||
info(_(u"Archiving Files..."), "")
|
||||
|
||||
archiver.archive(prefix, files)
|
||||
|
||||
# Move files out of the way.
|
||||
for fullfn, shortfn in files:
|
||||
afn = archived + "/" + shortfn
|
||||
|
||||
if fullfn == afn:
|
||||
continue
|
||||
|
||||
try:
|
||||
os.makedirs(os.path.dirname(afn))
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
os.rename(fullfn, afn)
|
||||
except:
|
||||
os.rename(afn, afn + ".old")
|
||||
os.rename(fullfn, afn)
|
||||
os.unlink(afn + ".old")
|
||||
|
||||
# Report success.
|
||||
screen()
|
||||
ui.vbox()
|
||||
|
||||
title(_(u"Success"))
|
||||
text(_(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."))
|
||||
|
||||
ui.null(height=20)
|
||||
|
||||
button(_(u"Return"), ui.jumps("top"), None)
|
||||
|
||||
ui.close()
|
||||
interact()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,326 @@
|
||||
init python:
|
||||
|
||||
import codecs
|
||||
import re
|
||||
import sys
|
||||
|
||||
##########################################################################
|
||||
# Code to update options.rpy
|
||||
|
||||
def list_logical_lines(filename):
|
||||
"""
|
||||
This reads in filename, and turns it into a list of logical
|
||||
lines.
|
||||
"""
|
||||
|
||||
f = codecs.open(filename, "rb", "utf-8")
|
||||
data = f.read()
|
||||
f.close()
|
||||
|
||||
# The result.
|
||||
rv = []
|
||||
|
||||
# The current position we're looking at in the buffer.
|
||||
pos = 0
|
||||
|
||||
# Looping over the lines in the file.
|
||||
while pos < len(data):
|
||||
|
||||
# The line that we're building up.
|
||||
line = ""
|
||||
|
||||
# The number of open parenthesis there are right now.
|
||||
parendepth = 0
|
||||
|
||||
# Looping over the characters in a single logical line.
|
||||
while pos < len(data):
|
||||
|
||||
c = data[pos]
|
||||
|
||||
if c == '\n' and not parendepth:
|
||||
rv.append(line)
|
||||
|
||||
pos += 1
|
||||
# This helps out error checking.
|
||||
line = ""
|
||||
break
|
||||
|
||||
# Backslash/newline.
|
||||
if c == "\\" and data[pos+1] == "\n":
|
||||
pos += 2
|
||||
line += "\\\n"
|
||||
continue
|
||||
|
||||
# Parenthesis.
|
||||
if c in ('(', '[', '{'):
|
||||
parendepth += 1
|
||||
|
||||
if c in ('}', ']', ')') and parendepth:
|
||||
parendepth -= 1
|
||||
|
||||
# Comments.
|
||||
if c == '#':
|
||||
while data[pos] != '\n':
|
||||
line += data[pos]
|
||||
pos += 1
|
||||
|
||||
continue
|
||||
|
||||
# Strings.
|
||||
if c in ('"', "'", "`"):
|
||||
delim = c
|
||||
line += c
|
||||
pos += 1
|
||||
|
||||
escape = False
|
||||
|
||||
while pos < len(data):
|
||||
|
||||
c = data[pos]
|
||||
|
||||
if escape:
|
||||
escape = False
|
||||
pos += 1
|
||||
line += c
|
||||
continue
|
||||
|
||||
if c == delim:
|
||||
pos += 1
|
||||
line += c
|
||||
break
|
||||
|
||||
if c == '\\':
|
||||
escape = True
|
||||
|
||||
line += c
|
||||
pos += 1
|
||||
|
||||
continue
|
||||
|
||||
continue
|
||||
|
||||
line += c
|
||||
pos += 1
|
||||
|
||||
if line:
|
||||
rv.append(line)
|
||||
|
||||
return rv
|
||||
|
||||
|
||||
def switch_theme(name):
|
||||
"""
|
||||
Switches the theme of the current project to the named theme.
|
||||
"""
|
||||
|
||||
theme_functions = set(i[1] for i in themes)
|
||||
|
||||
td = theme_data[name].copy()
|
||||
td["name"] = name
|
||||
|
||||
# Did we change the file at all?
|
||||
changed = False
|
||||
|
||||
filename = os.path.join(project.gamedir, "options.rpy")
|
||||
|
||||
out = codecs.open(filename + ".new", "wb", "utf-8")
|
||||
|
||||
for l in list_logical_lines(filename):
|
||||
|
||||
m = re.match(r' theme.(\w+)\(', l)
|
||||
if m:
|
||||
if m.group(1) in theme_functions:
|
||||
l = theme_templates[td["theme"]] % td
|
||||
changed = True
|
||||
|
||||
out.write(l + "\n")
|
||||
|
||||
out.close()
|
||||
|
||||
if changed:
|
||||
try:
|
||||
os.unlink(filename + ".bak")
|
||||
except:
|
||||
pass
|
||||
|
||||
os.rename(filename, filename + ".bak")
|
||||
os.rename(filename + ".new", filename)
|
||||
|
||||
else:
|
||||
os.unlink(filename + ".new")
|
||||
|
||||
error(_(u"Could not modify options.rpy. Perhaps it was changed too much."))
|
||||
|
||||
set_tooltip(_(u"Theme changed to %s.") % name)
|
||||
renpy.jump("top")
|
||||
|
||||
curried_switch_theme = renpy.curry(switch_theme)
|
||||
|
||||
|
||||
|
||||
##########################################################################
|
||||
# Code that handles display.
|
||||
|
||||
current_theme = None
|
||||
|
||||
def show_theme(name, target):
|
||||
"""
|
||||
Changes from the current theme to the roundrect theme named
|
||||
`name`.
|
||||
"""
|
||||
|
||||
if current_theme == name:
|
||||
return
|
||||
|
||||
store.current_theme = name
|
||||
|
||||
td = theme_data[name].copy()
|
||||
kind = td["theme"]
|
||||
del td["theme"]
|
||||
|
||||
if kind == "roundrect":
|
||||
td["rounded_window"] = False
|
||||
|
||||
renpy.style.restore(style_backup)
|
||||
getattr(theme, kind)(**td)
|
||||
customize_styles()
|
||||
renpy.style.rebuild()
|
||||
|
||||
renpy.jump(target)
|
||||
|
||||
curried_show_theme = renpy.curry(show_theme)
|
||||
|
||||
def theme_demo():
|
||||
# The sample area, that shows what the theme looks like.
|
||||
ui.window(style='default', background="#444", xpadding=1, ypadding=1)
|
||||
ui.window(style='gm_root', xpadding=5, ypadding=5)
|
||||
ui.vbox(5)
|
||||
|
||||
# Display Preference.
|
||||
ui.window(style=style.prefs_pref_frame)
|
||||
ui.vbox(style=style.prefs_pref_box)
|
||||
|
||||
ui.hbox(style=style.prefs_pref_choicebox)
|
||||
|
||||
layout.label(_(u"Display"), "prefs")
|
||||
layout.button(_(u"Window"), "prefs", clicked=does_nothing, selected=True)
|
||||
layout.button(_(u"Fullscreen"), "prefs", clicked=does_nothing, selected=False)
|
||||
layout.button(_(u"Planetarium"), "prefs", clicked=None, selected=False)
|
||||
|
||||
ui.close()
|
||||
ui.close()
|
||||
|
||||
# Volume Preference
|
||||
ui.window(style=style.prefs_pref_frame)
|
||||
ui.vbox(style=style.prefs_pref_box)
|
||||
|
||||
layout.label(_(u"Music Volume"), "prefs")
|
||||
ui.vbox(style=style.prefs_volume_box)
|
||||
|
||||
ui.bar(128,
|
||||
92,
|
||||
changed=does_nothing,
|
||||
style=style.prefs_volume_slider)
|
||||
|
||||
layout.button(_(u"Test"), "soundtest", clicked=does_nothing)
|
||||
|
||||
ui.close()
|
||||
ui.close()
|
||||
|
||||
ui.close() # vbox
|
||||
|
||||
|
||||
# Used to have buttons not do anything.
|
||||
def does_nothing(*args):
|
||||
return
|
||||
|
||||
|
||||
label choose_theme:
|
||||
|
||||
python:
|
||||
if not os.path.exists(os.path.join(project.gamedir, "options.rpy")):
|
||||
error(_(u"The options.rpy file does not exist in the game directory, so this launcher cannot change the theme."))
|
||||
|
||||
current_theme = None
|
||||
theme_adjustment = ui.adjustment()
|
||||
|
||||
label repeat_choose_theme:
|
||||
|
||||
python hide:
|
||||
|
||||
tip = _(u"Themes control the basic look of interface elements. You'll be able to pick a color scheme next.")
|
||||
|
||||
screen()
|
||||
ui.vbox()
|
||||
title(_(u"Choose Theme"))
|
||||
|
||||
ui.grid(2, 1, padding=10, xfill=True)
|
||||
|
||||
# The scroll area, that lets the user pick a theme.
|
||||
scrolled('top', theme_adjustment)
|
||||
ui.vbox()
|
||||
|
||||
for name, function, exemplar in themes:
|
||||
button(name,
|
||||
ui.returns(function),
|
||||
"",
|
||||
hovered=curried_show_theme(exemplar, "repeat_choose_theme"),
|
||||
unhovered=does_nothing)
|
||||
|
||||
ui.close() # vbox
|
||||
ui.close() # scrolled
|
||||
|
||||
theme_demo()
|
||||
|
||||
ui.close() # grid
|
||||
ui.close() # vbox
|
||||
|
||||
set_tooltip(tip)
|
||||
store.theme_function = interact()
|
||||
|
||||
|
||||
label choose_color_scheme:
|
||||
|
||||
python:
|
||||
|
||||
current_theme = None
|
||||
theme_adjustment = ui.adjustment()
|
||||
|
||||
label repeat_choose_color_scheme:
|
||||
|
||||
python hide:
|
||||
|
||||
tip = _(u"Please choose a color scheme for your project.")
|
||||
|
||||
themes = [ k for k,v in theme_data.iteritems() if v["theme"] == theme_function ]
|
||||
themes.sort()
|
||||
|
||||
screen()
|
||||
ui.vbox()
|
||||
title(_(u"Choose Color Scheme"))
|
||||
|
||||
ui.grid(2, 1, padding=10, xfill=True)
|
||||
|
||||
# The scroll area, that lets the user pick a theme.
|
||||
scrolled('choose_theme', theme_adjustment)
|
||||
ui.vbox()
|
||||
|
||||
for i in themes:
|
||||
button(i,
|
||||
curried_switch_theme(i),
|
||||
"",
|
||||
hovered=curried_show_theme(i, "repeat_choose_color_scheme"),
|
||||
unhovered=does_nothing)
|
||||
|
||||
ui.close() # vbox
|
||||
ui.close() # scrolled
|
||||
|
||||
theme_demo()
|
||||
|
||||
ui.close() # grid
|
||||
ui.close() # vbox
|
||||
|
||||
set_tooltip(tip)
|
||||
interact()
|
||||
|
||||
|
||||
@@ -1,29 +1,162 @@
|
||||
# This file contains logic for detecting an editor, and for selecting
|
||||
# the default editor.
|
||||
# This file contains logic for selecting an editor.
|
||||
|
||||
init:
|
||||
python hide:
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
init python:
|
||||
|
||||
if not config.editor:
|
||||
import glob
|
||||
import re
|
||||
import traceback
|
||||
import os
|
||||
import os.path
|
||||
|
||||
|
||||
# The default name for the editor.
|
||||
if persistent.editor is None:
|
||||
persistent.editor = "jEdit"
|
||||
|
||||
# A map from editor name to the file containing information about
|
||||
# that editor.
|
||||
editors = { }
|
||||
|
||||
editor = os.path.normpath(config.renpy_base + "/jedit/jedit.jar")
|
||||
# A map from editor to the version of that editor.
|
||||
editor_versions = { }
|
||||
|
||||
if os.path.exists(editor):
|
||||
# A map from editor to a description of that editor.
|
||||
editor_descriptions = { }
|
||||
|
||||
# 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
|
||||
|
||||
editor = renpy.shell_escape(editor)
|
||||
if set_editor and not set_editor_transient:
|
||||
config.editor_transient = config.editor
|
||||
os.environ['RENPY_EDITOR_TRANSIENT'] = config.editor
|
||||
set_editor_transient = False
|
||||
|
||||
if sys.platform == 'win32':
|
||||
config.editor = 'javaw.exe -jar "' + editor + '" -reuseview "%(filename)s" +line:%(line)d "%(otherfiles)s"'
|
||||
config.editor_transient = 'javaw.exe -jar "' + editor + '" -newplainview "%(filename)s" +line:%(line)d "%(otherfiles)s"'
|
||||
else:
|
||||
config.editor = 'java -jar "' + editor + '" -reuseview "%(filename)s" +line:%(line)d "%(otherfiles)s"'
|
||||
config.editor_transient = 'java -jar "' + editor + '" -newplainview "%(filename)s" +line:%(line)d "%(otherfiles)s"'
|
||||
def scan_editor(ef):
|
||||
"""
|
||||
Scans a single editor file to get the meta-information. If it
|
||||
checks out, adds it to editors. Uses editor_versions as a cache
|
||||
so we only add the newest version of each editor.
|
||||
"""
|
||||
|
||||
info = { }
|
||||
|
||||
f = file(ef, "r")
|
||||
for l in f:
|
||||
m = re.match("#\s*(\w+):\s*(.*?)\s*$", l)
|
||||
if not m:
|
||||
break
|
||||
|
||||
info[m.group(1)] = m.group(2)
|
||||
|
||||
f.close()
|
||||
|
||||
if config.editor:
|
||||
os.environ['RENPY_EDITOR'] = config.editor
|
||||
if config.editor_transient:
|
||||
os.environ['RENPY_EDITOR_TRANSIENT'] = config.editor_transient
|
||||
|
||||
try:
|
||||
name = info["Name"]
|
||||
version = int(info["Version"])
|
||||
description = info.get("Description", "")
|
||||
except:
|
||||
traceback.print_exc()
|
||||
print >>sys.stderr, ef
|
||||
|
||||
|
||||
if version > editor_versions.get(name, -1):
|
||||
editors[name] = ef
|
||||
editor_versions[name] = version
|
||||
editor_descriptions[name] = description
|
||||
|
||||
|
||||
def scan_editors():
|
||||
"""
|
||||
Finds all *.editor.py files, and uses them to populate the list
|
||||
of editors.
|
||||
"""
|
||||
|
||||
editors.clear()
|
||||
editor_versions.clear()
|
||||
editor_descriptions.clear()
|
||||
|
||||
for d in [ config.renpy_base, persistent.projects_directory ]:
|
||||
if d is None:
|
||||
continue
|
||||
|
||||
for ef in glob.glob(d + "/*/*.editor.py"):
|
||||
scan_editor(ef)
|
||||
|
||||
|
||||
def setup_editor():
|
||||
"""
|
||||
Sets the system up to respect the value containined in
|
||||
persistent.editor.
|
||||
"""
|
||||
|
||||
if not set_editor:
|
||||
return
|
||||
|
||||
ef = None
|
||||
|
||||
for i in [ persistent.editor, "jEdit", "None" ]:
|
||||
if i in editors:
|
||||
ef = editors[i]
|
||||
break
|
||||
else:
|
||||
return
|
||||
|
||||
ctx = {
|
||||
"renpy" : renpy,
|
||||
"config" : config,
|
||||
"persistent" : persistent,
|
||||
"base" : os.path.dirname(ef),
|
||||
}
|
||||
|
||||
execfile(ef, ctx, ctx)
|
||||
|
||||
if set_editor:
|
||||
if config.editor:
|
||||
os.environ['RENPY_EDITOR'] = config.editor
|
||||
else:
|
||||
if 'RENPY_EDITOR' in os.environ:
|
||||
del os.environ['RENPY_EDITOR']
|
||||
|
||||
if set_editor_transient:
|
||||
if config.editor_transient:
|
||||
os.environ['RENPY_EDITOR_TRANSIENT'] = config.editor_transient
|
||||
else:
|
||||
if 'RENPY_EDITOR_TRANSIENT' in os.environ:
|
||||
del os.environ['RENPY_EDITOR_TRANSIENT']
|
||||
|
||||
label editor:
|
||||
|
||||
python hide:
|
||||
|
||||
if not set_editor:
|
||||
error(_(u"The editor has been set from the RENPY_EDITOR environment variable, and cannot be changed."), "options")
|
||||
|
||||
set_tooltip("")
|
||||
|
||||
screen()
|
||||
ui.vbox()
|
||||
title(_(u"Choose Editor"))
|
||||
|
||||
text(_(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}."))
|
||||
|
||||
ui.null(height=15)
|
||||
|
||||
scrolled("options")
|
||||
|
||||
ui.vbox()
|
||||
|
||||
for i in sorted(editors, key=lambda a : a.lower()):
|
||||
button(i,
|
||||
ui.returns(i),
|
||||
editor_descriptions[i])
|
||||
|
||||
ui.close() # Vbox
|
||||
ui.close() # Scrolled
|
||||
|
||||
ui.close() # Vbox
|
||||
|
||||
persistent.editor = interact()
|
||||
setup_editor()
|
||||
|
||||
jump options
|
||||
|
||||
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 7.7 KiB |
@@ -0,0 +1,345 @@
|
||||
# This file contains the various components of the launcher interface.
|
||||
|
||||
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.
|
||||
def customize_styles():
|
||||
style.window.yminimum = 60
|
||||
style.window.left_padding = 60
|
||||
|
||||
style.hyperlink_text.color = "#03c"
|
||||
style.hyperlink_text.hover_color = "#00c"
|
||||
style.hyperlink_text.size = 15
|
||||
style.hyperlink_text.underline = False
|
||||
|
||||
customize_styles()
|
||||
|
||||
tooltip = _(u"Welcome!")
|
||||
|
||||
def show_tooltip(st, at):
|
||||
return Text(tooltip, color="#fff", size=14), None
|
||||
|
||||
def set_tooltip(s):
|
||||
global tooltip
|
||||
|
||||
if tooltip != s:
|
||||
tooltip = s
|
||||
renpy.restart_interaction()
|
||||
|
||||
tooltips = renpy.curry(set_tooltip)
|
||||
|
||||
def unset_tooltip(s):
|
||||
global tooltip
|
||||
|
||||
if s and tooltip == s:
|
||||
tooltip = ""
|
||||
renpy.restart_interaction()
|
||||
|
||||
untooltips = renpy.curry(unset_tooltip)
|
||||
|
||||
|
||||
def screen():
|
||||
"""
|
||||
Display a screen. This should be called before any code that
|
||||
draws to the screen.
|
||||
"""
|
||||
|
||||
ui.add(Solid("#fff"))
|
||||
|
||||
ui.window(yalign=1.0)
|
||||
ui.add(DynamicDisplayable(show_tooltip))
|
||||
|
||||
ui.image("eileen_small.png", xalign=0.0, yalign=1.0)
|
||||
|
||||
ui.window(xmargin=20, top_margin=4, bottom_margin=85, style='default')
|
||||
|
||||
def interact():
|
||||
"""
|
||||
Closes the screen, and causes an interaction to occur.
|
||||
"""
|
||||
|
||||
return ui.interact(suppress_overlay=True, suppress_underlay=True)
|
||||
|
||||
def title(s):
|
||||
"""
|
||||
Display a title on the screen.
|
||||
"""
|
||||
|
||||
ui.window(style="default", bottom_margin=4, top_margin=12)
|
||||
ui.text(s, style="launcher_title")
|
||||
|
||||
def text(s):
|
||||
"""
|
||||
Display text on the screen.
|
||||
"""
|
||||
|
||||
ui.text(s, style="launcher_text")
|
||||
|
||||
def button(s, clicked=None, subtitle="", hovered=None, unhovered=None):
|
||||
"""
|
||||
Displays a button with caption `s`.
|
||||
"""
|
||||
|
||||
if subtitle is not None:
|
||||
if hovered is None:
|
||||
hovered = tooltips(subtitle)
|
||||
|
||||
if unhovered is None:
|
||||
unhovered = untooltips(subtitle)
|
||||
|
||||
ui.button(style="default", clicked=clicked,
|
||||
hovered=hovered, unhovered=unhovered,
|
||||
top_padding=3, bottom_padding=3)
|
||||
|
||||
ui.text(s, style="launcher_button_text")
|
||||
|
||||
def small_button(s, clicked=None, subtitle="", hovered=None, unhovered=None):
|
||||
"""
|
||||
Displays a button with caption `s`.
|
||||
"""
|
||||
|
||||
if hovered is None:
|
||||
hovered = tooltips(subtitle)
|
||||
|
||||
if unhovered is None:
|
||||
unhovered = untooltips(subtitle)
|
||||
|
||||
ui.button(style="default", clicked=clicked,
|
||||
hovered=hovered, unhovered=unhovered,
|
||||
top_padding=0, bottom_padding=0)
|
||||
|
||||
ui.text(s, style="launcher_small_button_text")
|
||||
|
||||
def toggle_button(s, checked, clicked=None, subtitle=""):
|
||||
"""
|
||||
Displays a button with caption `s`.
|
||||
"""
|
||||
|
||||
hovered = tooltips(subtitle)
|
||||
unhovered = untooltips(subtitle)
|
||||
|
||||
if checked:
|
||||
s = u"{font=DejaVuSans.ttf}\u25a3{/font} " + s
|
||||
else:
|
||||
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="launcher_small_button_text")
|
||||
|
||||
def scrolled(cancel, yadj=None):
|
||||
|
||||
if yadj is None:
|
||||
yadj = ui.adjustment()
|
||||
|
||||
ui.side(['r', 'b', 'c'])
|
||||
|
||||
ui.bar(adjustment=yadj, style='lscrollbar')
|
||||
|
||||
if cancel:
|
||||
ui.vbox()
|
||||
ui.null(height=12)
|
||||
button(_(u"Cancel"), clicked=ui.jumps(cancel))
|
||||
ui.close()
|
||||
else:
|
||||
ui.null()
|
||||
|
||||
ui.viewport(yadjustment=yadj, mousewheel=True)
|
||||
|
||||
# Left up to the user to close.
|
||||
|
||||
def error(message, target="top"):
|
||||
"""
|
||||
Displays an error to the user, and lets him click to return to
|
||||
`target`.
|
||||
"""
|
||||
|
||||
set_tooltip("")
|
||||
|
||||
screen()
|
||||
|
||||
ui.vbox()
|
||||
title(_(u"Error"))
|
||||
text(message)
|
||||
|
||||
ui.null(height=20)
|
||||
|
||||
if target is None:
|
||||
clicked = ui.returns(True)
|
||||
else:
|
||||
clicked = ui.jumps(target)
|
||||
|
||||
button(_(u"Return"), clicked, None)
|
||||
ui.close()
|
||||
|
||||
interact()
|
||||
|
||||
def info(t, message):
|
||||
"""
|
||||
Displays an informational message to the user, and immediately
|
||||
returns.
|
||||
"""
|
||||
|
||||
ui.pausebehavior(0)
|
||||
|
||||
screen()
|
||||
|
||||
ui.vbox()
|
||||
title(t)
|
||||
text(message)
|
||||
ui.close()
|
||||
|
||||
interact()
|
||||
|
||||
def yesno(t, message):
|
||||
"""
|
||||
Asks a yes/no question of the user.
|
||||
"""
|
||||
|
||||
set_tooltip("")
|
||||
|
||||
screen()
|
||||
|
||||
ui.vbox()
|
||||
title(t)
|
||||
text(message)
|
||||
button(_(u"Yes"), ui.returns(True), "")
|
||||
button(_(u"No"), ui.returns(False), "")
|
||||
ui.close()
|
||||
|
||||
return interact()
|
||||
|
||||
def text_variable(t, value, returns, tooltip=""):
|
||||
|
||||
text(t)
|
||||
small_button(value, ui.returns(returns), tooltip)
|
||||
ui.null(height=5)
|
||||
|
||||
def input(t, prompt, value, cancel=None):
|
||||
|
||||
set_tooltip(_(u"Press enter when done."))
|
||||
|
||||
while True:
|
||||
|
||||
screen()
|
||||
ui.vbox()
|
||||
|
||||
title(t)
|
||||
text(prompt)
|
||||
ui.null(height=10)
|
||||
ui.input(value, size=20, color="#00c")
|
||||
|
||||
if cancel is not None:
|
||||
ui.null(height=20)
|
||||
button(_(u"Cancel"), ui.jumps(cancel), "")
|
||||
|
||||
ui.close()
|
||||
|
||||
value = interact()
|
||||
value = value.strip()
|
||||
|
||||
if not value:
|
||||
error(
|
||||
_(u"The string cannot be empty. Please enter some text."),
|
||||
None)
|
||||
|
||||
continue
|
||||
|
||||
try:
|
||||
value = value.encode("ascii")
|
||||
except:
|
||||
error(
|
||||
_(u"Non-ASCII filenames are not allowed. This is because Zip files cannot reliably represent non-ASCII filenames."),
|
||||
None)
|
||||
|
||||
continue
|
||||
|
||||
break
|
||||
|
||||
return value
|
||||
|
||||
# The time progress was last updated. We only update the progress
|
||||
# every 10th of a second, so that we don't waste time doing
|
||||
# such updates.
|
||||
progress_time = 0
|
||||
|
||||
|
||||
def progress(what, limit, amount):
|
||||
"""
|
||||
Show progress to the user.
|
||||
"""
|
||||
|
||||
global progress_time
|
||||
|
||||
t = time.time()
|
||||
if t < progress_time + .1:
|
||||
return
|
||||
|
||||
progress_time = t
|
||||
|
||||
set_tooltip(_(u"Processed %d of %d files.") % (amount + 1, limit))
|
||||
|
||||
ui.pausebehavior(0)
|
||||
|
||||
screen()
|
||||
|
||||
ui.vbox(xfill=True)
|
||||
|
||||
title(what)
|
||||
ui.null(height=20)
|
||||
ui.bar(limit, amount, xmaximum=300, xalign=0.5, style='lbar')
|
||||
|
||||
ui.close()
|
||||
interact()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
# Name: jEdit
|
||||
# Version: 1
|
||||
# Description: jEdit requires Java be installed on your computer.
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
|
||||
editor = os.path.normpath(base + "/../jedit/jedit.jar")
|
||||
editor = renpy.shell_escape(editor)
|
||||
|
||||
if sys.platform == 'win32':
|
||||
config.editor = 'javaw.exe -jar "' + editor + '" -reuseview "%(filename)s" +line:%(line)d "%(otherfiles)s"'
|
||||
config.editor_transient = 'javaw.exe -jar "' + editor + '" -newplainview "%(filename)s" +line:%(line)d "%(otherfiles)s"'
|
||||
else:
|
||||
config.editor = 'java -jar "' + editor + '" -reuseview "%(filename)s" +line:%(line)d "%(otherfiles)s"'
|
||||
config.editor_transient = 'java -jar "' + editor + '" -newplainview "%(filename)s" +line:%(line)d "%(otherfiles)s"'
|
||||
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
@@ -1,167 +1,52 @@
|
||||
label new:
|
||||
init python:
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import shutil
|
||||
|
||||
label new_project:
|
||||
|
||||
if persistent.projects_directory is None:
|
||||
call choose_projects_directory
|
||||
|
||||
python hide:
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import time
|
||||
|
||||
name = input(
|
||||
_(u"New Project"),
|
||||
_(u"Please type the name of your new project."),
|
||||
"", cancel='top')
|
||||
|
||||
# Select a template.
|
||||
|
||||
choices = [ (p.name, p.info["description"], p, None, False) for p in projects if p.info.get("template", None)]
|
||||
|
||||
template = paged_menu(u"Select a Template", choices, u"Please select a project to use as a template for your project.")
|
||||
|
||||
# Choose project name.
|
||||
|
||||
name = prompt(u"Project Name", u"Type the name of your new project, and press enter.\n", "main")
|
||||
name = name.strip()
|
||||
|
||||
error = None
|
||||
path = os.path.join(persistent.projects_directory, name)
|
||||
|
||||
if not name:
|
||||
error = u"Please enter a non-empty project name."
|
||||
elif os.path.exists(name):
|
||||
error = u"A file or directory named '%s' already exists." % name
|
||||
else:
|
||||
try:
|
||||
name = name.encode("ascii")
|
||||
except:
|
||||
error = u"Project names must be ASCII. This is because the ZIP file format does not support non-ASCII characters in a uniform way."
|
||||
|
||||
if error:
|
||||
store.error(u"Error", error, "main")
|
||||
|
||||
# Tell the user we're creating the project.
|
||||
title(u"Creating Project")
|
||||
store.message = u"Please wait while we create the project."
|
||||
ui.pausebehavior(0)
|
||||
interact()
|
||||
|
||||
# Here is where we actually create the project.
|
||||
|
||||
import shutil
|
||||
|
||||
shutil.copytree(template.path, name)
|
||||
|
||||
unlink = template.info.get("unlink", [ ])
|
||||
unlink += [ 'launcherinfo.py' ]
|
||||
set_tooltip("")
|
||||
|
||||
for i in unlink:
|
||||
if os.path.exists(name + "/" + i):
|
||||
os.unlink(name + "/" + i)
|
||||
if os.path.exists(path):
|
||||
error(_(u"Something with that name already exists in the projects directory."))
|
||||
|
||||
info(_(u"Creating Project"),
|
||||
_(u"Please wait while we create the project."))
|
||||
|
||||
for dir, dirs, files in os.walk(name):
|
||||
for d in list(dirs):
|
||||
if d.startswith("."):
|
||||
dirs.remove(d)
|
||||
dn = dir + "/" + d
|
||||
shutil.rmtree(dn, True)
|
||||
|
||||
# Change the save directory.
|
||||
options = file(name + "/game/options.rpy").read()
|
||||
save_dir = "%s-%d" % (name, time.time())
|
||||
options = options.replace("template-1220804310", save_dir)
|
||||
file(name + "/game/options.rpy", "w").write(options)
|
||||
|
||||
persistent.project = name
|
||||
|
||||
call find_project from _call_find_project_2
|
||||
|
||||
label choose_theme:
|
||||
|
||||
python hide:
|
||||
|
||||
# Select a color scheme.
|
||||
|
||||
themes = theme_data.keys()
|
||||
themes.sort()
|
||||
|
||||
choices = [ ]
|
||||
for i in themes:
|
||||
|
||||
def hovered(i=i):
|
||||
td = theme_data[i].copy()
|
||||
engine = td["theme"]
|
||||
del td["theme"]
|
||||
|
||||
if engine == "roundrect":
|
||||
renpy.style.restore(style_backup)
|
||||
theme.roundrect(launcher=True, **td)
|
||||
renpy.style.rebuild()
|
||||
return ("repeat", 0)
|
||||
|
||||
choices.append((i, None, i, hovered, False))
|
||||
|
||||
color_theme = paged_menu(u"Select a Theme", choices, u"Please select a color theme for your project. You can always change the colors later.", cancel='color_theme_cancel')
|
||||
|
||||
# Restore default theme.
|
||||
renpy.style.restore(style_backup)
|
||||
theme.roundrect(launcher=True)
|
||||
renpy.style.rebuild()
|
||||
|
||||
ofn = project.path + "/game/options.rpy"
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
if not os.path.exists(ofn):
|
||||
error(u"Changing Theme", u"The options file does not seem to exist.", "main")
|
||||
|
||||
inf = file(ofn, "rU")
|
||||
outf = file(ofn + ".new", "w")
|
||||
|
||||
td = theme_data[color_theme]
|
||||
|
||||
# TODO: Make this less specific to roundrect. Need to figure out
|
||||
# how to switch themes, rather than just recolor them.
|
||||
|
||||
changing = False
|
||||
changed = False
|
||||
|
||||
for l in inf:
|
||||
|
||||
if re.match(r'\s*theme.roundrect\(', l):
|
||||
changing = True
|
||||
changed = True
|
||||
elif re.match(r'\s*\)', l):
|
||||
changing = False
|
||||
elif changing:
|
||||
|
||||
def repl(m, td=td):
|
||||
return m.group(1) + m.group(2) + " = \"" + td.get(m.group(2), m.group(3)) + "\","
|
||||
|
||||
l = re.sub(r'^(\s*)(\w+) = "([\da-fA-F#]+)",', repl, l)
|
||||
|
||||
outf.write(l)
|
||||
|
||||
outf.close()
|
||||
inf.close()
|
||||
template = os.path.join(config.renpy_base, "template")
|
||||
|
||||
try:
|
||||
os.rename(ofn + ".new", ofn)
|
||||
except:
|
||||
shutil.copytree(template, path)
|
||||
except OSError, e:
|
||||
error(_(u"Could not create the project directory. The error was: %s") % unicode(e))
|
||||
|
||||
# I hate windows.
|
||||
os.rename(ofn, ofn + ".old")
|
||||
os.rename(ofn + ".new", ofn)
|
||||
os.unlink(ofn + ".old")
|
||||
|
||||
if not changed:
|
||||
error(u"Changing Theme", u"Could not modify options.rpy, perhaps it was edited too much.", "main")
|
||||
|
||||
jump main
|
||||
|
||||
launcherinfo = os.path.join(path, "launcherinfo.py")
|
||||
if os.path.exists(launcherinfo):
|
||||
os.unlink(launcherinfo)
|
||||
|
||||
# Change the save directory.
|
||||
options = file(path + "/game/options.rpy").read()
|
||||
save_dir = "%s-%d" % (name, time.time())
|
||||
options = options.replace("template-1220804310", save_dir)
|
||||
file(path + "/game/options.rpy", "w").write(options)
|
||||
|
||||
label color_theme_cancel:
|
||||
p = Project(path)
|
||||
p.select()
|
||||
|
||||
python hide:
|
||||
jump choose_theme
|
||||
|
||||
# Restore default theme.
|
||||
renpy.style.restore(style_backup)
|
||||
theme.roundrect(launcher=True)
|
||||
renpy.style.rebuild()
|
||||
|
||||
jump main
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
## This file contains some of the options that can be changed to customize
|
||||
## your Ren'Py game. It only contains the most common options... there
|
||||
## is quite a bit more customization you can do.
|
||||
##
|
||||
## Lines beginning with two '#' marks are comments, and you shouldn't
|
||||
## uncomment them. Lines beginning with a single '#' mark are
|
||||
## commented-out code, and you may want to uncomment them when
|
||||
## appropriate.
|
||||
|
||||
init -1 python hide:
|
||||
|
||||
## Should we enable the use of developer tools? This should be
|
||||
## set to False before the game is released, so the user can't
|
||||
## cheat using developer tools.
|
||||
|
||||
config.developer = True
|
||||
|
||||
## These control the width and height of the screen.
|
||||
|
||||
config.screen_width = 540
|
||||
config.screen_height = 440
|
||||
|
||||
## This controls the title of the window, when Ren'Py is
|
||||
## running in a window.
|
||||
|
||||
config.window_title = _(u"%s Launcher") % renpy.version()
|
||||
|
||||
#########################################
|
||||
# Themes
|
||||
|
||||
## We then want to call a theme function. themes.roundrect is
|
||||
## a theme that features the use of rounded rectangles. It's
|
||||
## the only theme we currently support.
|
||||
##
|
||||
## The theme function takes a number of parameters that can
|
||||
## customize the color scheme.
|
||||
|
||||
theme.roundrect(
|
||||
|
||||
## The color of an idle widget face.
|
||||
widget = "#003c78",
|
||||
|
||||
## The color of a focused widget face.
|
||||
widget_hover = "#0050a0",
|
||||
|
||||
## The color of the text in a widget.
|
||||
widget_text = "#c8ffff",
|
||||
|
||||
## The color of the text in a selected widget. (For
|
||||
## example, the current value of a preference.)
|
||||
widget_selected = "#ffffc8",
|
||||
|
||||
## The color of a disabled widget face.
|
||||
disabled = "#404040",
|
||||
|
||||
## The color of disabled widget text.
|
||||
disabled_text = "#c8c8c8",
|
||||
|
||||
## The color of informational labels.
|
||||
label = "#ffffff",
|
||||
|
||||
## The color of a frame containing widgets.
|
||||
frame = "#6496c8",
|
||||
|
||||
## If this is True, the in-game window is rounded. If False,
|
||||
## the in-game window is square.
|
||||
rounded_window = False,
|
||||
|
||||
## The background of the main menu. This can be a color
|
||||
## beginning with '#', or an image filename. The latter
|
||||
## should take up the full height and width of the screen.
|
||||
mm_root = "#dcebff",
|
||||
|
||||
## The background of the game menu. This can be a color
|
||||
## beginning with '#', or an image filename. The latter
|
||||
## should take up the full height and width of the screen.
|
||||
gm_root = "#dcebff",
|
||||
|
||||
## And we're done with the theme. The theme will customize
|
||||
## various styles, so if we want to change them, we should
|
||||
## do so below.
|
||||
)
|
||||
|
||||
theme.outline_bars(
|
||||
inside="#6496c8",
|
||||
idle="#06c",
|
||||
hover="#00c")
|
||||
|
||||
# Copy the bar styles used by the launcher, so the theme
|
||||
# selector can't change them.
|
||||
style.lbar = Style(style.default)
|
||||
style.lbar.take(style.bar)
|
||||
style.lscrollbar = Style(style.default)
|
||||
style.lscrollbar.take(style.vscrollbar)
|
||||
|
||||
#########################################
|
||||
## These settings let you change some of the sounds that are used by
|
||||
## Ren'Py.
|
||||
|
||||
## Set this to False if the game does not have any sound effects.
|
||||
config.sound = False
|
||||
|
||||
python early:
|
||||
config.save_directory = "launcher-2"
|
||||
|
||||
init -1 python hide:
|
||||
#########################################
|
||||
## Default values of Preferences.
|
||||
|
||||
## Note: These options are only evaluated the first time a
|
||||
## game is run. To have them run a second time, delete
|
||||
## game/saves/persistent
|
||||
|
||||
## Should we start in fullscreen mode?
|
||||
|
||||
config.default_fullscreen = False
|
||||
|
||||
## The default text speed in characters per second. 0 is infinite.
|
||||
|
||||
config.default_text_cps = 0
|
||||
|
||||
#########################################
|
||||
## More customizations can go here.
|
||||
|
||||
config.has_autosave = False
|
||||
|
||||
config.window_icon = "logo.png"
|
||||
config.windows_icon = "logo32.png"
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
# This file handles the launcher options screen.
|
||||
|
||||
label options:
|
||||
|
||||
python hide:
|
||||
|
||||
screen()
|
||||
ui.vbox()
|
||||
|
||||
title(_(u"Launcher Options"))
|
||||
|
||||
editor = persistent.editor
|
||||
if not set_editor:
|
||||
editor = _(u"Using RENPY_EDITOR")
|
||||
|
||||
text_variable(_("Text Editor"), editor, "editor",
|
||||
_(u"Change the default text editor."))
|
||||
|
||||
ui.null(height=15)
|
||||
|
||||
button(_(u"Projects Directory"),
|
||||
ui.jumps("options_cpd"),
|
||||
_(u"Select the directory Ren'Py searches for projects."))
|
||||
|
||||
ui.null(height=15)
|
||||
|
||||
button(_(u"Return"), ui.jumps("top"), "")
|
||||
|
||||
ui.close()
|
||||
|
||||
act = interact()
|
||||
|
||||
if act == "editor":
|
||||
renpy.jump("editor")
|
||||
|
||||
|
||||
jump options
|
||||
|
||||
label options_cpd:
|
||||
call choose_projects_directory
|
||||
jump options
|
||||
|
||||
@@ -0,0 +1,453 @@
|
||||
"""Common operations on Posix pathnames.
|
||||
|
||||
Instead of importing this module directly, import os and refer to
|
||||
this module as os.path. The "os.path" name is an alias for this
|
||||
module on Posix systems; on other systems (e.g. Mac, Windows),
|
||||
os.path provides the same operations in a manner specific to that
|
||||
platform, and is an alias to another module (e.g. macpath, ntpath).
|
||||
|
||||
Some of this can actually be useful on non-Posix systems too, e.g.
|
||||
for manipulation of the pathname component of URLs.
|
||||
"""
|
||||
|
||||
import os
|
||||
import stat
|
||||
|
||||
__all__ = ["normcase","isabs","join","splitdrive","split","splitext",
|
||||
"basename","dirname","commonprefix","getsize","getmtime",
|
||||
"getatime","getctime","islink","exists","lexists","isdir","isfile",
|
||||
"ismount","walk","expanduser","expandvars","normpath","abspath",
|
||||
"samefile","sameopenfile","samestat",
|
||||
"curdir","pardir","sep","pathsep","defpath","altsep","extsep",
|
||||
"devnull","realpath","supports_unicode_filenames"]
|
||||
|
||||
# strings representing various path-related bits and pieces
|
||||
curdir = '.'
|
||||
pardir = '..'
|
||||
extsep = '.'
|
||||
sep = '/'
|
||||
pathsep = ':'
|
||||
defpath = ':/bin:/usr/bin'
|
||||
altsep = None
|
||||
devnull = '/dev/null'
|
||||
|
||||
# Normalize the case of a pathname. Trivial in Posix, string.lower on Mac.
|
||||
# On MS-DOS this may also turn slashes into backslashes; however, other
|
||||
# normalizations (such as optimizing '../' away) are not allowed
|
||||
# (another function should be defined to do that).
|
||||
|
||||
def normcase(s):
|
||||
"""Normalize case of pathname. Has no effect under Posix"""
|
||||
return s
|
||||
|
||||
|
||||
# Return whether a path is absolute.
|
||||
# Trivial in Posix, harder on the Mac or MS-DOS.
|
||||
|
||||
def isabs(s):
|
||||
"""Test whether a path is absolute"""
|
||||
return s.startswith('/')
|
||||
|
||||
|
||||
# Join pathnames.
|
||||
# Ignore the previous parts if a part is absolute.
|
||||
# Insert a '/' unless the first part is empty or already ends in '/'.
|
||||
|
||||
def join(a, *p):
|
||||
"""Join two or more pathname components, inserting '/' as needed"""
|
||||
path = a
|
||||
for b in p:
|
||||
if b.startswith('/'):
|
||||
path = b
|
||||
elif path == '' or path.endswith('/'):
|
||||
path += b
|
||||
else:
|
||||
path += '/' + b
|
||||
return path
|
||||
|
||||
|
||||
# Split a path in head (everything up to the last '/') and tail (the
|
||||
# rest). If the path ends in '/', tail will be empty. If there is no
|
||||
# '/' in the path, head will be empty.
|
||||
# Trailing '/'es are stripped from head unless it is the root.
|
||||
|
||||
def split(p):
|
||||
"""Split a pathname. Returns tuple "(head, tail)" where "tail" is
|
||||
everything after the final slash. Either part may be empty."""
|
||||
i = p.rfind('/') + 1
|
||||
head, tail = p[:i], p[i:]
|
||||
if head and head != '/'*len(head):
|
||||
head = head.rstrip('/')
|
||||
return head, tail
|
||||
|
||||
|
||||
# Split a path in root and extension.
|
||||
# The extension is everything starting at the last dot in the last
|
||||
# pathname component; the root is everything before that.
|
||||
# It is always true that root + ext == p.
|
||||
|
||||
def splitext(p):
|
||||
"""Split the extension from a pathname. Extension is everything from the
|
||||
last dot to the end. Returns "(root, ext)", either part may be empty."""
|
||||
i = p.rfind('.')
|
||||
if i<=p.rfind('/'):
|
||||
return p, ''
|
||||
else:
|
||||
return p[:i], p[i:]
|
||||
|
||||
|
||||
# Split a pathname into a drive specification and the rest of the
|
||||
# path. Useful on DOS/Windows/NT; on Unix, the drive is always empty.
|
||||
|
||||
def splitdrive(p):
|
||||
"""Split a pathname into drive and path. On Posix, drive is always
|
||||
empty."""
|
||||
return '', p
|
||||
|
||||
|
||||
# Return the tail (basename) part of a path.
|
||||
|
||||
def basename(p):
|
||||
"""Returns the final component of a pathname"""
|
||||
return split(p)[1]
|
||||
|
||||
|
||||
# Return the head (dirname) part of a path.
|
||||
|
||||
def dirname(p):
|
||||
"""Returns the directory component of a pathname"""
|
||||
return split(p)[0]
|
||||
|
||||
|
||||
# Return the longest prefix of all list elements.
|
||||
|
||||
def commonprefix(m):
|
||||
"Given a list of pathnames, returns the longest common leading component"
|
||||
if not m: return ''
|
||||
s1 = min(m)
|
||||
s2 = max(m)
|
||||
n = min(len(s1), len(s2))
|
||||
for i in xrange(n):
|
||||
if s1[i] != s2[i]:
|
||||
return s1[:i]
|
||||
return s1[:n]
|
||||
|
||||
# Get size, mtime, atime of files.
|
||||
|
||||
def getsize(filename):
|
||||
"""Return the size of a file, reported by os.stat()."""
|
||||
return os.stat(filename).st_size
|
||||
|
||||
def getmtime(filename):
|
||||
"""Return the last modification time of a file, reported by os.stat()."""
|
||||
return os.stat(filename).st_mtime
|
||||
|
||||
def getatime(filename):
|
||||
"""Return the last access time of a file, reported by os.stat()."""
|
||||
return os.stat(filename).st_atime
|
||||
|
||||
def getctime(filename):
|
||||
"""Return the metadata change time of a file, reported by os.stat()."""
|
||||
return os.stat(filename).st_ctime
|
||||
|
||||
# Is a path a symbolic link?
|
||||
# This will always return false on systems where os.lstat doesn't exist.
|
||||
|
||||
def islink(path):
|
||||
"""Test whether a path is a symbolic link"""
|
||||
try:
|
||||
st = os.lstat(path)
|
||||
except (os.error, AttributeError):
|
||||
return False
|
||||
return stat.S_ISLNK(st.st_mode)
|
||||
|
||||
|
||||
# Does a path exist?
|
||||
# This is false for dangling symbolic links.
|
||||
|
||||
def exists(path):
|
||||
"""Test whether a path exists. Returns False for broken symbolic links"""
|
||||
try:
|
||||
st = os.stat(path)
|
||||
except os.error:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
# Being true for dangling symbolic links is also useful.
|
||||
|
||||
def lexists(path):
|
||||
"""Test whether a path exists. Returns True for broken symbolic links"""
|
||||
try:
|
||||
st = os.lstat(path)
|
||||
except os.error:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
# Is a path a directory?
|
||||
# This follows symbolic links, so both islink() and isdir() can be true
|
||||
# for the same path.
|
||||
|
||||
def isdir(path):
|
||||
"""Test whether a path is a directory"""
|
||||
try:
|
||||
st = os.stat(path)
|
||||
except os.error:
|
||||
return False
|
||||
return stat.S_ISDIR(st.st_mode)
|
||||
|
||||
|
||||
# Is a path a regular file?
|
||||
# This follows symbolic links, so both islink() and isfile() can be true
|
||||
# for the same path.
|
||||
|
||||
def isfile(path):
|
||||
"""Test whether a path is a regular file"""
|
||||
try:
|
||||
st = os.stat(path)
|
||||
except os.error:
|
||||
return False
|
||||
return stat.S_ISREG(st.st_mode)
|
||||
|
||||
|
||||
# Are two filenames really pointing to the same file?
|
||||
|
||||
def samefile(f1, f2):
|
||||
"""Test whether two pathnames reference the same actual file"""
|
||||
s1 = os.stat(f1)
|
||||
s2 = os.stat(f2)
|
||||
return samestat(s1, s2)
|
||||
|
||||
|
||||
# Are two open files really referencing the same file?
|
||||
# (Not necessarily the same file descriptor!)
|
||||
|
||||
def sameopenfile(fp1, fp2):
|
||||
"""Test whether two open file objects reference the same file"""
|
||||
s1 = os.fstat(fp1)
|
||||
s2 = os.fstat(fp2)
|
||||
return samestat(s1, s2)
|
||||
|
||||
|
||||
# Are two stat buffers (obtained from stat, fstat or lstat)
|
||||
# describing the same file?
|
||||
|
||||
def samestat(s1, s2):
|
||||
"""Test whether two stat buffers reference the same file"""
|
||||
return s1.st_ino == s2.st_ino and \
|
||||
s1.st_dev == s2.st_dev
|
||||
|
||||
|
||||
# Is a path a mount point?
|
||||
# (Does this work for all UNIXes? Is it even guaranteed to work by Posix?)
|
||||
|
||||
def ismount(path):
|
||||
"""Test whether a path is a mount point"""
|
||||
try:
|
||||
s1 = os.lstat(path)
|
||||
s2 = os.lstat(join(path, '..'))
|
||||
except os.error:
|
||||
return False # It doesn't exist -- so not a mount point :-)
|
||||
dev1 = s1.st_dev
|
||||
dev2 = s2.st_dev
|
||||
if dev1 != dev2:
|
||||
return True # path/.. on a different device as path
|
||||
ino1 = s1.st_ino
|
||||
ino2 = s2.st_ino
|
||||
if ino1 == ino2:
|
||||
return True # path/.. is the same i-node as path
|
||||
return False
|
||||
|
||||
|
||||
# Directory tree walk.
|
||||
# For each directory under top (including top itself, but excluding
|
||||
# '.' and '..'), func(arg, dirname, filenames) is called, where
|
||||
# dirname is the name of the directory and filenames is the list
|
||||
# of files (and subdirectories etc.) in the directory.
|
||||
# The func may modify the filenames list, to implement a filter,
|
||||
# or to impose a different order of visiting.
|
||||
|
||||
def walk(top, func, arg):
|
||||
"""Directory tree walk with callback function.
|
||||
|
||||
For each directory in the directory tree rooted at top (including top
|
||||
itself, but excluding '.' and '..'), call func(arg, dirname, fnames).
|
||||
dirname is the name of the directory, and fnames a list of the names of
|
||||
the files and subdirectories in dirname (excluding '.' and '..'). func
|
||||
may modify the fnames list in-place (e.g. via del or slice assignment),
|
||||
and walk will only recurse into the subdirectories whose names remain in
|
||||
fnames; this can be used to implement a filter, or to impose a specific
|
||||
order of visiting. No semantics are defined for, or required of, arg,
|
||||
beyond that arg is always passed to func. It can be used, e.g., to pass
|
||||
a filename pattern, or a mutable object designed to accumulate
|
||||
statistics. Passing None for arg is common."""
|
||||
|
||||
try:
|
||||
names = os.listdir(top)
|
||||
except os.error:
|
||||
return
|
||||
func(arg, top, names)
|
||||
for name in names:
|
||||
name = join(top, name)
|
||||
try:
|
||||
st = os.lstat(name)
|
||||
except os.error:
|
||||
continue
|
||||
if stat.S_ISDIR(st.st_mode):
|
||||
walk(name, func, arg)
|
||||
|
||||
|
||||
# Expand paths beginning with '~' or '~user'.
|
||||
# '~' means $HOME; '~user' means that user's home directory.
|
||||
# If the path doesn't begin with '~', or if the user or $HOME is unknown,
|
||||
# the path is returned unchanged (leaving error reporting to whatever
|
||||
# function is called with the expanded path as argument).
|
||||
# See also module 'glob' for expansion of *, ? and [...] in pathnames.
|
||||
# (A function should also be defined to do full *sh-style environment
|
||||
# variable expansion.)
|
||||
|
||||
def expanduser(path):
|
||||
"""Expand ~ and ~user constructions. If user or $HOME is unknown,
|
||||
do nothing."""
|
||||
if not path.startswith('~'):
|
||||
return path
|
||||
i = path.find('/', 1)
|
||||
if i < 0:
|
||||
i = len(path)
|
||||
if i == 1:
|
||||
if 'HOME' not in os.environ:
|
||||
import pwd
|
||||
userhome = pwd.getpwuid(os.getuid()).pw_dir
|
||||
else:
|
||||
userhome = os.environ['HOME']
|
||||
else:
|
||||
import pwd
|
||||
try:
|
||||
pwent = pwd.getpwnam(path[1:i])
|
||||
except KeyError:
|
||||
return path
|
||||
userhome = pwent.pw_dir
|
||||
userhome = userhome.rstrip('/')
|
||||
return userhome + path[i:]
|
||||
|
||||
|
||||
# Expand paths containing shell variable substitutions.
|
||||
# This expands the forms $variable and ${variable} only.
|
||||
# Non-existent variables are left unchanged.
|
||||
|
||||
_varprog = None
|
||||
|
||||
def expandvars(path):
|
||||
"""Expand shell variables of form $var and ${var}. Unknown variables
|
||||
are left unchanged."""
|
||||
global _varprog
|
||||
if '$' not in path:
|
||||
return path
|
||||
if not _varprog:
|
||||
import re
|
||||
_varprog = re.compile(r'\$(\w+|\{[^}]*\})')
|
||||
i = 0
|
||||
while True:
|
||||
m = _varprog.search(path, i)
|
||||
if not m:
|
||||
break
|
||||
i, j = m.span(0)
|
||||
name = m.group(1)
|
||||
if name.startswith('{') and name.endswith('}'):
|
||||
name = name[1:-1]
|
||||
if name in os.environ:
|
||||
tail = path[j:]
|
||||
path = path[:i] + os.environ[name]
|
||||
i = len(path)
|
||||
path += tail
|
||||
else:
|
||||
i = j
|
||||
return path
|
||||
|
||||
|
||||
# Normalize a path, e.g. A//B, A/./B and A/foo/../B all become A/B.
|
||||
# It should be understood that this may change the meaning of the path
|
||||
# if it contains symbolic links!
|
||||
|
||||
def normpath(path):
|
||||
"""Normalize path, eliminating double slashes, etc."""
|
||||
if path == '':
|
||||
return '.'
|
||||
initial_slashes = path.startswith('/')
|
||||
# POSIX allows one or two initial slashes, but treats three or more
|
||||
# as single slash.
|
||||
if (initial_slashes and
|
||||
path.startswith('//') and not path.startswith('///')):
|
||||
initial_slashes = 2
|
||||
comps = path.split('/')
|
||||
new_comps = []
|
||||
for comp in comps:
|
||||
if comp in ('', '.'):
|
||||
continue
|
||||
if (comp != '..' or (not initial_slashes and not new_comps) or
|
||||
(new_comps and new_comps[-1] == '..')):
|
||||
new_comps.append(comp)
|
||||
elif new_comps:
|
||||
new_comps.pop()
|
||||
comps = new_comps
|
||||
path = '/'.join(comps)
|
||||
if initial_slashes:
|
||||
path = '/'*initial_slashes + path
|
||||
return path or '.'
|
||||
|
||||
|
||||
def abspath(path):
|
||||
"""Return an absolute path."""
|
||||
if not isabs(path):
|
||||
path = join(os.getcwd(), path)
|
||||
return normpath(path)
|
||||
|
||||
|
||||
# Return a canonical path (i.e. the absolute location of a file on the
|
||||
# filesystem).
|
||||
|
||||
def realpath(filename):
|
||||
"""Return the canonical path of the specified filename, eliminating any
|
||||
symbolic links encountered in the path."""
|
||||
if isabs(filename):
|
||||
bits = ['/'] + filename.split('/')[1:]
|
||||
else:
|
||||
bits = [''] + filename.split('/')
|
||||
|
||||
for i in range(2, len(bits)+1):
|
||||
component = join(*bits[0:i])
|
||||
# Resolve symbolic links.
|
||||
if islink(component):
|
||||
resolved = _resolve_link(component)
|
||||
if resolved is None:
|
||||
# Infinite loop -- return original component + rest of the path
|
||||
return abspath(join(*([component] + bits[i:])))
|
||||
else:
|
||||
newpath = join(*([resolved] + bits[i:]))
|
||||
return realpath(newpath)
|
||||
|
||||
return abspath(filename)
|
||||
|
||||
|
||||
def _resolve_link(path):
|
||||
"""Internal helper function. Takes a path and follows symlinks
|
||||
until we either arrive at something that isn't a symlink, or
|
||||
encounter a path we've seen before (meaning that there's a loop).
|
||||
"""
|
||||
paths_seen = []
|
||||
while islink(path):
|
||||
if path in paths_seen:
|
||||
# Already seen this path, so we must have a symlink loop
|
||||
return None
|
||||
paths_seen.append(path)
|
||||
# Resolve where the link points to
|
||||
resolved = os.readlink(path)
|
||||
if not isabs(resolved):
|
||||
dir = dirname(path)
|
||||
path = normpath(join(dir, resolved))
|
||||
else:
|
||||
path = normpath(resolved)
|
||||
return path
|
||||
|
||||
supports_unicode_filenames = False
|
||||
@@ -0,0 +1,327 @@
|
||||
init python:
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
import platform
|
||||
import subprocess
|
||||
|
||||
ZWSP = u"\u200B"
|
||||
|
||||
# The process of the running game.
|
||||
game_proc = None
|
||||
|
||||
class ProcessBehavior(renpy.display.layout.Null):
|
||||
|
||||
def __init__(self, proc):
|
||||
super(ProcessBehavior, self).__init__()
|
||||
|
||||
self.proc = proc
|
||||
|
||||
def event(self, ev, x, y, st):
|
||||
|
||||
if self.proc.poll() is not None:
|
||||
return True
|
||||
|
||||
renpy.game.interface.timeout(.25)
|
||||
|
||||
def quote_char(c):
|
||||
n = ord(c)
|
||||
if 0x20 <= n <= 0x7f:
|
||||
return c
|
||||
else:
|
||||
return "\\x%02x" % n
|
||||
|
||||
# Quotes an arbitrary string (without knowing the encoding) for display.
|
||||
def quote(s):
|
||||
s ="".join(quote_char(i) for i in s)
|
||||
s = s.replace("/", "/" + ZWSP)
|
||||
s = s.replace("\\", "\\" + ZWSP)
|
||||
return s
|
||||
|
||||
class Project(object):
|
||||
|
||||
def __init__(self, path):
|
||||
# The name of the project.
|
||||
self.name = os.path.basename(path)
|
||||
|
||||
# The full path to the project.
|
||||
self.path = path
|
||||
|
||||
# The path to the game directory, for convenience.
|
||||
self.gamedir = os.path.join(path, "game")
|
||||
|
||||
def __repr__(self):
|
||||
return "<Project %r>" % (self.path)
|
||||
|
||||
def select(self):
|
||||
"""
|
||||
Select this project as the one that we're working on.
|
||||
"""
|
||||
|
||||
global project
|
||||
global game_proc
|
||||
|
||||
persistent.project_path = self.path
|
||||
project = self
|
||||
game_proc = None
|
||||
|
||||
# Load the informatrion dictionary.
|
||||
info = dict()
|
||||
launcherinfo = os.path.join(self.path, "launcherinfo.py")
|
||||
|
||||
if os.path.exists(launcherinfo):
|
||||
source = file(launcherinfo, "rU").read().decode("utf8")
|
||||
if source[0] == u'\ufeff':
|
||||
source = source[1:]
|
||||
source = source.encode("raw_unicode_escape")
|
||||
|
||||
exec source in info
|
||||
|
||||
del info["__builtins__"]
|
||||
|
||||
self.info = info
|
||||
|
||||
def save(self):
|
||||
"""
|
||||
Saves the info dictionary into the launcherinfo file.
|
||||
"""
|
||||
|
||||
launcherinfo = os.path.join(self.path, "launcherinfo.py")
|
||||
|
||||
f = file(launcherinfo + ".new", "w")
|
||||
for k, v in self.info.iteritems():
|
||||
f.write("%s = %r\n" % (k, v))
|
||||
f.close()
|
||||
|
||||
try:
|
||||
os.rename(launcherinfo + ".new", launcherinfo)
|
||||
except:
|
||||
os.unlink(launcherinfo)
|
||||
os.rename(launcherinfo + ".new", launcherinfo)
|
||||
|
||||
|
||||
|
||||
def scan_projects():
|
||||
"""
|
||||
Scans for projects. Returns a list of Project objects.
|
||||
"""
|
||||
|
||||
rv = [ ]
|
||||
|
||||
project_dirs = [ config.renpy_base ]
|
||||
|
||||
if persistent.projects_directory and persistent.projects_directory not in project_dirs:
|
||||
project_dirs.append(persistent.projects_directory)
|
||||
|
||||
for d in project_dirs:
|
||||
|
||||
if not os.path.isdir(d):
|
||||
continue
|
||||
|
||||
for pd in sorted(os.listdir(d), key=lambda a : a.lower()):
|
||||
path = os.path.join(d, pd)
|
||||
|
||||
if not os.path.isdir(path):
|
||||
continue
|
||||
|
||||
gamedir = os.path.join(path, "game")
|
||||
|
||||
if not os.path.isdir(gamedir):
|
||||
continue
|
||||
|
||||
rv.append(Project(path))
|
||||
|
||||
return rv
|
||||
|
||||
|
||||
def choose_default_project():
|
||||
"""
|
||||
Chooses the default project, based on the persistent information.
|
||||
"""
|
||||
|
||||
project = None
|
||||
projects = scan_projects()
|
||||
|
||||
for i in projects:
|
||||
if i.path == persistent.project_path:
|
||||
i.select()
|
||||
return
|
||||
|
||||
for i in projects:
|
||||
if i.name == "tutorial":
|
||||
i.select()
|
||||
return
|
||||
|
||||
if projects:
|
||||
projects[0].select()
|
||||
return
|
||||
|
||||
|
||||
def select_project(p):
|
||||
p.select()
|
||||
renpy.jump("top")
|
||||
|
||||
curried_select_project = renpy.curry(select_project)
|
||||
|
||||
label select_project:
|
||||
|
||||
if persistent.projects_directory is None:
|
||||
call choose_projects_directory
|
||||
|
||||
python:
|
||||
|
||||
screen()
|
||||
|
||||
ui.vbox()
|
||||
|
||||
title(_(u"Select Project"))
|
||||
scrolled("top")
|
||||
|
||||
ui.vbox()
|
||||
|
||||
projects = scan_projects()
|
||||
|
||||
for i in projects:
|
||||
|
||||
button(i.name,
|
||||
curried_select_project(i),
|
||||
quote(i.path))
|
||||
|
||||
ui.close() # vbox
|
||||
ui.close() # scrolled
|
||||
ui.close() # vbox
|
||||
|
||||
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:
|
||||
|
||||
if sys.platform == "win32" and sys.argv[0].lower().endswith(".exe"):
|
||||
proc = subprocess.Popen([sys.argv[0], project.path])
|
||||
else:
|
||||
proc = subprocess.Popen([sys.executable, sys.argv[0], project.path])
|
||||
|
||||
set_tooltip(_(u"%s has been launched.") % project.name.capitalize())
|
||||
|
||||
store.game_proc = proc
|
||||
|
||||
jump top
|
||||
|
||||
|
||||
label game_directory:
|
||||
|
||||
python hide:
|
||||
gamedir = os.path.normpath(project.gamedir)
|
||||
|
||||
if sys.platform == "win32":
|
||||
os.startfile(gamedir)
|
||||
elif platform.mac_ver()[0]:
|
||||
subprocess.Popen([ "open", gamedir ])
|
||||
else:
|
||||
subprocess.Popen([ "xdg-open", gamedir ])
|
||||
|
||||
gamedir = quote(gamedir)
|
||||
set_tooltip(_(u"Opening game directory:\n%s") % gamedir)
|
||||
|
||||
jump top
|
||||
|
||||
|
||||
label edit_script:
|
||||
|
||||
python hide:
|
||||
|
||||
if not config.editor:
|
||||
error(_(u"No editor has been selected."))
|
||||
|
||||
files = [ project.gamedir + "/" + i for i in os.listdir(project.gamedir) if i.endswith(".rpy") if not i[0] == "."]
|
||||
files.sort()
|
||||
|
||||
for i in files[:]:
|
||||
if i.endswith("options.rpy"):
|
||||
files.remove(i)
|
||||
files.insert(0, i)
|
||||
|
||||
for i in files[:]:
|
||||
if i.endswith("script.rpy"):
|
||||
files.remove(i)
|
||||
files.insert(0, i)
|
||||
|
||||
if not files:
|
||||
error(_(u"No files to edit."))
|
||||
|
||||
if not renpy.launch_editor(files):
|
||||
error(_(u"Launching the editor failed."))
|
||||
|
||||
set_tooltip(_(u"Launched editor with %d script files.") % len(files))
|
||||
|
||||
jump top
|
||||
|
||||
|
||||
label lint:
|
||||
|
||||
python hide:
|
||||
|
||||
set_tooltip("")
|
||||
|
||||
info(_(u"Lint"), _(u"Lint in progress."))
|
||||
|
||||
lf = file("lint.txt", "w+")
|
||||
|
||||
if hasattr(sys, "winver") and sys.argv[0].lower().endswith(".exe"):
|
||||
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)
|
||||
|
||||
proc.wait()
|
||||
|
||||
lf.close()
|
||||
|
||||
renpy.launch_editor([ "lint.txt" ], transient=1)
|
||||
|
||||
return
|
||||
|
||||
|
||||
label call_lint:
|
||||
call lint
|
||||
|
||||
python:
|
||||
set_tooltip(_(u"Lint complete."))
|
||||
|
||||
jump top
|
||||
|
||||
|
||||
label delete_persistent:
|
||||
|
||||
python hide:
|
||||
set_tooltip("")
|
||||
|
||||
info(_(u"Delete Persistent"), _(u"Deleting persistent data."))
|
||||
|
||||
if hasattr(sys, "winver") and sys.argv[0].lower().endswith(".exe"):
|
||||
proc = subprocess.Popen([config.renpy_base + "/console.exe", "--rmpersistent", project.path])
|
||||
else:
|
||||
proc = subprocess.Popen([sys.executable, sys.argv[0], "--rmpersistent", project.path])
|
||||
|
||||
proc.wait()
|
||||
|
||||
set_tooltip(_(u"Persistent data has been deleted."))
|
||||
|
||||
jump top
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
init python:
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
try:
|
||||
import EasyDialogs
|
||||
except ImportError:
|
||||
try:
|
||||
import EasyDialogsWin as EasyDialogs
|
||||
except:
|
||||
EasyDialogs = None
|
||||
|
||||
|
||||
label choose_projects_directory:
|
||||
|
||||
python hide:
|
||||
|
||||
set_tooltip("")
|
||||
|
||||
info(_(u"Choose Projects Directory"),
|
||||
_(u"Please choose the directory containing your projects."))
|
||||
|
||||
|
||||
path = persistent.projects_directory
|
||||
|
||||
if path is None:
|
||||
path = os.path.dirname(config.renpy_base)
|
||||
path = os.environ.get("RENPY_DEFAULT_PROJECTS_DIRECTORY", path)
|
||||
|
||||
|
||||
if EasyDialogs:
|
||||
|
||||
choice = EasyDialogs.AskFolder(defaultLocation=path, wanted=str)
|
||||
if choice is not None:
|
||||
path = choice
|
||||
|
||||
else:
|
||||
|
||||
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 ],
|
||||
env=env, stdout=subprocess.PIPE)
|
||||
|
||||
choice = zen.stdout.read()
|
||||
zen.wait()
|
||||
|
||||
if choice:
|
||||
path = choice[:-1]
|
||||
|
||||
except:
|
||||
error(_(u"Could not run zenity. The projects directory has been set to the directory immediately above the directory containing Ren'Py."), None)
|
||||
|
||||
persistent.projects_directory = path
|
||||
choose_default_project()
|
||||
|
||||
return
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
init python:
|
||||
tutorial_path = config.renpy_base + "/tutorial"
|
||||
tutorial_exists = os.path.isdir(tutorial_path)
|
||||
|
||||
label main_menu:
|
||||
return
|
||||
|
||||
label start:
|
||||
python:
|
||||
choose_default_project()
|
||||
scan_editors()
|
||||
setup_editor()
|
||||
|
||||
jump top
|
||||
|
||||
label top:
|
||||
python:
|
||||
|
||||
if game_proc and game_proc.poll() is None:
|
||||
launch = None
|
||||
ui.add(ProcessBehavior(game_proc))
|
||||
else:
|
||||
launch = ui.jumps("launch")
|
||||
game_proc = None
|
||||
|
||||
screen()
|
||||
|
||||
ui.vbox()
|
||||
ui.viewport(draggable=True, ymaximum=47)
|
||||
title(project.name.capitalize())
|
||||
|
||||
ui.grid(2, 4, transpose=True)
|
||||
|
||||
button(_(u"Launch"),
|
||||
launch,
|
||||
_(u"Launches the project."))
|
||||
|
||||
button(_(u"Edit Script"),
|
||||
ui.jumps("edit_script"),
|
||||
_(u"Edits the script of the project."))
|
||||
|
||||
button(_(u"Game Directory"),
|
||||
ui.jumps("game_directory"),
|
||||
_(u"Opens the project's game directory."))
|
||||
|
||||
button(_(u"Check Script (Lint)"),
|
||||
ui.jumps("call_lint"),
|
||||
_(u"Checks the script of the project for likely errors."))
|
||||
|
||||
|
||||
button(_(u"Choose Theme"),
|
||||
ui.jumps("choose_theme"),
|
||||
_(u"Changes the theme used by the project."))
|
||||
|
||||
button(_(u"Delete Persistent"),
|
||||
ui.jumps("delete_persistent"),
|
||||
_(u"Deletes the persistent data associated with the project."))
|
||||
|
||||
button(_(u"Archive Files"),
|
||||
ui.jumps("archiver"),
|
||||
_(u"Archives files found in the game and archived directories."))
|
||||
|
||||
button(_(u"Build Distributions"),
|
||||
ui.jumps("distribute"),
|
||||
_(u"Builds distributions of the project."))
|
||||
|
||||
ui.close()
|
||||
|
||||
title(_(u"Ren'Py"))
|
||||
|
||||
ui.grid(2, 4, transpose=True)
|
||||
|
||||
button(_(u"Select Project"),
|
||||
ui.jumps("select_project"),
|
||||
_(u"Select a project to work with."))
|
||||
|
||||
button(_(u"New Project"),
|
||||
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,
|
||||
_(u"Causes the launcher to exit."))
|
||||
|
||||
button(_(u"Options"),
|
||||
ui.jumps("options"),
|
||||
_(u"Change Ren'Py launcher options."))
|
||||
|
||||
button(_(u"Ren'Py Help"),
|
||||
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()
|
||||
|
||||
interact()
|
||||
|
||||
# ProcessBehavior can return True, which sends us here.
|
||||
jump top
|
||||
|
||||
|
||||
label documentation:
|
||||
|
||||
python hide:
|
||||
import webbrowser
|
||||
webbrowser.open_new("file:///" + config.renpy_base + "/doc/index.html")
|
||||
set_tooltip(_(u"Now showing the Ren'Py documentation in your web browser."))
|
||||
|
||||
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 confirm_quit:
|
||||
$ renpy.quit()
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
init -999:
|
||||
$ config.script_version = (6, 9, 1)
|
||||
$ config.script_version = (6, 10, 2)
|
||||
|
||||
|
||||
@@ -0,0 +1,209 @@
|
||||
init python:
|
||||
LAUNCHER_RPYS = set(['options.rpy', 'strings.rpy', 'transupdate.rpy', 'choose_theme.rpy', 'archiver.rpy', 'project.rpy', 'script_version.rpy', 'new.rpy', 'themes_data.rpy', 'opts.rpy', 'interface.rpy', 'projectsdir.rpy', 'distribute.rpy', 'script.rpy', 'editor.rpy'])
|
||||
|
||||
TRANSLATION_STRINGS = [
|
||||
|
||||
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"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"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"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"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"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"Ren'Py",
|
||||
u"Select a project to work with.",
|
||||
u"Create a new project.",
|
||||
u"Ren'Py Games List",
|
||||
u"Visit the Ren'Py games list, at http://games.renpy.org.",
|
||||
u"Causes the launcher to exit.",
|
||||
u"Options",
|
||||
u"Change Ren'Py launcher options.",
|
||||
u"Ren'Py Help",
|
||||
u"Open the Ren'Py documentation in a web browser.",
|
||||
u"Tutorial Game",
|
||||
]
|
||||
|
||||
@@ -1,244 +1,305 @@
|
||||
init 1 python:
|
||||
theme_data = {'Basic Blue': {'disabled': '#404040',
|
||||
'disabled_text': '#c8c8c8',
|
||||
'frame': '#6496c8',
|
||||
'gm_root': '#dcebff',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#dcebff',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#003c78',
|
||||
'widget_hover': '#0050a0',
|
||||
'widget_selected': '#ffffc8',
|
||||
'widget_text': '#c8ffff'},
|
||||
'Bloody Mary': {'disabled': '#400000',
|
||||
'disabled_text': '#260000',
|
||||
'frame': '#400808',
|
||||
'gm_root': '#000000',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#000000',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#000000',
|
||||
'widget_hover': '#830000',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#C2C2C2'},
|
||||
'Colorblind': {'disabled': '#898989',
|
||||
'disabled_text': '#666666',
|
||||
'frame': '#252525',
|
||||
'gm_root': '#393939',
|
||||
'label': '#c2c2c2',
|
||||
'mm_root': '#393939',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#898989',
|
||||
'widget_hover': '#464646',
|
||||
'widget_selected': '#F2F2F2',
|
||||
'widget_text': '#CCCCCC'},
|
||||
'Cotton Candy': {'disabled': '#C8AFA1',
|
||||
'disabled_text': '#E1D4C9',
|
||||
'frame': '#FCF5F2',
|
||||
'gm_root': '#D0B4BA',
|
||||
'label': '#805C40',
|
||||
'mm_root': '#D0B4BA',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#ECC7D0',
|
||||
'widget_hover': '#E1D4C9',
|
||||
'widget_selected': '#805C40',
|
||||
'widget_text': '#805C40'},
|
||||
'Creamsicle': {'disabled': '#FFECBF',
|
||||
'disabled_text': '#ffffff',
|
||||
'frame': '#FFECBF',
|
||||
'gm_root': '#FDF5E3',
|
||||
'label': '#502F13',
|
||||
'mm_root': '#FDF5E3',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#D96B00',
|
||||
'widget_hover': '#FD9B1C',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#FCE6B1'},
|
||||
'Dramatic Flesh': {'disabled': '#ab6038',
|
||||
'disabled_text': '#BF7C51',
|
||||
'frame': '#49271b',
|
||||
'gm_root': '#2a201f',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#2a201f',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#BF7C51',
|
||||
'widget_hover': '#dda570',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#E5DFDF'},
|
||||
'Easter Baby': {'disabled': '#DDE9FF',
|
||||
'disabled_text': '#A6AFBF',
|
||||
'frame': '#CCF8DC',
|
||||
'gm_root': '#FBF9DF',
|
||||
'label': '#698071',
|
||||
'mm_root': '#FBF9DF',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#F5D4EE',
|
||||
'widget_hover': '#F0DDFF',
|
||||
'widget_selected': '#000000',
|
||||
'widget_text': '#698071'},
|
||||
'Favorite Jeans': {'disabled': '#919994',
|
||||
'disabled_text': '#B6BFB9',
|
||||
'frame': '#6f7571',
|
||||
'gm_root': '#b0b8ba',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#b0b8ba',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#8699a7',
|
||||
'widget_hover': '#9eb1ad',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#dcdfd6'},
|
||||
'Fine China': {'disabled': '#ADB9CC',
|
||||
'disabled_text': '#DFBA14',
|
||||
'frame': '#ADB9CC',
|
||||
'gm_root': '#F7F7FA',
|
||||
'label': '#39435E',
|
||||
'mm_root': '#F7F7FA',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#6A7183',
|
||||
'widget_hover': '#1A2B47',
|
||||
'widget_selected': '#E3E3E4',
|
||||
'widget_text': '#C9C9CB'},
|
||||
'First Valentines': {'disabled': '#F8F2D0',
|
||||
'disabled_text': '#BFA1A1',
|
||||
'frame': '#F8F2D0',
|
||||
'gm_root': '#D98989',
|
||||
'label': '#5D1010',
|
||||
'mm_root': '#D98989',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#F09898',
|
||||
'widget_hover': '#D6C5BB',
|
||||
'widget_selected': '#B31E1E',
|
||||
'widget_text': '#593131'},
|
||||
'Ice Queen': {'disabled': '#F0F2F2',
|
||||
'disabled_text': '#FBFBFB',
|
||||
'frame': '#ffffff',
|
||||
'gm_root': '#E6E6E6',
|
||||
'label': '#D9D9D9',
|
||||
'mm_root': '#E6E6E6',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#D9D9D9',
|
||||
'widget_hover': '#F0F2F2',
|
||||
'widget_selected': '#737373',
|
||||
'widget_text': '#ffffff'},
|
||||
'Mocha Latte': {'disabled': '#614D3A',
|
||||
'disabled_text': '#80654D',
|
||||
'frame': '#926841',
|
||||
'gm_root': '#1A140E',
|
||||
'label': '#F1EBE5',
|
||||
'mm_root': '#1A140E',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#4D3B29',
|
||||
'widget_hover': '#996E45',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#B99D83'},
|
||||
'Muted Horror': {'disabled': '#73735C',
|
||||
'disabled_text': '#8C8C70',
|
||||
'frame': '#555544',
|
||||
'gm_root': '#1A0001',
|
||||
'label': '#1A0001',
|
||||
'mm_root': '#1A0001',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#777777',
|
||||
'widget_hover': '#73735C',
|
||||
'widget_selected': '#000000',
|
||||
'widget_text': '#404033'},
|
||||
'Old Polaroid': {'disabled': '#A89E7D',
|
||||
'disabled_text': '#CCC097',
|
||||
'frame': '#49403E',
|
||||
'gm_root': '#A84A3E',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#A84A3E',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#A89E7D',
|
||||
'widget_hover': '#8DB6B9',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#49403E'},
|
||||
'Really Red': {'disabled': '#404040',
|
||||
'disabled_text': '#c8c8c8',
|
||||
'frame': '#e17373',
|
||||
'gm_root': '#ffd0d0',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#ffd0d0',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#963232',
|
||||
'widget_hover': '#c83232',
|
||||
'widget_selected': '#ffffc8',
|
||||
'widget_text': '#ffffff'},
|
||||
'Summer Sky': {'disabled': '#6074BF',
|
||||
'disabled_text': '#7383BF',
|
||||
'frame': '#6074BF',
|
||||
'gm_root': '#B4CDD4',
|
||||
'label': '#94C7D4',
|
||||
'mm_root': '#B4CDD4',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#F2E6AA',
|
||||
'widget_hover': '#FCFCA4',
|
||||
'widget_selected': '#1A5766',
|
||||
'widget_text': '#7DA8B3'},
|
||||
'Swamp Critter': {'disabled': '#A2521D',
|
||||
'disabled_text': '#753D00',
|
||||
'frame': '#797C1C',
|
||||
'gm_root': '#B09D5A',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#B09B4F',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#753D00',
|
||||
'widget_hover': '#B19A48',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#CCCAC2'},
|
||||
'Urban Sprawl': {'disabled': '#8F0000',
|
||||
'disabled_text': '#333333',
|
||||
'frame': '#8F0000',
|
||||
'gm_root': '#000000',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#000000',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#333333',
|
||||
'widget_hover': '#000000',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#6C8A2F'},
|
||||
'Victorian Gingerbread': {'disabled': '#7A674F',
|
||||
'disabled_text': '#664F33',
|
||||
'frame': '#BF8A73',
|
||||
'gm_root': '#695640',
|
||||
'label': '#F2EDC4',
|
||||
'mm_root': '#695640',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#7A674F',
|
||||
'widget_hover': '#BDA77D',
|
||||
'widget_selected': '#FDFBEE',
|
||||
'widget_text': '#F2EDC4'},
|
||||
'Watermelon Pie': {'disabled': '#FABF46',
|
||||
'disabled_text': '#FFE06D',
|
||||
'frame': '#C3CD91',
|
||||
'gm_root': '#F7F7C5',
|
||||
'label': '#FCFCD7',
|
||||
'mm_root': '#F7F7C5',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#FFE06D',
|
||||
'widget_hover': '#E38A4F',
|
||||
'widget_selected': '#996600',
|
||||
'widget_text': '#FAA700'},
|
||||
'White Chocolate': {'disabled': '#614D3A',
|
||||
'disabled_text': '#80654D',
|
||||
'frame': '#926841',
|
||||
'gm_root': '#FBF9EA',
|
||||
'label': '#F1EBE5',
|
||||
'mm_root': '#FBF9EA',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#33271C',
|
||||
'widget_hover': '#ECE7C4',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#B99D83'},
|
||||
'Winter Mint': {'disabled': '#426143',
|
||||
'disabled_text': '#819981',
|
||||
'frame': '#245536',
|
||||
'gm_root': '#e5f1e5',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#e5f1e5',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#7AA27B',
|
||||
'widget_hover': '#A3C7A3',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#CDE0CE'}}
|
||||
|
||||
# This is a list of (theme name, theme function, theme exemplar) tuples.
|
||||
themes = [
|
||||
("Roundrect", "roundrect", "Basic Blue"),
|
||||
]
|
||||
|
||||
# This is a map from theme function to template text that sensibly calls
|
||||
# that function.
|
||||
theme_templates = { }
|
||||
|
||||
theme_templates["roundrect"] = """\
|
||||
theme.roundrect(
|
||||
# Color scheme: %(name)s
|
||||
|
||||
## The color of an idle widget face.
|
||||
widget = "%(widget)s",
|
||||
|
||||
## The color of a focused widget face.
|
||||
widget_hover = "%(widget_hover)s",
|
||||
|
||||
## The color of the text in a widget.
|
||||
widget_text = "%(widget_text)s",
|
||||
|
||||
## The color of the text in a selected widget. (For
|
||||
## example, the current value of a preference.)
|
||||
widget_selected = "%(widget_selected)s",
|
||||
|
||||
## The color of a disabled widget face.
|
||||
disabled = "%(disabled)s",
|
||||
|
||||
## The color of disabled widget text.
|
||||
disabled_text = "%(disabled_text)s",
|
||||
|
||||
## The color of informational labels.
|
||||
label = "%(label)s",
|
||||
|
||||
## The color of a frame containing widgets.
|
||||
frame = "%(frame)s",
|
||||
|
||||
## The background of the main menu. This can be a color
|
||||
## beginning with '#', or an image filename. The latter
|
||||
## should take up the full height and width of the screen.
|
||||
mm_root = "%(mm_root)s",
|
||||
|
||||
## The background of the game menu. This can be a color
|
||||
## beginning with '#', or an image filename. The latter
|
||||
## should take up the full height and width of the screen.
|
||||
gm_root = "%(gm_root)s",
|
||||
|
||||
## If this is True, the in-game window is rounded. If False,
|
||||
## the in-game window is square.
|
||||
rounded_window = False,
|
||||
|
||||
## And we're done with the theme. The theme will customize
|
||||
## various styles, so if we want to change them, we should
|
||||
## do so below.
|
||||
)"""
|
||||
|
||||
# This is a map from theme name to the code needed to implement that
|
||||
# theme.
|
||||
theme_data = {
|
||||
'Basic Blue': {'disabled': '#404040',
|
||||
'disabled_text': '#c8c8c8',
|
||||
'frame': '#6496c8',
|
||||
'gm_root': '#dcebff',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#dcebff',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#003c78',
|
||||
'widget_hover': '#0050a0',
|
||||
'widget_selected': '#ffffc8',
|
||||
'widget_text': '#c8ffff'},
|
||||
'Bloody Mary': {'disabled': '#400000',
|
||||
'disabled_text': '#260000',
|
||||
'frame': '#400808',
|
||||
'gm_root': '#000000',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#000000',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#000000',
|
||||
'widget_hover': '#830000',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#C2C2C2'},
|
||||
'Colorblind': {'disabled': '#898989',
|
||||
'disabled_text': '#666666',
|
||||
'frame': '#252525',
|
||||
'gm_root': '#393939',
|
||||
'label': '#c2c2c2',
|
||||
'mm_root': '#393939',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#898989',
|
||||
'widget_hover': '#464646',
|
||||
'widget_selected': '#F2F2F2',
|
||||
'widget_text': '#CCCCCC'},
|
||||
'Cotton Candy': {'disabled': '#C8AFA1',
|
||||
'disabled_text': '#E1D4C9',
|
||||
'frame': '#FCF5F2',
|
||||
'gm_root': '#D0B4BA',
|
||||
'label': '#805C40',
|
||||
'mm_root': '#D0B4BA',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#ECC7D0',
|
||||
'widget_hover': '#E1D4C9',
|
||||
'widget_selected': '#805C40',
|
||||
'widget_text': '#805C40'},
|
||||
'Creamsicle': {'disabled': '#FFECBF',
|
||||
'disabled_text': '#ffffff',
|
||||
'frame': '#FFECBF',
|
||||
'gm_root': '#FDF5E3',
|
||||
'label': '#502F13',
|
||||
'mm_root': '#FDF5E3',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#D96B00',
|
||||
'widget_hover': '#FD9B1C',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#FCE6B1'},
|
||||
'Dramatic Flesh': {'disabled': '#ab6038',
|
||||
'disabled_text': '#BF7C51',
|
||||
'frame': '#49271b',
|
||||
'gm_root': '#2a201f',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#2a201f',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#BF7C51',
|
||||
'widget_hover': '#dda570',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#E5DFDF'},
|
||||
'Easter Baby': {'disabled': '#DDE9FF',
|
||||
'disabled_text': '#A6AFBF',
|
||||
'frame': '#CCF8DC',
|
||||
'gm_root': '#FBF9DF',
|
||||
'label': '#698071',
|
||||
'mm_root': '#FBF9DF',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#F5D4EE',
|
||||
'widget_hover': '#F0DDFF',
|
||||
'widget_selected': '#000000',
|
||||
'widget_text': '#698071'},
|
||||
'Favorite Jeans': {'disabled': '#919994',
|
||||
'disabled_text': '#B6BFB9',
|
||||
'frame': '#6f7571',
|
||||
'gm_root': '#b0b8ba',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#b0b8ba',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#8699a7',
|
||||
'widget_hover': '#9eb1ad',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#dcdfd6'},
|
||||
'Fine China': {'disabled': '#ADB9CC',
|
||||
'disabled_text': '#DFBA14',
|
||||
'frame': '#ADB9CC',
|
||||
'gm_root': '#F7F7FA',
|
||||
'label': '#39435E',
|
||||
'mm_root': '#F7F7FA',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#6A7183',
|
||||
'widget_hover': '#1A2B47',
|
||||
'widget_selected': '#E3E3E4',
|
||||
'widget_text': '#C9C9CB'},
|
||||
'First Valentines': {'disabled': '#F8F2D0',
|
||||
'disabled_text': '#BFA1A1',
|
||||
'frame': '#F8F2D0',
|
||||
'gm_root': '#D98989',
|
||||
'label': '#5D1010',
|
||||
'mm_root': '#D98989',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#F09898',
|
||||
'widget_hover': '#D6C5BB',
|
||||
'widget_selected': '#B31E1E',
|
||||
'widget_text': '#593131'},
|
||||
'Ice Queen': {'disabled': '#F0F2F2',
|
||||
'disabled_text': '#FBFBFB',
|
||||
'frame': '#ffffff',
|
||||
'gm_root': '#E6E6E6',
|
||||
'label': '#D9D9D9',
|
||||
'mm_root': '#E6E6E6',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#D9D9D9',
|
||||
'widget_hover': '#F0F2F2',
|
||||
'widget_selected': '#737373',
|
||||
'widget_text': '#ffffff'},
|
||||
'Mocha Latte': {'disabled': '#614D3A',
|
||||
'disabled_text': '#80654D',
|
||||
'frame': '#926841',
|
||||
'gm_root': '#1A140E',
|
||||
'label': '#F1EBE5',
|
||||
'mm_root': '#1A140E',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#4D3B29',
|
||||
'widget_hover': '#996E45',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#B99D83'},
|
||||
'Muted Horror': {'disabled': '#73735C',
|
||||
'disabled_text': '#8C8C70',
|
||||
'frame': '#555544',
|
||||
'gm_root': '#1A0001',
|
||||
'label': '#1A0001',
|
||||
'mm_root': '#1A0001',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#777777',
|
||||
'widget_hover': '#73735C',
|
||||
'widget_selected': '#000000',
|
||||
'widget_text': '#404033'},
|
||||
'Old Polaroid': {'disabled': '#A89E7D',
|
||||
'disabled_text': '#CCC097',
|
||||
'frame': '#49403E',
|
||||
'gm_root': '#A84A3E',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#A84A3E',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#A89E7D',
|
||||
'widget_hover': '#8DB6B9',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#49403E'},
|
||||
'Really Red': {'disabled': '#404040',
|
||||
'disabled_text': '#c8c8c8',
|
||||
'frame': '#e17373',
|
||||
'gm_root': '#ffd0d0',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#ffd0d0',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#963232',
|
||||
'widget_hover': '#c83232',
|
||||
'widget_selected': '#ffffc8',
|
||||
'widget_text': '#ffffff'},
|
||||
'Summer Sky': {'disabled': '#6074BF',
|
||||
'disabled_text': '#7383BF',
|
||||
'frame': '#6074BF',
|
||||
'gm_root': '#B4CDD4',
|
||||
'label': '#94C7D4',
|
||||
'mm_root': '#B4CDD4',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#F2E6AA',
|
||||
'widget_hover': '#FCFCA4',
|
||||
'widget_selected': '#1A5766',
|
||||
'widget_text': '#7DA8B3'},
|
||||
'Swamp Critter': {'disabled': '#A2521D',
|
||||
'disabled_text': '#753D00',
|
||||
'frame': '#797C1C',
|
||||
'gm_root': '#B09D5A',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#B09B4F',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#753D00',
|
||||
'widget_hover': '#B19A48',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#CCCAC2'},
|
||||
'Urban Sprawl': {'disabled': '#8F0000',
|
||||
'disabled_text': '#333333',
|
||||
'frame': '#8F0000',
|
||||
'gm_root': '#000000',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#000000',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#333333',
|
||||
'widget_hover': '#000000',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#6C8A2F'},
|
||||
'Victorian Gingerbread': {'disabled': '#7A674F',
|
||||
'disabled_text': '#664F33',
|
||||
'frame': '#BF8A73',
|
||||
'gm_root': '#695640',
|
||||
'label': '#F2EDC4',
|
||||
'mm_root': '#695640',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#7A674F',
|
||||
'widget_hover': '#BDA77D',
|
||||
'widget_selected': '#FDFBEE',
|
||||
'widget_text': '#F2EDC4'},
|
||||
'Watermelon Pie': {'disabled': '#FABF46',
|
||||
'disabled_text': '#FFE06D',
|
||||
'frame': '#C3CD91',
|
||||
'gm_root': '#F7F7C5',
|
||||
'label': '#FCFCD7',
|
||||
'mm_root': '#F7F7C5',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#FFE06D',
|
||||
'widget_hover': '#E38A4F',
|
||||
'widget_selected': '#996600',
|
||||
'widget_text': '#FAA700'},
|
||||
'White Chocolate': {'disabled': '#614D3A',
|
||||
'disabled_text': '#80654D',
|
||||
'frame': '#926841',
|
||||
'gm_root': '#FBF9EA',
|
||||
'label': '#F1EBE5',
|
||||
'mm_root': '#FBF9EA',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#33271C',
|
||||
'widget_hover': '#ECE7C4',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#B99D83'},
|
||||
'Winter Mint': {'disabled': '#426143',
|
||||
'disabled_text': '#819981',
|
||||
'frame': '#245536',
|
||||
'gm_root': '#e5f1e5',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#e5f1e5',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#7AA27B',
|
||||
'widget_hover': '#A3C7A3',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#CDE0CE'}}
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
# This file contains code for updating translations. Basically, it will
|
||||
# search for a non-default file in launcher, and if that file exists, it
|
||||
# will append missing translations to it.
|
||||
|
||||
init python:
|
||||
import os
|
||||
import os.path
|
||||
import traceback
|
||||
import codecs
|
||||
|
||||
def update_translations():
|
||||
|
||||
# Find the first file in the launcher directory that was
|
||||
# not distributed with Ren'Py.
|
||||
for fn in sorted(os.listdir(config.gamedir)):
|
||||
if not fn.endswith(".rpy"):
|
||||
continue
|
||||
|
||||
if fn in LAUNCHER_RPYS:
|
||||
continue
|
||||
|
||||
break
|
||||
|
||||
else:
|
||||
return
|
||||
|
||||
# Find untranslated strings.
|
||||
new_translations = [ ]
|
||||
|
||||
for t in TRANSLATION_STRINGS:
|
||||
if t not in config.translations:
|
||||
new_translations.append(t)
|
||||
|
||||
if not new_translations:
|
||||
return
|
||||
|
||||
|
||||
# Add a block to the file with the untranslated strings.
|
||||
f = codecs.open(os.path.join(config.gamedir, fn), "a", "utf-8")
|
||||
|
||||
print >>f
|
||||
print >>f, "# New translations for", renpy.version()
|
||||
print >>f, "init -1 python hide:"
|
||||
print >>f, " config.translations.update({"
|
||||
|
||||
for t in new_translations:
|
||||
|
||||
print >>f
|
||||
print >>f, " %r" % t
|
||||
print >>f, " : %r," % t
|
||||
|
||||
print >>f
|
||||
print >>f, " })"
|
||||
|
||||
f.close()
|
||||
|
||||
init 100 python hide:
|
||||
|
||||
try:
|
||||
update_translations()
|
||||
except:
|
||||
traceback.print_exc()
|
||||
@@ -0,0 +1,534 @@
|
||||
# This file contains the code needed to build a Ren'Py distribution.
|
||||
|
||||
init python:
|
||||
import zipfile
|
||||
import tarfile
|
||||
import os
|
||||
import os.path
|
||||
import time
|
||||
import sys
|
||||
import zlib
|
||||
|
||||
import pefile
|
||||
|
||||
# Returns true if a file or directory should not be included in
|
||||
# the distribution
|
||||
|
||||
ignored_files = ("thumbs.db",
|
||||
"launcherinfo.py",
|
||||
"traceback.txt",
|
||||
"errors.txt",
|
||||
"icon.ico",
|
||||
"icon.icns"
|
||||
)
|
||||
|
||||
|
||||
root_ignored_files = (
|
||||
"common",
|
||||
"renpy",
|
||||
"renpy.code",
|
||||
"python23.dll",
|
||||
"python24.dll",
|
||||
"python25.dll",
|
||||
"msvcr71.dll",
|
||||
"lib",
|
||||
"iliad-icon.png",
|
||||
"manifest.xml"
|
||||
)
|
||||
|
||||
def ignored(fn, dir, dest, root):
|
||||
if fn[0] == ".":
|
||||
return True
|
||||
|
||||
for i in store.ignore_extensions:
|
||||
if fn.endswith(i):
|
||||
return True
|
||||
|
||||
if fn.lower() in ignored_files:
|
||||
return True
|
||||
|
||||
if fn == "saves":
|
||||
return True
|
||||
|
||||
if fn == "archived":
|
||||
return True
|
||||
|
||||
if root and dir == dest:
|
||||
if fn.endswith(".py") or fn.endswith(".sh") or fn.endswith(".app"):
|
||||
return True
|
||||
|
||||
if fn in root_ignored_files:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def tree(src, dest,
|
||||
exclude_suffix=[ ".pyc", "~", ".bak" ],
|
||||
exclude_prefix=[ ".", '#' ],
|
||||
exclude=ignored_files,
|
||||
exclude_func=ignored,
|
||||
root=False,
|
||||
):
|
||||
|
||||
# Get rid of trailing slashes.
|
||||
if src[-1] == "/":
|
||||
src = src[:-1]
|
||||
|
||||
if dest and dest[-1] == "/":
|
||||
dest = dest[:-1]
|
||||
|
||||
# What should we include?
|
||||
def include(fn, destdir, dest):
|
||||
for i in exclude_suffix:
|
||||
if fn.endswith(i):
|
||||
return False
|
||||
|
||||
for i in exclude_prefix:
|
||||
if fn.startswith(i):
|
||||
return False
|
||||
|
||||
for i in exclude:
|
||||
if i == fn.lower():
|
||||
return False
|
||||
|
||||
if exclude_func and exclude_func(fn, destdir, dest, root):
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
rv = [ ]
|
||||
|
||||
# Walk the tree, including what is necessary.
|
||||
for srcdir, dirs, files in os.walk(src):
|
||||
|
||||
if dest:
|
||||
destdir = dest + srcdir[len(src):]
|
||||
else:
|
||||
destdir = srcdir[len(src) + 1:]
|
||||
|
||||
if destdir:
|
||||
rv.append((srcdir, destdir))
|
||||
|
||||
for fn in files:
|
||||
|
||||
if not include(fn, destdir, dest):
|
||||
continue
|
||||
|
||||
sfn = srcdir + "/" + fn
|
||||
|
||||
if destdir:
|
||||
dfn = destdir + "/" + fn
|
||||
else:
|
||||
dfn = fn
|
||||
|
||||
dfn = dfn.replace("\\", "/")
|
||||
|
||||
rv.append((sfn, dfn))
|
||||
|
||||
dirs[:] = [ i for i in dirs if include(i, destdir, dest) ]
|
||||
|
||||
return rv
|
||||
|
||||
|
||||
label distribute:
|
||||
|
||||
python hide:
|
||||
zlib.Z_DEFAULT_COMPRESSION = 9
|
||||
|
||||
store.progress_time = 0
|
||||
|
||||
def progress(tit, n, m, time=time):
|
||||
|
||||
if time.time() < store.progress_time + .1:
|
||||
return
|
||||
|
||||
title(tit)
|
||||
|
||||
mid(message)
|
||||
ui.bar(m, n, xmaximum=200, xalign=0.5)
|
||||
ui.close()
|
||||
|
||||
ui.pausebehavior(0)
|
||||
interact()
|
||||
|
||||
# Check to see which platforms we can build on.
|
||||
if os.path.exists(config.renpy_base + "/renpy.exe"):
|
||||
windows = True
|
||||
else:
|
||||
windows = False
|
||||
|
||||
if os.path.exists(config.renpy_base + "/lib/linux-x86"):
|
||||
linux = True
|
||||
else:
|
||||
linux = False
|
||||
|
||||
if os.path.exists(config.renpy_base + "/lib/linux-iliad"):
|
||||
iliad = True
|
||||
else:
|
||||
iliad = False
|
||||
|
||||
if os.path.exists(config.renpy_base + "/renpy.app"):
|
||||
mac = True
|
||||
else:
|
||||
mac = False
|
||||
|
||||
if not (windows or mac or linux or iliad):
|
||||
store.error(u"Can't Distribute", u"Ren'Py is missing files required for distribution. Please download the full package from {a=http://www.renpy.org/}www.renpy.org{/a}.", "tools_menu")
|
||||
|
||||
lint()
|
||||
|
||||
store.message = ""
|
||||
|
||||
title(_(u"Building Distributions"))
|
||||
|
||||
mid()
|
||||
text(u"I've just performed a lint on your project. If it contains errors, you should say no and fix them.\nCheck {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?")
|
||||
ui.close()
|
||||
|
||||
bottom()
|
||||
button(u"Yes", clicked=ui.returns(True))
|
||||
button(u"No", clicked=ui.returns(False))
|
||||
ui.close()
|
||||
|
||||
if not interact():
|
||||
renpy.jump("tools")
|
||||
|
||||
|
||||
# if not windows or not mac or not linux:
|
||||
# store.message = "The full version of Ren'Py can build for Windows, Mac, and Linux. Download it from www.renpy.org."
|
||||
|
||||
title(u"Building Distributions")
|
||||
|
||||
mid()
|
||||
text(u"Distributions will be built for the following platforms:")
|
||||
|
||||
spacer()
|
||||
|
||||
if windows:
|
||||
text(u"Windows 2000+", style='launcher_input')
|
||||
|
||||
if linux:
|
||||
text(u"Linux x86", style='launcher_input')
|
||||
|
||||
if iliad:
|
||||
text(u"iLiad", style='launcher_input')
|
||||
|
||||
if mac:
|
||||
text(u"Mac OS X 10.4+", style='launcher_input')
|
||||
|
||||
spacer()
|
||||
|
||||
|
||||
# TODO: If missing platforms, prompt for a DL.
|
||||
|
||||
text(u"Is this okay?")
|
||||
ui.close()
|
||||
|
||||
bottom()
|
||||
button(u"Yes", clicked=ui.returns(True))
|
||||
button(u"No", clicked=ui.returns(False))
|
||||
ui.close()
|
||||
|
||||
if not interact():
|
||||
renpy.jump("tools")
|
||||
|
||||
default_name = project.info.get('distribution_base', project.name)
|
||||
|
||||
name = prompt(u"Building Distributions",
|
||||
u"Please enter a base name for the directories making up this distribution.",
|
||||
"tools",
|
||||
default_name,
|
||||
u"This usually should include a name and version number, like 'moonlight_walks-1.0'.")
|
||||
|
||||
name = name.strip()
|
||||
|
||||
if not name:
|
||||
store.error(u"Error", u"The distribution name should not be empty.", "tools_menu")
|
||||
|
||||
try:
|
||||
name = name.encode("ascii")
|
||||
except:
|
||||
store.error(u"Error", u"Distribution names must be ASCII. This is because archive file formats do not support non-ASCII characters in a uniform way.", "tools_menu")
|
||||
|
||||
project.info['distribution_base'] = name
|
||||
|
||||
ignore_extensions = project.info.get('ignore_extensions', "~ .bak")
|
||||
ignore_extensions = prompt(u"Building Distributions", u"Please enter a space separated list of the file extensions you do not want included in the distribution.", "tools", ignore_extensions)
|
||||
store.ignore_extensions = [ i.strip() for i in ignore_extensions.strip().split() ]
|
||||
project.info['ignore_extensions'] = ignore_extensions
|
||||
|
||||
project.save()
|
||||
|
||||
# Figure out the files that will make up the distribution.
|
||||
|
||||
multi = [ ]
|
||||
|
||||
# This finds the files and directories in the tree, and includes
|
||||
# them in the result.
|
||||
|
||||
|
||||
# renpy and common directories.
|
||||
multi.extend(tree(config.renpy_base + "/renpy", "renpy"))
|
||||
multi.append((config.renpy_base + "/LICENSE.txt", "renpy/LICENSE.txt"))
|
||||
multi.extend(tree(config.commondir, "common"))
|
||||
|
||||
# Include the project.
|
||||
multi.extend(tree(project.path, '',
|
||||
exclude_suffix = [ ],
|
||||
exclude_prefix = [ ],
|
||||
exclude=[ ],
|
||||
root=True))
|
||||
|
||||
shortgamedir = project.gamedir[len(project.path)+1:]
|
||||
|
||||
|
||||
def add_script_version(fn, multi=multi, shortgamedir=shortgamedir):
|
||||
|
||||
for a, b in multi:
|
||||
if b == shortgamedir + "/" + fn:
|
||||
return
|
||||
|
||||
for i in store.ignore_extensions:
|
||||
if fn.endswith(i):
|
||||
return
|
||||
|
||||
multi.append((config.gamedir + "/" + fn, shortgamedir + "/" + fn))
|
||||
|
||||
add_script_version("script_version.rpy")
|
||||
add_script_version("script_version.rpyc")
|
||||
|
||||
# renpy.py
|
||||
multi.append((config.renpy_base + "/renpy.py",
|
||||
project.name + ".py"))
|
||||
|
||||
# Windows Zip
|
||||
if windows:
|
||||
win_files = [
|
||||
( config.renpy_base + "/renpy.exe", project.name + ".exe"),
|
||||
( config.renpy_base + "/renpy.code", "renpy.code" ),
|
||||
( config.renpy_base + "/python25.dll", "python25.dll" ),
|
||||
( config.renpy_base + "/msvcr71.dll", "msvcr71.dll" ),
|
||||
]
|
||||
|
||||
win_data = { }
|
||||
if os.path.exists(project.path + "/icon.ico"):
|
||||
win_data[project.name + ".exe"] = pefile.change_icons(
|
||||
config.renpy_base + "/renpy.exe",
|
||||
project.path + "/icon.ico",
|
||||
)
|
||||
|
||||
zf = zipfile.ZipFile(name + ".zip", "w", zipfile.ZIP_DEFLATED)
|
||||
|
||||
progress_len = len(multi) + len(win_files)
|
||||
store.message = u"Be sure to announce your project at the Lemma Soft Forums."
|
||||
|
||||
for i, (fn, an) in enumerate(multi + win_files):
|
||||
progress(u"Building Windows", i, progress_len)
|
||||
|
||||
if os.path.isdir(fn):
|
||||
continue
|
||||
|
||||
zi = zipfile.ZipInfo(name + "/" + an)
|
||||
|
||||
s = os.stat(fn)
|
||||
zi.date_time = time.gmtime(s.st_mtime)[:6]
|
||||
zi.compress_type = zipfile.ZIP_DEFLATED
|
||||
zi.create_system = 3
|
||||
|
||||
zi.external_attr = long(0100666) << 16
|
||||
data = file(fn, "rb").read()
|
||||
|
||||
data = win_data.get(an, data)
|
||||
|
||||
zf.writestr(zi, data)
|
||||
|
||||
|
||||
zf.close()
|
||||
|
||||
|
||||
# Linux Tar Bz2
|
||||
if linux:
|
||||
|
||||
linux_files = [
|
||||
(config.renpy_base + "/lib/linux-x86", "lib/linux-x86"),
|
||||
(config.renpy_base + "/renpy.sh", project.name + ".sh"),
|
||||
(config.renpy_base + "/lib/python", "lib/python"),
|
||||
]
|
||||
|
||||
|
||||
linux_files.extend(tree(config.renpy_base + "/lib/linux-x86", "lib/linux-x86"))
|
||||
|
||||
tf = tarfile.open(name + "-linux-x86.tar.bz2", "w:bz2")
|
||||
tf.dereference = True
|
||||
|
||||
progress_len = len(multi) + len(linux_files)
|
||||
store.message = u"If appropriate, please submit your game to www.renai.us."
|
||||
|
||||
for j, i in enumerate(multi + linux_files):
|
||||
|
||||
progress(u"Building Linux", j, progress_len)
|
||||
|
||||
fn, an = i
|
||||
|
||||
info = tf.gettarinfo(fn, name + "-linux-x86/" + an)
|
||||
|
||||
if info.isdir():
|
||||
perms = 0777
|
||||
elif info.name.endswith(".sh"):
|
||||
perms = 0777
|
||||
elif info.name.endswith(".so"):
|
||||
perms = 0777
|
||||
elif info.name.endswith("python"):
|
||||
perms = 0777
|
||||
elif info.name.endswith("python.real"):
|
||||
perms = 0777
|
||||
else:
|
||||
perms = 0666
|
||||
|
||||
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()
|
||||
|
||||
|
||||
# iLiad Tar Bz2
|
||||
if iliad:
|
||||
|
||||
iliad_files = [
|
||||
(config.renpy_base + "/lib", "lib"),
|
||||
(config.renpy_base + "/renpy-iliad.sh", project.name + ".sh"),
|
||||
(config.renpy_base + "/lib/python", "lib/python"),
|
||||
(config.renpy_base + "/manifest.xml", "manifest.xml"),
|
||||
(config.renpy_base + "/iliad-icon.png", "iliad-icon.png"),
|
||||
]
|
||||
|
||||
iliad_files.extend(tree(config.renpy_base + "/lib/linux-iliad", "lib/linux-iliad"))
|
||||
|
||||
iliad_data = { }
|
||||
|
||||
manifest = file(config.renpy_base + "/manifest.xml", "r").read()
|
||||
manifest = manifest.replace("GAMENAME", project.name)
|
||||
iliad_data["manifest.xml"] = manifest
|
||||
|
||||
zf = zipfile.ZipFile(name + "-iLiad.zip", "w", zipfile.ZIP_DEFLATED)
|
||||
|
||||
progress_len = len(multi) + len(iliad_files)
|
||||
store.message = u"We thank Hixbooks for sponsoring iLiad support."
|
||||
|
||||
for i, (fn, an) in enumerate(multi + iliad_files):
|
||||
|
||||
progress(u"Building iLiad", i, progress_len)
|
||||
|
||||
if os.path.isdir(fn):
|
||||
continue
|
||||
|
||||
zi = zipfile.ZipInfo(project.name + "/" + 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 ext in [ ".sh", ".so", "python", "python.real" ]:
|
||||
if fn.endswith(ext):
|
||||
zi.external_attr = long(0100777) << 16
|
||||
data = file(fn, "rb").read()
|
||||
break
|
||||
else:
|
||||
zi.external_attr = long(0100666) << 16
|
||||
data = file(fn, "rb").read()
|
||||
|
||||
data = iliad_data.get(an, data)
|
||||
zf.writestr(zi, data)
|
||||
|
||||
zf.close()
|
||||
|
||||
if mac:
|
||||
|
||||
mac_files = tree(config.renpy_base + "/renpy.app",
|
||||
project.name + ".app")
|
||||
|
||||
mac_files = [ (fn, an.replace("Ren'Py Launcher", project.name)) for (fn, an) in mac_files ]
|
||||
|
||||
# Data replacement for macintosh.
|
||||
mac_data = { }
|
||||
|
||||
quoted_name = project.name.replace("&", "&").replace("<", "<")
|
||||
info_plist = file(config.renpy_base + "/renpy.app/Contents/Info.plist", "rb").read().replace("Ren'Py Launcher", quoted_name)
|
||||
mac_data[project.name + ".app/Contents/Info.plist"] = info_plist
|
||||
|
||||
quoted_name = project.name.replace("\"", "\\\"")
|
||||
launcher_py = file(config.renpy_base + "/renpy.app/Contents/Resources/launcher.py", "rb").read().replace("Ren'Py Launcher", quoted_name)
|
||||
mac_data[project.name + ".app/Contents/Resources/launcher.py"] = launcher_py
|
||||
|
||||
if os.path.exists(project.path + "/icon.icns"):
|
||||
icon_data = file(project.path + "/icon.icns", "rb").read()
|
||||
mac_data[project.name + ".app/Contents/Resources/launcher.icns"] = icon_data
|
||||
|
||||
zf = zipfile.ZipFile(name + "-mac.zip", "w", zipfile.ZIP_DEFLATED)
|
||||
|
||||
progress_len = len(multi) + len(mac_files)
|
||||
store.message = u"Thank you for choosing Ren'Py."
|
||||
|
||||
for i, (fn, an) in enumerate(multi + mac_files):
|
||||
|
||||
progress(u"Building Mac OS X", i, progress_len)
|
||||
|
||||
if os.path.isdir(fn):
|
||||
continue
|
||||
|
||||
zi = zipfile.ZipInfo(name + "-mac/" + an)
|
||||
|
||||
s = os.stat(fn)
|
||||
zi.date_time = time.gmtime(s.st_mtime)[:6]
|
||||
zi.compress_type = zipfile.ZIP_DEFLATED
|
||||
zi.create_system = 3
|
||||
|
||||
if os.path.dirname(fn).endswith("MacOS") or fn.endswith(".so") or fn.endswith(".dylib"):
|
||||
zi.external_attr = long(0100777) << 16
|
||||
data = file(fn, "rb").read()
|
||||
else:
|
||||
zi.external_attr = long(0100666) << 16
|
||||
data = file(fn, "rb").read()
|
||||
|
||||
data = mac_data.get(an, data)
|
||||
zf.writestr(zi, data)
|
||||
|
||||
zf.close()
|
||||
|
||||
|
||||
# Announce Success
|
||||
|
||||
store.message = ""
|
||||
|
||||
title(u"Success")
|
||||
|
||||
mid()
|
||||
text(u"The distribution(s) have been built. Be sure to test them before release.")
|
||||
|
||||
spacer()
|
||||
|
||||
if mac:
|
||||
text(u"Note that unpacking and repacking Mac zips and Linux tarballs on Windows isn't supported.")
|
||||
|
||||
ui.close()
|
||||
|
||||
bottom()
|
||||
button(u"Return", clicked=ui.returns(True))
|
||||
ui.close()
|
||||
|
||||
interact()
|
||||
|
||||
|
||||
jump tools
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
# This file contains logic for detecting an editor, and for selecting
|
||||
# the default editor.
|
||||
|
||||
init:
|
||||
python hide:
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
|
||||
if not config.editor:
|
||||
|
||||
editor = os.path.normpath(config.renpy_base + "/jedit/jedit.jar")
|
||||
|
||||
if os.path.exists(editor):
|
||||
|
||||
editor = renpy.shell_escape(editor)
|
||||
|
||||
if sys.platform == 'win32':
|
||||
config.editor = 'javaw.exe -jar "' + editor + '" -reuseview "%(filename)s" +line:%(line)d "%(otherfiles)s"'
|
||||
config.editor_transient = 'javaw.exe -jar "' + editor + '" -newplainview "%(filename)s" +line:%(line)d "%(otherfiles)s"'
|
||||
else:
|
||||
config.editor = 'java -jar "' + editor + '" -reuseview "%(filename)s" +line:%(line)d "%(otherfiles)s"'
|
||||
config.editor_transient = 'java -jar "' + editor + '" -newplainview "%(filename)s" +line:%(line)d "%(otherfiles)s"'
|
||||
|
||||
if config.editor:
|
||||
os.environ['RENPY_EDITOR'] = config.editor
|
||||
if config.editor_transient:
|
||||
os.environ['RENPY_EDITOR_TRANSIENT'] = config.editor_transient
|
||||
|
||||
|
After Width: | Height: | Size: 21 KiB |
@@ -0,0 +1,167 @@
|
||||
label new:
|
||||
|
||||
python hide:
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import time
|
||||
|
||||
|
||||
# Select a template.
|
||||
|
||||
choices = [ (p.name, p.info["description"], p, None, False) for p in projects if p.info.get("template", None)]
|
||||
|
||||
template = paged_menu(u"Select a Template", choices, u"Please select a project to use as a template for your project.")
|
||||
|
||||
# Choose project name.
|
||||
|
||||
name = prompt(u"Project Name", u"Type the name of your new project, and press enter.\n", "main")
|
||||
name = name.strip()
|
||||
|
||||
error = None
|
||||
|
||||
if not name:
|
||||
error = u"Please enter a non-empty project name."
|
||||
elif os.path.exists(name):
|
||||
error = u"A file or directory named '%s' already exists." % name
|
||||
else:
|
||||
try:
|
||||
name = name.encode("ascii")
|
||||
except:
|
||||
error = u"Project names must be ASCII. This is because the ZIP file format does not support non-ASCII characters in a uniform way."
|
||||
|
||||
if error:
|
||||
store.error(u"Error", error, "main")
|
||||
|
||||
# Tell the user we're creating the project.
|
||||
title(u"Creating Project")
|
||||
store.message = u"Please wait while we create the project."
|
||||
ui.pausebehavior(0)
|
||||
interact()
|
||||
|
||||
# Here is where we actually create the project.
|
||||
|
||||
import shutil
|
||||
|
||||
shutil.copytree(template.path, name)
|
||||
|
||||
unlink = template.info.get("unlink", [ ])
|
||||
unlink += [ 'launcherinfo.py' ]
|
||||
|
||||
for i in unlink:
|
||||
if os.path.exists(name + "/" + i):
|
||||
os.unlink(name + "/" + i)
|
||||
|
||||
for dir, dirs, files in os.walk(name):
|
||||
for d in list(dirs):
|
||||
if d.startswith("."):
|
||||
dirs.remove(d)
|
||||
dn = dir + "/" + d
|
||||
shutil.rmtree(dn, True)
|
||||
|
||||
# Change the save directory.
|
||||
options = file(name + "/game/options.rpy").read()
|
||||
save_dir = "%s-%d" % (name, time.time())
|
||||
options = options.replace("template-1220804310", save_dir)
|
||||
file(name + "/game/options.rpy", "w").write(options)
|
||||
|
||||
persistent.project = name
|
||||
|
||||
call find_project from _call_find_project_2
|
||||
|
||||
label choose_theme:
|
||||
|
||||
python hide:
|
||||
|
||||
# Select a color scheme.
|
||||
|
||||
themes = theme_data.keys()
|
||||
themes.sort()
|
||||
|
||||
choices = [ ]
|
||||
for i in themes:
|
||||
|
||||
def hovered(i=i):
|
||||
td = theme_data[i].copy()
|
||||
engine = td["theme"]
|
||||
del td["theme"]
|
||||
|
||||
if engine == "roundrect":
|
||||
renpy.style.restore(style_backup)
|
||||
theme.roundrect(launcher=True, **td)
|
||||
renpy.style.rebuild()
|
||||
return ("repeat", 0)
|
||||
|
||||
choices.append((i, None, i, hovered, False))
|
||||
|
||||
color_theme = paged_menu(u"Select a Theme", choices, u"Please select a color theme for your project. You can always change the colors later.", cancel='color_theme_cancel')
|
||||
|
||||
# Restore default theme.
|
||||
renpy.style.restore(style_backup)
|
||||
theme.roundrect(launcher=True)
|
||||
renpy.style.rebuild()
|
||||
|
||||
ofn = project.path + "/game/options.rpy"
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
if not os.path.exists(ofn):
|
||||
error(u"Changing Theme", u"The options file does not seem to exist.", "main")
|
||||
|
||||
inf = file(ofn, "rU")
|
||||
outf = file(ofn + ".new", "w")
|
||||
|
||||
td = theme_data[color_theme]
|
||||
|
||||
# TODO: Make this less specific to roundrect. Need to figure out
|
||||
# how to switch themes, rather than just recolor them.
|
||||
|
||||
changing = False
|
||||
changed = False
|
||||
|
||||
for l in inf:
|
||||
|
||||
if re.match(r'\s*theme.roundrect\(', l):
|
||||
changing = True
|
||||
changed = True
|
||||
elif re.match(r'\s*\)', l):
|
||||
changing = False
|
||||
elif changing:
|
||||
|
||||
def repl(m, td=td):
|
||||
return m.group(1) + m.group(2) + " = \"" + td.get(m.group(2), m.group(3)) + "\","
|
||||
|
||||
l = re.sub(r'^(\s*)(\w+) = "([\da-fA-F#]+)",', repl, l)
|
||||
|
||||
outf.write(l)
|
||||
|
||||
outf.close()
|
||||
inf.close()
|
||||
|
||||
try:
|
||||
os.rename(ofn + ".new", ofn)
|
||||
except:
|
||||
|
||||
# I hate windows.
|
||||
os.rename(ofn, ofn + ".old")
|
||||
os.rename(ofn + ".new", ofn)
|
||||
os.unlink(ofn + ".old")
|
||||
|
||||
if not changed:
|
||||
error(u"Changing Theme", u"Could not modify options.rpy, perhaps it was edited too much.", "main")
|
||||
|
||||
jump main
|
||||
|
||||
|
||||
|
||||
label color_theme_cancel:
|
||||
|
||||
python hide:
|
||||
|
||||
# Restore default theme.
|
||||
renpy.style.restore(style_backup)
|
||||
theme.roundrect(launcher=True)
|
||||
renpy.style.rebuild()
|
||||
|
||||
jump main
|
||||
@@ -0,0 +1,343 @@
|
||||
|
||||
# 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
|
||||
|
||||
# The starting point of the resource segment in the file.
|
||||
RESOURCE_BASE=0x3600
|
||||
|
||||
# The virtual memory location the resource segment is loaded
|
||||
# to.
|
||||
RESOURCE_VIRTUAL=0x6000
|
||||
|
||||
# The offset of the field that tells us with the alignment need be.
|
||||
ALIGNMENT_FIELD = 0x130
|
||||
|
||||
# The start of the .rsrc segment header.
|
||||
RSRC_HEADER = 0x268
|
||||
|
||||
# Locations in the file where we need to patch in the resource
|
||||
# segment length.
|
||||
RESOURCE_LENGTH_PATCHES = [ 0x0184, RSRC_HEADER + 0x8 ]
|
||||
|
||||
# Locations in the file where we need to patch in the padded
|
||||
# resource segment length.
|
||||
RESOURCE_PADDED_PATCHES = [ RSRC_HEADER + 0x10 ]
|
||||
|
||||
# Locations in the file where we need to patch in the change in the
|
||||
# size of the resource segement (and hence the change in the file's
|
||||
# total size.)
|
||||
SIZE_DELTA_PATCHES = [ 0x148 ]
|
||||
|
||||
# A location in the file that will be checked to be sure it matches
|
||||
# RESOURCE_BASE.
|
||||
CHECK_ADDRESS = RSRC_HEADER + 0x14
|
||||
|
||||
# A location in the file that will be checked to make sure it matches
|
||||
# RESOURCE_VIRTUAL
|
||||
CHECK_ADDRESS2 = RSRC_HEADER + 0xc
|
||||
|
||||
# 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, fn):
|
||||
data = open(fn, "rb").read()
|
||||
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.
|
||||
|
||||
# This parses a data block out of the resources.
|
||||
def parse_data(offset):
|
||||
pe.seek(RESOURCE_BASE + offset)
|
||||
data_offset = pe.u32()
|
||||
data_len = pe.u32()
|
||||
code_page = pe.u32()
|
||||
pe.u32()
|
||||
|
||||
l = [ ]
|
||||
|
||||
pe.seek(data_offset + RESOURCE_BASE - RESOURCE_VIRTUAL)
|
||||
for i in range(data_len):
|
||||
l.append(chr(pe.u8()))
|
||||
|
||||
return (code_page, "".join(l))
|
||||
|
||||
# This parses a resource directory.
|
||||
def parse_directory(offset):
|
||||
|
||||
pe.seek(RESOURCE_BASE + offset)
|
||||
char = pe.u32()
|
||||
timedate = pe.u32()
|
||||
major = pe.u16()
|
||||
minor = pe.u16()
|
||||
n_named = pe.u16()
|
||||
n_id = pe.u16()
|
||||
|
||||
entries = [ ]
|
||||
|
||||
for i in range(n_named + n_id):
|
||||
entries.append((pe.u32(), pe.u32()))
|
||||
|
||||
rv = { }
|
||||
|
||||
for name, value in entries:
|
||||
|
||||
if name & 0x80000000:
|
||||
pe.seek((name & 0x7fffffff) + RESOURCE_BASE)
|
||||
name = pe.name()
|
||||
|
||||
if value & 0x80000000:
|
||||
value = parse_directory(value & 0x7fffffff)
|
||||
else:
|
||||
value = parse_data(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(fn)
|
||||
|
||||
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 pe
|
||||
pe = BinFile(oldexe)
|
||||
|
||||
# Check that RESOURCE_BASE and RESOURCE_VIRTUAL are still valid.
|
||||
pe.seek(CHECK_ADDRESS)
|
||||
if pe.u32() != RESOURCE_BASE:
|
||||
raise Exception("RESOURCE_BASE is no longer correct. Please check all relocations.")
|
||||
|
||||
pe.seek(CHECK_ADDRESS2)
|
||||
if pe.u32() != RESOURCE_VIRTUAL:
|
||||
raise Exception("RESOURCE_VIRTUAL is no longer correct. Please check all relocations.")
|
||||
|
||||
resources = parse_directory(0)
|
||||
# show_resources(resources, "")
|
||||
resources.update(load_icon(icofn))
|
||||
# show_resources(resources, "")
|
||||
|
||||
rsrc = Packer().pack(resources)
|
||||
rsrc_len = len(rsrc)
|
||||
|
||||
pe.seek(ALIGNMENT_FIELD)
|
||||
alignment = pe.u32()
|
||||
|
||||
if len(rsrc) % alignment:
|
||||
pad = alignment - (len(rsrc) % alignment)
|
||||
padding = "RENPYVNE" * (pad / 8 + 1)
|
||||
padding = padding[:pad]
|
||||
rsrc += padding
|
||||
|
||||
padded_len = len(rsrc)
|
||||
|
||||
for addr in RESOURCE_LENGTH_PATCHES:
|
||||
pe.set_u32(addr, rsrc_len)
|
||||
|
||||
for addr in RESOURCE_PADDED_PATCHES:
|
||||
pe.seek(addr)
|
||||
size_delta = padded_len - pe.u32()
|
||||
pe.set_u32(addr, padded_len)
|
||||
|
||||
for addr in SIZE_DELTA_PATCHES:
|
||||
pe.seek(addr)
|
||||
pe.set_u32(addr, pe.u32() + size_delta)
|
||||
|
||||
|
||||
return pe.tostring()[:RESOURCE_BASE] + rsrc
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
f = file(sys.argv[3], "wb")
|
||||
f.write(change_icons(sys.argv[1], sys.argv[2]))
|
||||
f.close()
|
||||
|
||||
@@ -0,0 +1,244 @@
|
||||
init 1 python:
|
||||
theme_data = {'Basic Blue': {'disabled': '#404040',
|
||||
'disabled_text': '#c8c8c8',
|
||||
'frame': '#6496c8',
|
||||
'gm_root': '#dcebff',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#dcebff',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#003c78',
|
||||
'widget_hover': '#0050a0',
|
||||
'widget_selected': '#ffffc8',
|
||||
'widget_text': '#c8ffff'},
|
||||
'Bloody Mary': {'disabled': '#400000',
|
||||
'disabled_text': '#260000',
|
||||
'frame': '#400808',
|
||||
'gm_root': '#000000',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#000000',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#000000',
|
||||
'widget_hover': '#830000',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#C2C2C2'},
|
||||
'Colorblind': {'disabled': '#898989',
|
||||
'disabled_text': '#666666',
|
||||
'frame': '#252525',
|
||||
'gm_root': '#393939',
|
||||
'label': '#c2c2c2',
|
||||
'mm_root': '#393939',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#898989',
|
||||
'widget_hover': '#464646',
|
||||
'widget_selected': '#F2F2F2',
|
||||
'widget_text': '#CCCCCC'},
|
||||
'Cotton Candy': {'disabled': '#C8AFA1',
|
||||
'disabled_text': '#E1D4C9',
|
||||
'frame': '#FCF5F2',
|
||||
'gm_root': '#D0B4BA',
|
||||
'label': '#805C40',
|
||||
'mm_root': '#D0B4BA',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#ECC7D0',
|
||||
'widget_hover': '#E1D4C9',
|
||||
'widget_selected': '#805C40',
|
||||
'widget_text': '#805C40'},
|
||||
'Creamsicle': {'disabled': '#FFECBF',
|
||||
'disabled_text': '#ffffff',
|
||||
'frame': '#FFECBF',
|
||||
'gm_root': '#FDF5E3',
|
||||
'label': '#502F13',
|
||||
'mm_root': '#FDF5E3',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#D96B00',
|
||||
'widget_hover': '#FD9B1C',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#FCE6B1'},
|
||||
'Dramatic Flesh': {'disabled': '#ab6038',
|
||||
'disabled_text': '#BF7C51',
|
||||
'frame': '#49271b',
|
||||
'gm_root': '#2a201f',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#2a201f',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#BF7C51',
|
||||
'widget_hover': '#dda570',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#E5DFDF'},
|
||||
'Easter Baby': {'disabled': '#DDE9FF',
|
||||
'disabled_text': '#A6AFBF',
|
||||
'frame': '#CCF8DC',
|
||||
'gm_root': '#FBF9DF',
|
||||
'label': '#698071',
|
||||
'mm_root': '#FBF9DF',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#F5D4EE',
|
||||
'widget_hover': '#F0DDFF',
|
||||
'widget_selected': '#000000',
|
||||
'widget_text': '#698071'},
|
||||
'Favorite Jeans': {'disabled': '#919994',
|
||||
'disabled_text': '#B6BFB9',
|
||||
'frame': '#6f7571',
|
||||
'gm_root': '#b0b8ba',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#b0b8ba',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#8699a7',
|
||||
'widget_hover': '#9eb1ad',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#dcdfd6'},
|
||||
'Fine China': {'disabled': '#ADB9CC',
|
||||
'disabled_text': '#DFBA14',
|
||||
'frame': '#ADB9CC',
|
||||
'gm_root': '#F7F7FA',
|
||||
'label': '#39435E',
|
||||
'mm_root': '#F7F7FA',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#6A7183',
|
||||
'widget_hover': '#1A2B47',
|
||||
'widget_selected': '#E3E3E4',
|
||||
'widget_text': '#C9C9CB'},
|
||||
'First Valentines': {'disabled': '#F8F2D0',
|
||||
'disabled_text': '#BFA1A1',
|
||||
'frame': '#F8F2D0',
|
||||
'gm_root': '#D98989',
|
||||
'label': '#5D1010',
|
||||
'mm_root': '#D98989',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#F09898',
|
||||
'widget_hover': '#D6C5BB',
|
||||
'widget_selected': '#B31E1E',
|
||||
'widget_text': '#593131'},
|
||||
'Ice Queen': {'disabled': '#F0F2F2',
|
||||
'disabled_text': '#FBFBFB',
|
||||
'frame': '#ffffff',
|
||||
'gm_root': '#E6E6E6',
|
||||
'label': '#D9D9D9',
|
||||
'mm_root': '#E6E6E6',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#D9D9D9',
|
||||
'widget_hover': '#F0F2F2',
|
||||
'widget_selected': '#737373',
|
||||
'widget_text': '#ffffff'},
|
||||
'Mocha Latte': {'disabled': '#614D3A',
|
||||
'disabled_text': '#80654D',
|
||||
'frame': '#926841',
|
||||
'gm_root': '#1A140E',
|
||||
'label': '#F1EBE5',
|
||||
'mm_root': '#1A140E',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#4D3B29',
|
||||
'widget_hover': '#996E45',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#B99D83'},
|
||||
'Muted Horror': {'disabled': '#73735C',
|
||||
'disabled_text': '#8C8C70',
|
||||
'frame': '#555544',
|
||||
'gm_root': '#1A0001',
|
||||
'label': '#1A0001',
|
||||
'mm_root': '#1A0001',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#777777',
|
||||
'widget_hover': '#73735C',
|
||||
'widget_selected': '#000000',
|
||||
'widget_text': '#404033'},
|
||||
'Old Polaroid': {'disabled': '#A89E7D',
|
||||
'disabled_text': '#CCC097',
|
||||
'frame': '#49403E',
|
||||
'gm_root': '#A84A3E',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#A84A3E',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#A89E7D',
|
||||
'widget_hover': '#8DB6B9',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#49403E'},
|
||||
'Really Red': {'disabled': '#404040',
|
||||
'disabled_text': '#c8c8c8',
|
||||
'frame': '#e17373',
|
||||
'gm_root': '#ffd0d0',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#ffd0d0',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#963232',
|
||||
'widget_hover': '#c83232',
|
||||
'widget_selected': '#ffffc8',
|
||||
'widget_text': '#ffffff'},
|
||||
'Summer Sky': {'disabled': '#6074BF',
|
||||
'disabled_text': '#7383BF',
|
||||
'frame': '#6074BF',
|
||||
'gm_root': '#B4CDD4',
|
||||
'label': '#94C7D4',
|
||||
'mm_root': '#B4CDD4',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#F2E6AA',
|
||||
'widget_hover': '#FCFCA4',
|
||||
'widget_selected': '#1A5766',
|
||||
'widget_text': '#7DA8B3'},
|
||||
'Swamp Critter': {'disabled': '#A2521D',
|
||||
'disabled_text': '#753D00',
|
||||
'frame': '#797C1C',
|
||||
'gm_root': '#B09D5A',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#B09B4F',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#753D00',
|
||||
'widget_hover': '#B19A48',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#CCCAC2'},
|
||||
'Urban Sprawl': {'disabled': '#8F0000',
|
||||
'disabled_text': '#333333',
|
||||
'frame': '#8F0000',
|
||||
'gm_root': '#000000',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#000000',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#333333',
|
||||
'widget_hover': '#000000',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#6C8A2F'},
|
||||
'Victorian Gingerbread': {'disabled': '#7A674F',
|
||||
'disabled_text': '#664F33',
|
||||
'frame': '#BF8A73',
|
||||
'gm_root': '#695640',
|
||||
'label': '#F2EDC4',
|
||||
'mm_root': '#695640',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#7A674F',
|
||||
'widget_hover': '#BDA77D',
|
||||
'widget_selected': '#FDFBEE',
|
||||
'widget_text': '#F2EDC4'},
|
||||
'Watermelon Pie': {'disabled': '#FABF46',
|
||||
'disabled_text': '#FFE06D',
|
||||
'frame': '#C3CD91',
|
||||
'gm_root': '#F7F7C5',
|
||||
'label': '#FCFCD7',
|
||||
'mm_root': '#F7F7C5',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#FFE06D',
|
||||
'widget_hover': '#E38A4F',
|
||||
'widget_selected': '#996600',
|
||||
'widget_text': '#FAA700'},
|
||||
'White Chocolate': {'disabled': '#614D3A',
|
||||
'disabled_text': '#80654D',
|
||||
'frame': '#926841',
|
||||
'gm_root': '#FBF9EA',
|
||||
'label': '#F1EBE5',
|
||||
'mm_root': '#FBF9EA',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#33271C',
|
||||
'widget_hover': '#ECE7C4',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#B99D83'},
|
||||
'Winter Mint': {'disabled': '#426143',
|
||||
'disabled_text': '#819981',
|
||||
'frame': '#245536',
|
||||
'gm_root': '#e5f1e5',
|
||||
'label': '#ffffff',
|
||||
'mm_root': '#e5f1e5',
|
||||
'theme': 'roundrect',
|
||||
'widget': '#7AA27B',
|
||||
'widget_hover': '#A3C7A3',
|
||||
'widget_selected': '#ffffff',
|
||||
'widget_text': '#CDE0CE'}}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||