Compare commits

...

17 Commits

Author SHA1 Message Date
Tom Rothamel 37e8fd19cd Set _last_say_window at the start of a say statement. 2011-02-07 09:54:54 -05:00
Tom Rothamel f600e6a24b Remove texture unit check. 2011-02-06 17:38:30 -05:00
Tom Rothamel ca9009f5fe Fix problems with menu prediction. Doc/screen fixes. 2011-02-06 16:09:40 -05:00
Tom Rothamel 9a299a9b38 Make chosen work. 2011-02-06 10:51:20 -05:00
Tom Rothamel 845ae6e7ba Add FileSlotName. 2011-02-06 09:48:03 -05:00
Tom Rothamel 8f706107ac 6.12.0d 2011-02-05 21:28:37 -05:00
Tom Rothamel d489199e00 Screen tweaks, doc fixes. 2011-02-05 21:06:39 -05:00
Tom Rothamel bf023dc2e3 Only select FileSave if confirm=True. 2011-02-05 20:17:00 -05:00
Tom Rothamel ac6b04b5e3 Add FilePageName. 2011-02-05 16:53:14 -05:00
Tom Rothamel a34de5d601 Predict main_menu while in splashscreen.
Better logging on image cache misses.

Minor bug/doc fixes.
2011-02-05 13:58:15 -05:00
Tom Rothamel b9900776a8 Fix choice example 2011-02-03 23:53:57 -05:00
Tom Rothamel 12a444c11f Bump version. 2011-02-03 22:14:29 -05:00
Tom Rothamel 433473e53e No predict when a movie is playing; image cache debugging; gl debugging. 2011-02-03 21:39:57 -05:00
Tom Rothamel d5f889767a Multiple changes.
* Change how chosen choices are reported to screens.
* Don't use raw pygame to report an error.
* Check in the documentation includes.
2011-02-03 00:20:03 -05:00
Tom Rothamel 9873dd487c Don't go fullscreen on Android. 2011-02-02 00:30:44 -05:00
Tom Rothamel ec8bed61f1 Add xminimum property. Rewrite compute_subrect as compute_subline, which
winds up with clearer code.
2011-02-02 00:24:48 -05:00
Tom Rothamel d76971385d Fix typos. (Thanks backansi.) 2011-01-30 21:50:36 -05:00
58 changed files with 3061 additions and 283 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ init -1210 python:
if version <= (6, 11, 2):
config.imagereference_respects_position = True
config.predict_screens = False
config.choice_screen_ids = False
config.choice_screen_chosen = False
+11 -2
View File
@@ -94,7 +94,7 @@ init -1180 python:
def _default_empty_window():
who = _last_say_who
if who is not None:
@@ -238,7 +238,8 @@ init -1180 python:
config.screenshot_callback = _screenshot_callback
_predict_screens = [ ]
init -1180 python hide:
def dump_styles():
@@ -352,6 +353,11 @@ init -1180 python hide:
# Prediction of screens.
def predict():
for s in _predict_screens:
if renpy.has_screen(s):
renpy.predict_screen(s)
s = _game_menu_screen
if s is None:
@@ -367,6 +373,7 @@ init -1180 python hide:
renpy.predict_screen(s)
return
config.predict_callbacks.append(predict)
def imagemap_auto_function(auto_param, variant):
@@ -782,7 +789,9 @@ label _start:
$ renpy.block_rollback()
$ _old_game_menu_screen = _game_menu_screen
$ _old_predict_screens = _predict_screens
$ _game_menu_screen = None
$ _predict_screens = [ 'main_menu' ]
if renpy.has_label("splashscreen") and not _restart:
call expression "splashscreen" from _call_splashscreen_1
+77 -4
View File
@@ -61,7 +61,7 @@ init -1140 python:
self.transition = transition
def predict(self):
renpy.predict_screen(self.scren, **self.kwargs)
renpy.predict_screen(self.screen, **self.kwargs)
def __call__(self):
renpy.show_screen(self.screen, **self.kwargs)
@@ -239,7 +239,8 @@ init -1140 python:
def predict(self):
renpy.predict_screen(self.screen)
if renpy.has_screen(self.screen):
renpy.predict_screen(self.screen)
def __call__(self):
@@ -988,6 +989,9 @@ init -1140 python:
If true, then this file will be marked as the newest save
file when it's saved. (Set this to false for a quicksave,
for example.)
`page`
The name of the page that it will be saved to.
"""
def __init__(self, name, confirm=True, newest=True, page=None):
@@ -1024,6 +1028,9 @@ init -1140 python:
return True
def get_selected(self):
if not self.confirm:
return False
return persistent._file_newest == __filename(self.name, self.page)
class FileLoad(Action):
@@ -1059,6 +1066,9 @@ init -1140 python:
return renpy.scan_saved_game(__filename(self.name, self.page))
def get_selected(self):
if not self.confirm:
return False
return persistent._file_newest == __filename(self.name, self.page)
class FileDelete(Action):
@@ -1131,7 +1141,7 @@ init -1140 python:
def get_sensitive(self):
if self.page == "auto" and not config.has_autosave:
return False
elif self.page == "quicksave" and not config.has_quicksave:
elif self.page == "quick" and not config.has_quicksave:
return False
else:
return True
@@ -1139,7 +1149,70 @@ init -1140 python:
def get_selected(self):
return self.page == persistent._file_page
def FilePageName(auto="a", quick="q"):
"""
:doc: file_action_function
Returns the name of the current file page, as a string. If a normal
page, this returns the page number. Otherwise, it returns
`auto` or `quick`.
"""
page = persistent._file_page
if page == "quick":
return quick
elif page == "auto":
return auto
else:
return page
def FileSlotName(slot, slots_per_page, auto="a", quick="q", format="%s%d"):
"""
:doc: file_action_function
Returns the name of the numbered slot. This assumes that slots on
normal pages are numbered in a linear order starting with 1, and
that page numbers start with 1. When slot is 2, and slots_per_page
is 10, and the other variables are the defauts:
* When the first page is slowing, this returns "2".
* When the second page is showing, this returns "12".
* When the auto page is showing, this returns "a2".
* When the quicksave page is showing, this returns "q2".
`slot`
The number of the slot to access.
`slots_per_page`
The number of slots per page.
`auto`
A prefix to use for the auto page.
`quick`
A prefix to use for the quick page.
`format`
The formatting code to use. This is given two arguments: A string
giving the page prefix, and an integer giving the slot number.
"""
page = persistent._file_page
if page == "quick":
prefix = quick
page = 0
elif page == "auto":
prefix = auto
page = 0
else:
prefix = ""
page = int(page) - 1
return format % (prefix, page * slots_per_page + slot)
class FilePageNext(Action):
"""
:doc: file_action
+5 -3
View File
@@ -2609,12 +2609,14 @@ cdef extern from "glcompat.h":
"""
FOOTER = """\
cdef inline gl_error_check():
import renpy
cdef inline gl_check(where):
cdef GLenum error
error = glGetError()
if error:
import renpy
raise renpy.display.gldraw.GLError("Error code 0x%x (%d)." % (error, error))
renpy.log.info("GL error 0x%X at %s", error, where)
"""
def main():
+1 -1
View File
@@ -29,7 +29,7 @@ import os
# ***** ***** ***** ***** ***** ***** **** ***** ***** ***** *****
# Be sure to change script_version in launcher/script_version.rpy, too!
# Be sure to change _renpy.pyx and module.py, if necessary.
version = "Ren'Py 6.12.0b"
version = "Ren'Py 6.12.0e"
# Other versions.
+3 -3
View File
@@ -359,13 +359,13 @@ class Say(Node):
if renpy.config.say_menu_text_filter:
what = renpy.config.say_menu_text_filter(what) # E1102
say_menu_with(self.with_, renpy.game.interface.set_transition)
renpy.exports.say(who, what, interact=getattr(self, 'interact', True))
if getattr(who, "record_say", True):
renpy.store._last_say_who = self.who
renpy.store._last_say_what = what
say_menu_with(self.with_, renpy.game.interface.set_transition)
renpy.exports.say(who, what, interact=getattr(self, 'interact', True))
return self.next
def predict(self):
+4 -1
View File
@@ -94,8 +94,12 @@ def mac_start(fn):
def popen_del(self, *args, **kwargs):
return
report_error = None
def bootstrap(renpy_base):
global report_error
global renpy # W0602
import renpy.log
@@ -262,7 +266,6 @@ def bootstrap(renpy_base):
sys.exit(0)
keep_running = True
report_error = None
try:
while keep_running:
+1 -1
View File
@@ -461,7 +461,7 @@ predict_callbacks = [ ]
predict_screens = True
# Should we use the new choice screen format?
choice_screen_ids = True
choice_screen_chosen = True
# Should the narrator speak menu labels?
narrator_menu = False
+5 -1
View File
@@ -1596,6 +1596,9 @@ class Interface(object):
keyword arguments are passed off to interact_core.
"""
# Cancel magic error reporting.
renpy.bootstrap.report_error = None
context = renpy.game.context()
if context.interacting:
@@ -2034,7 +2037,8 @@ class Interface(object):
while (prediction_coroutine is not None) \
and not needs_redraw \
and not self.event_peek():
and not self.event_peek() \
and not renpy.audio.music.is_playing("movie"):
result = prediction_coroutine.next()
if not result:
+8 -12
View File
@@ -1358,16 +1358,12 @@ cdef extern from "glcompat.h":
GL_ZOOM_X
GL_ZOOM_Y
cdef inline check(where):
cdef GLenum error
error = glGetError()
if error:
print "GL error 0x%X at %s" % (error, where)
cdef inline gl_error_check():
cdef GLenum error
error = glGetError()
if error:
import renpy
raise renpy.display.gldraw.GLError("Error code 0x%x (%d)." % (error, error))
import renpy
cdef inline gl_check(where):
cdef GLenum error
error = glGetError()
if error:
renpy.log.info("GL error 0x%X at %s", error, where)
+7 -6
View File
@@ -187,6 +187,9 @@ cdef class GLDraw:
if self.did_init:
self.deinit()
if renpy.android:
fullscreen = False
if fullscreen != self.old_fullscreen:
@@ -316,6 +319,8 @@ cdef class GLDraw:
# Prepare a mouse display.
self.mouse_old_visible = None
gl_check("set_mode")
return True
def deinit(self):
@@ -423,11 +428,6 @@ cdef class GLDraw:
renpy.log.info("Number of texture units: %d", texture_units)
if texture_units < 4 and not self.fast_dissolve:
renpy.log.info("Not enough texture units.")
return False
# Count the number of clip planes.
cdef GLint clip_planes = 0
@@ -672,6 +672,7 @@ cdef class GLDraw:
pygame.display.flip()
renpy.display.core.cpu_idle.clear()
gl_check("draw_screen")
cpdef int draw_render_textures(GLDraw self, what, bint non_aligned):
"""
@@ -741,7 +742,7 @@ cdef class GLDraw:
if isinstance(what, gltexture.TextureGrid):
self.set_clip(clip)
gltexture.blit(
<gltexture.TextureGrid> what,
xo,
+35 -21
View File
@@ -94,6 +94,8 @@ class Cache(object):
self.preload_thread.setDaemon(True)
self.preload_thread.start()
# Have we been added this tick?
self.added = set()
def init(self):
self.cache_limit = renpy.config.image_cache_size * renpy.config.screen_width * renpy.config.screen_height
@@ -122,6 +124,8 @@ class Cache(object):
self.size_of_current_generation = 0
self.total_cache_size = 0
self.added.clear()
self.lock.release()
# Increments time, and clears the list of images to be
@@ -133,10 +137,13 @@ class Cache(object):
self.preloads = [ ]
self.first_preload_in_tick = True
self.size_of_current_generation = 0
self.added.clear()
if renpy.config.debug_image_cache:
print "IC ----"
renpy.log.debug("IC ----")
filename, line = renpy.exports.get_filename_line()
renpy.log.debug("IC %s %d", filename, line)
# The preload thread can deal with this update, so we don't need
# to lock things.
def end_tick(self):
@@ -147,7 +154,7 @@ class Cache(object):
# image. It also takes care of updating the age of images in the
# cache to be current, and maintaining the size of the current
# generation of images.
def get(self, image):
def get(self, image, predict=False):
if not isinstance(image, ImageBase):
raise Exception("Expected an image of some sort, but got" + str(image) + ".")
@@ -194,8 +201,12 @@ class Cache(object):
renpy.display.render.mutated_surface(ce.surf)
if renpy.config.debug_image_cache:
print "IC Added %r (%.02f%%)" % (ce.what, 100.0 * self.total_cache_size / self.cache_limit)
if predict:
renpy.log.debug("IC Added %r (%.02f%%)", ce.what, 100.0 * self.total_cache_size / self.cache_limit)
else:
renpy.log.debug("IC Total Miss %r", ce.what)
renpy.display.draw.load_texture(ce.surf)
self.lock.release()
@@ -225,7 +236,7 @@ class Cache(object):
del self.cache[ce.what]
if renpy.config.debug_image_cache:
print "IC Removed", ce.what
renpy.log.debug("IC Removed %r", ce.what)
def cleanout(self):
"""
@@ -260,22 +271,27 @@ class Cache(object):
# Called to report that a given image would like to be preloaded.
def preload_image(self, im):
if renpy.config.debug_image_cache:
print "IC Request Preload", im
if not isinstance(im, ImageBase):
if renpy.config.debug_image_cache:
print "IC Can't preload non-image: ", im
else:
return
with self.lock:
if im in self.added:
return
with self.lock:
self.added.add(im)
if im in self.cache:
self.get(im)
in_cache = True
else:
self.preloads.append(im)
self.lock.notify()
in_cache = False
if in_cache and renpy.config.debug_image_cache:
renpy.log.debug("IC Kept %r", im)
def preload_thread_main(self):
@@ -290,6 +306,11 @@ class Cache(object):
# If the size of the current generation is bigger than the
# total cache size, stop preloading.
if self.size_of_current_generation > self.cache_limit:
if renpy.config.debug_image_cache:
for i in self.preloads:
renpy.log.debug("IC Overfull %r", i)
self.preloads = [ ]
break
@@ -300,7 +321,7 @@ class Cache(object):
if image not in self.preload_blacklist:
try:
self.get(image)
self.get(image, True)
except:
self.preload_blacklist.add(image)
@@ -322,9 +343,6 @@ class Cache(object):
if i in workset:
workset.remove(i)
else:
if renpy.config.debug_image_cache:
print "IC Pin Clear", image
surf = self.pin_cache[i]
del self.pin_cache[i]
@@ -340,10 +358,6 @@ class Cache(object):
if self.preloads:
break
# Otherwise, pin preload the image.
if renpy.config.debug_image_cache:
print "IC Pin Preload", image
try:
surf = image.load()
self.pin_cache[image] = surf
+3 -1
View File
@@ -589,7 +589,9 @@ def SnowBlossom(d,
as long as the second number in a tuple is larger than the first.
`start`
The delay, in seconds, to start each particle.
The delay, in seconds, before each particle is added. This can be
allows the particles to start at the top of the screen, while not
looking like a "wave" effect.
`fast`
If true, particles start in the center of the screen, rather than
+2 -2
View File
@@ -22,7 +22,6 @@
# This file contains the routines that manage image prediction.
import traceback
import renpy
# Called to indicate an image should be loaded or preloaded. This is
@@ -128,7 +127,8 @@ def prediction_coroutine(root_widget):
renpy.display.screen.predict_screen(name, **kwargs)
except:
if renpy.config.debug_image_cache:
traceback.print_exc()
renpy.log.debug("While predicting screen %s %r", name, kwargs)
renpy.log.debug_exception()
predicting = False
+54 -49
View File
@@ -395,44 +395,38 @@ def mark_sweep():
live_renders = worklist
def compute_subrect(pos, size, child):
def compute_subline(sx0, sw, cx0, cw):
"""
Computes a sub-rectangle. Takes the source x and y, the source width
and height, and the clipping rectangle. Returns status, offset, crop.
Given a source line (start sx0, width sw) and a crop line (cx0, cw),
return three things:
* The offset of the portion of the source line that overlaps with
the crop line, relative to the crop line.
* The offset of the portion of the source line that overlaps with the
the crop line, relative to the source line.
* The length of the overlap in pixels. (can be <= 0)
"""
(sx, sy) = pos
(sw, sh) = size
(cx, cy, cw, ch) = child
sx1 = sx0 + sw
cx1 = cx0 + cw
if sx0 > cx0:
start = sx0
else:
start = cx0
offset = start - cx0
crop = start - sx0
if sx1 < cx1:
width = sx1 - start
else:
width = cx1 - start
# The coordinates of the upper-left corner of the source
# rectangle inside the clipping rectange.
ulx = sx - cx
uly = sy - cy
if ulx < 0:
ox = 0
sx = -ulx
else:
ox = ulx
sx = 0
if uly < 0:
oy = 0
sy = -uly
else:
oy = uly
sy = 0
if ox > cw or oy > ch:
return False, (0, 0), (0, 0, 0, 0)
sw = min(sw - sx, cw - ox)
sh = min(sh - sy, ch - oy)
return True, (ox, oy), (sx, sy, sw, sh)
return offset, crop, width
# Possible operations that can be done as part of a render.
@@ -682,9 +676,16 @@ cdef class Render:
(x, y, w, h) = rect
rv = Render(w, h)
reverse = self.reverse
# This doesn't actually make a subsurface, as we can't easily do
# so for non-rectangle-aligned renders.
if (self.reverse is not None) and (self.reverse is not IDENTITY):
if (reverse is not None) and (
reverse.xdx != 1.0 or
reverse.xdy != 0.0 or
reverse.ydx != 0.0 or
reverse.ydy != 1.0):
rv.clipping = True
rv.blit(self, (-x, -y), focus=focus, main=True)
return rv
@@ -693,11 +694,17 @@ cdef class Render:
# making an actual subsurface.
for child, cx, cy, cfocus, cmain in self.children:
state, offset, crop = compute_subrect((cx, cy), child.get_size(), rect)
if not state:
cw, ch = child.get_size()
xo, cx, cw = compute_subline(cx, cw, x, w)
yo, cy, ch = compute_subline(cy, ch, y, h)
if cw <= 0 or ch <= 0:
continue
crop = (cx, cy, cw, ch)
offset = (xo, yo)
if isinstance(child, Render):
child = child.subsurface(crop, focus=focus)
else:
@@ -713,28 +720,26 @@ cdef class Render:
if xo is None:
rv.add_focus(d, arg, xo, yo, fw, fh, mx, my, mask)
continue
status, offset, crop = compute_subrect(
(xo, yo), (fw, fh), rect)
if not status:
xo, cx, fw = compute_subline(xo, fw, x, w)
yo, cy, fh = compute_subline(yo, fh, y, h)
if cw <= 0 or ch <= 0:
continue
(xo, yo) = offset
(ignored1, ignored2, fw, fh) = crop
if mx is not None:
status, offset, crop = compute_subrect(
(mx, my), mask.get_size(), rect)
mw, mh = mask.get_size()
if not status:
mx, mcx, mw = compute_subline(mx, mw, x, w)
my, mcy, mh = compute_subline(my, mh, y, h)
if mw <= 0 or mh <= 0:
mx = None
my = None
mask = None
else:
mx, my = offset
mask = mask.subsurface(crop)
mask = mask.subsurface((mcx, mcy, mw, mh))
rv.add_focus(d, arg, xo, yo, fw, fh, mx, my, mask)
+1 -1
View File
@@ -467,7 +467,7 @@ def predict_screen(_screen_name, _widget_properties={}, **kwargs):
name = _screen_name
if renpy.config.debug_image_cache:
print "IC Predict screen", name
renpy.log.debug("IC Predict screen %s", name)
if not isinstance(name, tuple):
name = tuple(name.split())
+9 -23
View File
@@ -412,16 +412,14 @@ def predict_menu():
#
# An item lets us load imagebuttons as necessary.
items = [ ("Menu Prediction", True, "button", "caption") ]
props = {
"button" : { "style" : "menu_choice_button" },
"caption" : { "style" : "menu_choice" },
}
if not renpy.config.choice_screen_chosen:
return
items = [ ("Menu Prediction", True, False) ]
predict_screen(
"choice",
items=items,
_widget_properties=props,
)
@@ -496,12 +494,8 @@ def display_menu(items,
props = { }
else:
props = widget_properties
props["window"] = { "style" : window_style }
for i, (label, value) in enumerate(items):
button_id = "button_%d" % i
caption_id = "caption_%d" % i
if not label:
value = None
@@ -511,18 +505,10 @@ def display_menu(items,
else:
action = None
if value is None:
props[caption_id] = { "style" : caption_style }
if (location, label) in chosen:
props[button_id] = { "style" : choice_chosen_button_style }
props[caption_id] = { "style" : choice_chosen_style }
else:
props[button_id] = { "style" : choice_button_style }
props[caption_id] = { "style" : choice_style }
if renpy.config.choice_screen_ids:
item_actions.append((label, action, button_id, caption_id))
label_chosen = ((location, label) in chosen)
if renpy.config.choice_screen_chosen:
item_actions.append((label, action, label_chosen))
else:
item_actions.append((label, action))
@@ -559,7 +545,7 @@ def display_menu(items,
# Mark this as chosen.
for label, val in items:
if rv == val:
chosen[(location, val)] = True
chosen[(location, label)] = True
for label, val in items:
+1 -1
View File
@@ -162,7 +162,7 @@ class Preferences(renpy.object.Object):
self.volumes[mixer] = volume
def get_volume(self, mixer):
return self.volumes[mixer]
return self.volumes.get(mixer, 0)
def set_mute(self, mixer, mute):
self.mute[mixer] = mute
+2 -2
View File
@@ -309,7 +309,7 @@ autosave_counter = 0
def autosave_thread(take_screenshot):
global autosave_counter
renpy.display.core.cpu_idle.wait()
cycle_saves("auto-", renpy.config.autosave_slots)
@@ -318,7 +318,7 @@ def autosave_thread(take_screenshot):
extra_info = renpy.config.auto_save_extra_info()
else:
extra_info = ""
try:
try:
if take_screenshot:
+6 -2
View File
@@ -471,6 +471,7 @@ position_properties = [ Style(i) for i in [
"yalign",
"xoffset",
"yoffset",
"maximum",
"xmaximum",
"ymaximum",
"area",
@@ -504,8 +505,7 @@ text_properties = [ Style(i) for i in [
"text_align",
"text_y_fudge",
"underline",
"xmaximum",
"ymaximum",
"minimum",
"xminimum",
"yminimum",
] ]
@@ -526,6 +526,7 @@ window_properties = [ Style(i) for i in [
"xpadding",
"ypadding",
"size_group",
"minimum",
"xminimum",
"yminimum",
] ]
@@ -560,6 +561,9 @@ box_properties = [ Style(i) for i in [
"spacing",
"first_spacing",
"fit_first",
"minimum",
"xminimum",
"yminimum",
] ]
ui_properties = [
+6 -1
View File
@@ -275,6 +275,11 @@ substitutes = dict(
('xmaximum', index_0),
('ymaximum', index_1),
],
minimum = [
('xminimum', index_0),
('yminimum', index_1),
],
area = [
('xpos', index_0),
@@ -399,7 +404,7 @@ class StyleManager(object):
rest = name
while "_" in name:
while "_" in rest:
first, rest = rest.split("_", 1)
if rest in style_map:
s = Style(rest)
+6 -1
View File
@@ -97,7 +97,9 @@ Screens
Ren'Py now ships with a default set of screens, which are used by the
demo and installed by default when a new game is created. You can find
them in template/game/screens.rpy, and they can be used by copying
that file into your project.
that file into your project. These screens are not 100% compatible
with the previous layout system - for example, some styles have
changed. That's why games must opt-in to them.
The definition of the `items` parameter of the :ref:`Choice` and
:ref:`NVL` screens has changed, and games will need to be updated to work
@@ -114,6 +116,9 @@ imagemaps and imagebuttons.
The imagemap caching behavior described above applies only to screens.
The :func:`FilePageName` and :func:`FileSlotName` functions make it easier
to name slots
Other Improvements
------------------
+8
View File
@@ -1,6 +1,14 @@
Distributor Notes
=================
6.12.0
------
Ren'Py now creates a number of binary modules that live in the
renpy.display package. As long as they go in the same place as
_renpy.so, they should be picked up automatically.
6.11.0
------
+35
View File
@@ -0,0 +1,35 @@
.. Automatically generated file - do not modify.
.. function:: Play(channel, file, **kwargs)
Causes an audio file to be played on a given channel.
`channel`
The channel to play the sound on.
`file`
The file to play.
Any keyword arguments are passed to :func:`renpy.music.play`
.. function:: Queue(channel, file, **kwargs)
Causes an audio file to be queued on a given channel.
`channel`
The channel to play the sound on.
`file`
The file to play.
Any keyword arguments are passed to :func:`renpy.music.queue`
.. function:: Stop(channel, **kwargs)
Causes an audio channel to be stopped.
`channel`
The channel to play the sound on.
`file`
The file to play.
Any keyword arguments are passed to :func:`renpy.music.play`
+164
View File
@@ -0,0 +1,164 @@
.. Automatically generated file - do not modify.
.. function:: Character(name, kind=adv, **args)
Creates and returns a Character object, which controls the look
and feel of dialogue and narration.
`name`
If a string, the name of the character for dialogue. When
`name` is ``None``, display of the name is omitted, as for
narration.
`kind`
The Character to base this Character off of. When used, the
default value of any argument not supplied to this Character
is the value of that argument supplied to `kind`. This can
be used to define a template character, and then copy that
character with changes.
**Prefixes and Suffixes.**
These allow a prefix and suffix to be applied to the name of the
character, and to the text being shown. This can be used, for
example, to add quotes before and after each line of dialogue.
`what_prefix`
A string that is prepended to the dialogue being spoken before
it is shown.
`what_suffix`
A string that is appended to the dialogue being spoken before
it is shown.
`who_prefix`
A string that is prepended to the name of the character before
it is shown.
`who_suffix`
A string that is appended to the name of the character before
it is shown.
**Changing Name Display.**
These options help to control the display of the name.
`dynamic`
If true, then `name` should be a string containing a python
expression. That string will be evaluated before each line
of dialogue, and the result used as the name of the character.
`image`
If true, then `name` is expected to name an image file. That
image is used as the name of the character.
**Controlling Interactions.**
These options control if the dialogue is displayed, if an
interaction occurs, and the mode that is entered upon display.
`condition`
If given, this should be a string containing a python
expression. If the expression is false, the dialogue
does not occur, as if the say statement did not happen.
`interact`
If true, the default, an interaction occurs whenever the
dialogue is shown. If false, an interaction will not occur,
and additional elements can be added to the screen.
`mode`
A string giving the mode to enter when this character
speaks. See the section on :ref:`modes <modes>` for more details.
`callback`
A function that is called when events occur while the
character is speaking. See the section on
:ref:`character callbacks` fore more information.
**Click-to-continue.**
A click-to-continue indicator is displayed once all the text has
finished displaying, to prompt the user to advance.
`ctc`
A Displayable to use as the click-to-continue indicator, unless
a more specific indicator is used.
`ctc_pause`
A Displayable to use a the click-to-continue indicator when the
display of text is paused by the {p} or {w} text tags.
`ctc_timedpause`
A Displayable to use a the click-to-continue indicator when the
display of text is paused by the {p=} or {w=} text tags. When
None, this takes its default from ctc_pause, use ``Null()``
when you want a ctc_pause but no ctc_timedpause.
`ctc_position`
Controls the location of the click-to-continue indicator. If
``"nestled"``, the indicator is displayed as part of the text
being shown, immediately after the last character. If ``"fixed"``,
the indicator is added to the screen, and its position is
controlled by the position style properties.
**Screens.**
The display of dialogue uses a :ref:`screen <screens>`. These arguments
allow you to select that screen, and to provide arguments to it.
`screen`
The name of the screen that is used to display the dialogue.
Keyword arguments beginning with ``show_`` have the prefix
stripped off, and are passed to the screen as arguments. For
example, the value of ``show_side_image`` will become the
value of the ``side_image`` variable in the screen.
Some useful ``show_`` variables implemented by the default screens are:
`show_side_image`
When given a Displayable, shows that displayable when the
dialogue is shown. The position of that displayable is
controlled by its position properties. This is often used
to show an image of the speaking character to the side
of the dialogue.
`show_two_window`
If true, restructures the layout so that the name of the
character is placed in one window, and the dialogue text in a
second window.
**Styling Text and Windows.**
Keyword arguments beginning with ``who_``, ``what_``, and
`window_`` have their prefix stripped, and are used to :ref:`style
<styles>` the character name, the spoken text, and the window
containing both, respectively.
For example, if a character is given the keyword argument
``who_color="#c8ffc8"``, the color of the character's name is
changed, in this case to green. ``window_background="frame.png"``
sets the background of the window containing this character's
dialogue.
The style applied to the character name, spoken text, and window
can also be set this way, using the `who_style`, `what_style`, and
`window_style` arguments, respectively.
+36
View File
@@ -0,0 +1,36 @@
.. Automatically generated file - do not modify.
.. function:: Hide(screen, transition=None)
This causes the screen named `screen` to be hidden, if it is shown.
`transition`
If not None, a transition that occurs when hiding the screen.
.. function:: Jump(label)
Causes control to transfer to the given label. This can be used in
conjunction with renpy.run_screen to define an imagemap that jumps
to a label when run.
.. function:: Return(value=None)
Causes the current interaction to return the supplied value. This is
often used with menus and imagemaps, to select what the return value
of the interaction is.
When in a menu, this returns from the menu.
.. function:: Show(screen, transition=None, **kwargs)
This causes another screen to be shown. `screen` is a string
giving the name of the screen. The keyword arguments are
passed to the screen being shown.
If not None, `transition` is use to show the new screen.
.. function:: ShowTransient(screen, **kwargs)
Shows a transient screen. A transient screen will be hidden when
the current interaction completes.
+45
View File
@@ -0,0 +1,45 @@
.. Automatically generated file - do not modify.
.. function:: SetDict(dict, key, value)
Causes the value of `key` in `dict` to be set to `value`.
.. function:: SetField(object, field, value)
Causes the a field on an object to be set to a given value.
`object` is the object, `field` is a string giving the name of the
field to set, and `value` is the value to set it to.
.. function:: SetVariable(variable, value)
Causes `variable` to be set to `value`.
.. function:: ToggleDict(dict, key, true_value=None, false_value=None)
Toggles the value of `key` in `dict`. Toggling means to invert the
value when the action is performed.
`true_value`
If not None, then this is the true value we use.
`false_value`
If not None, then this is the false value we use.
.. function:: ToggleField(object, field, true_value=None, false_value=None)
Toggles `field` on `object`. Toggling means to invert the boolean
value of that field when the action is performed.
`true_value`
If not None, then this is the true value we use.
`false_value`
If not None, then this is the false value we use.
.. function:: ToggleVariable(variable, true_value=None, false_value=None)
Toggles `variable`.
`true_value`
If not None, then this is the true value we use.
`false_value`
If not None, then this is the false value we use.
+17
View File
@@ -0,0 +1,17 @@
.. Automatically generated file - do not modify.
.. function:: At(d, *args)
Given a displayable `d`, applies each of the transforms in `args`
to it. The transforms are applied in left-to-right order, so that
the outermost transform is the rightmost argument. ::
transform birds_transform:
xpos -200
linear 10 xpos 800
pause 20
repeat
image birds = At("birds.png", birds_transform)
+16
View File
@@ -0,0 +1,16 @@
.. Automatically generated file - do not modify.
.. function:: Fixed(*args, **properties)
A box that fills the screen. Its members are laid out
from back to front, with their position properties
controlling their position.
.. function:: HBox(*args, **properties)
A box that lays out its members from left to right.
.. function:: VBox(*args, **properties)
A layout that lays out its members from top to bottom.
+80
View File
@@ -0,0 +1,80 @@
.. Automatically generated file - do not modify.
.. function:: ConditionSwitch(*args, **kwargs)
This is a displayable that changes what it is showing based on
python conditions. The positional argument should be given in
groups of two, where each group consists of:
* A string containing a python condition.
* A displayable to use if the condition is true.
The first true condition has its displayable shown, at least
one condition should always be true.
::
image jill = ConditionSwitch(
"jill_beers > 4", "jill_drunk.png",
"True", "jill_sober.png")
.. function:: DynamicDisplayable(function, *args, **kwargs)
A displayable that can change its child based on a Python
function, over the course of an interaction.
`function`
A function that is called with the arguments:
* The amount of time the displayable has been shown for.
* The amount of time any displayable with the same tag has been shown for.
* Any positional or keyword arguments supplied to DynamicDisplayable.
and should return a (d, redraw) tuple, where:
* `d` is a displayable to show.
* `redraw` is the amount of time to wait before calling the
function again, or None to not call the function again
before the start of the next interaction.
`function` is called at the start of every interaction.
As a special case, `function` may also be a python string that evaluates
to a displayable. In that case, function is run once per interaction.
::
# If tooltip is not empty, shows it in a text. Otherwise,
# show Null. Checks every tenth of a second to see if the
# tooltip has been updated.
init python:
def show_tooltip(st, at):
if tooltip:
return tooltip, .1
else:
return Null()
image tooltipper = DynamicDisplayable(show_tooltip)
.. function:: ShowingSwitch(*args, **kwargs)
This is a displayable that changes what it is showing based on the
images are showing on the screen. The positional argument should
be given in groups of two, where each group consists of:
* A string giving an image name, or None to indicate the default.
* A displayable to use if the condition is true.
A default image should be specified.
One use of ShowingSwitch is to have side images change depending on
the current emotion of a character. For example::
define e = Character("Eileen",
show_side_image=ShowingSwitch(
"eileen happy", Image("eileen_happy_side.png", xalign=1.0, yalign=1.0),
"eileen vhappy", Image("eileen_vhappy_side.png", xalign=1.0, yalign=1.0),
None, Image("eileen_happy_default.png", xalign=1.0, yalign=1.0),
)
)
+13
View File
@@ -0,0 +1,13 @@
.. Automatically generated file - do not modify.
.. function:: AlphaBlend(control, old, new, alpha=False)
This transition uses a `control` displayable (almost always some sort of
animated transform) to transition from one displayable to another. The
transform is evaluated. The `new` displayable is used where the transform
is opaque, and the `old` displayable is used when it is transparent.
`alpha`
If true, the image is composited with what's behind it. If false,
the default, the image is opaque and overwrites what's behind it.
+68
View File
@@ -0,0 +1,68 @@
.. Automatically generated file - do not modify.
.. function:: Frame(image, xborder, yborder, tile=False, **properties)
A displayable that resizes an image to fill the available area,
while preserving the width and height of its borders. is often
used as the background of a window or button.
.. figure:: frame_example.png
Using a frame to resize an image to double its size.
`image`
An image manipulator that will be resized by this frame.
`xborder`
The width of the border on the left and right sides of the
image.
`yborder`
The height of the border on the top and bottom sides of the
image.
`tile`
If true, tiling is used to resize sections of the image,
rather than scaling.
::
# Resize the background of the text window if it's too small.
init python:
style.window.background = Frame("frame.png", 10, 10)
.. function:: LiveCrop(rect, child, **properties)
This created a displayable by cropping `child` to `rect`, where
`rect` is an (x, y, width, height) tuple. ::
image eileen cropped = LiveCrop((0, 0, 300, 300), "eileen happy")
.. function:: LiveTile(child, style='tile', **properties)
Tiles `child` until it fills the area allocated to this displayable.
::
image bg tile = LiveTile("bg.png")
.. function:: Null(width=0, height=0, **properties)
A displayable that creates an empty box on the screen. The size
of the box is controlled by `width` and `height`. This can be used
when a displayable requires a child, but no child is suitable, or
as a spacer inside a box.
::
image logo spaced = HBox("logo.png", Null(width=100), "logo.png")
.. function:: Solid(color, **properties)
A displayable that fills the area its assigned with `color`.
::
image white = Solid("#fff")
+143
View File
@@ -0,0 +1,143 @@
.. Automatically generated file - do not modify.
.. class:: Drag(d=None, drag_name=None, draggable=True, droppable=True, drag_raise=True, dragged=None, dropped=None, drag_handle=(0.0, 0.0, 1.0, 1.0), drag_joined=<function default_drag_joined at 0x1de72a8>, clicked=None, hovered=None, unhovered=None, replaces=None, **properties)
A displayable that represents an object that can be dragged around
its enclosing area. A Drag can also represent an area that
other Drags can be dropped on.
A Drag can be moved around inside is parent. Generally, its parent
should be either a :func:`Fixed` or :class:`DragGroup`.
A Drag has one child. The child's state reflects the status
of the drag and drop operation:
* ``selected_hover`` - when it is being dragged.
* ``selected_idle`` - when it can be dropped on.
* ``hover`` - when the draggable will be dragged when the mouse is
clicked.
* ``idle`` - otherwise.
The drag handle is a rectangle inside the child. The mouse must be over
a non-transparent pixel inside the drag handle for dragging or clicking
to occur.
A newly-created draggable is added to the default DragGroup. A draggable
can only be in a single DragGroup - if it's added to a second group,
it's removed from the first.
When a Drag is first rendered, if it's position cannot be determined
from the DragGroup it is in, the position of its upper-left corner
is computed using the standard layout algorithm. Once that position
`d`
If present, the child of this Drag. Drags use the child style
in preference to this, if it's not None.
`drag_name`
If not None, the name of this draggable. This is available
as the `name` property of draggable objects. If a Drag
with the same name is or was in the DragGroup, the starting
position of this Drag is taken from that Draggable.
`draggable`
If true, the Drag can be dragged around the screen with
the mouse.
`droppable`
If true, other Drags can be dropped on this Drag.
`drag_raise`
If true, this Drag is raised to the top when it is dragged. If
it is joined to other Drags, all joined drags are raised.
`dragged`
A callback (or list of callbacks) that is called when the Drag
has been dragged. It is called with two arguments. The first is
a list of Drags that are being dragged. The second is either
a Drag that is being dropped onto, or None of a drop did not
occur. If the callback returns a value other than None, that
value is returned as the result of the interaction.
`dropped`
A callback (or list of callbacks) that is called when this Drag
is dropped onto. It is called with two arguments. The first
is the Drag being dropped onto. The second is a list of Drags that
are being dragged. If the callback returns a value other than None,
that value is returned as the result of the interaction.
When a dragged and dropped callback are triggered for the same
event, the dropped callback is only called if dragged returns
None.
`clicked`
A callback this is called, with no arguments, when the Drag is
clicked without being moved. A droppable can also be focused
and clicked. If the callback returns a value othe than None,
that value is returned as the result of the interaction.
`drag_handle`
A (x, y, width, height) tuple, giving the position of the drag
handle within the child. In this tuple, integers are considered
to be a literal number of pixels, while floats are relative to
the size of the child.
`drag_joined`
This is called with the current Drag as an argument. It's
expected to return a list of [ (drag, x, y) ] tuples, giving
the draggables to drag as a unit. `x` and `y` are the offsets
of the drags relative to each other, they are not relative
to the corner of this drag.
Except for `d`, all of the parameters are available as fields (with
the same name) on the Drag object. In addition, after the drag has
been rendered, the following fields become available:
`x`, `y`
The position of the Drag relative to its parent, in pixels.
`w`, `h`
The width and height of the Drag's child, in pixels.
.. method:: set_child(d)
Changes the child of this drag to `d`.
.. method:: snap(x, y, delay=0)
Changes the position of the drag. If the drag is not showing,
then the position change is instantaneous. Otherwise, the
position change takes `delay` seconds, and is animated as a
linear move.
.. method:: top(self)
Raises this displayable to the top of its drag_group.
.. class:: DragGroup(*children, **properties)
Represents a group of Drags. A Drag is limited to the boundary of
its DragGroup. Dropping only works between Drags that are in the
same DragGroup. Drags may only be raised when they are inside a
DragGroup.
A DragGroup is laid out like a :func:`Fixed`.
All positional parameters to the DragGroup constructor should be
Drags, that are added to the DragGroup.
.. method:: add(child)
Adds `child`, which must be a Drag, to this DragGroup.
.. method:: get_child_by_name(name)
Returns the first child of this DragGroup that has a drag_name
of name.
.. method:: remove(child)
Removes `child` from this DragGroup.
+62
View File
@@ -0,0 +1,62 @@
.. Automatically generated file - do not modify.
.. function:: FileAction(name, page=None)
"Does the right thing" with the file. This means loading it if the
load screen is showing, and saving to it otherwise.
.. function:: FileDelete(name, confirm=True, page=None)
Deletes the file.
`confirm`
If true, prompts before deleting a file.
.. function:: FileLoad(name, confirm=True, page=None)
Loads the file.
`confirm`
If true, prompt if loading the file will end the game.
.. function:: FilePage(page)
Sets the file page to `page`, which should be one of "auto", "quick",
or an integer.
.. function:: FilePageNext(max=None)
Goes to the next file page.
`max`
If set, this should be an integer that gives the number of
the maximum file page we can go to.
.. function:: FilePagePrevious(self)
Goes to the previous file page, if possible.
.. function:: FileSave(name, confirm=True, newest=True, page=None)
Saves the file.
The button with this slot is selected if it's marked as the
newest save file.
`confirm`
If true, then we will prompt before overwriting a file.
`newest`
If true, then this file will be marked as the newest save
file when it's saved. (Set this to false for a quicksave,
for example.)
`page`
The name of the page that it will be saved to.
.. function:: FileTakeScreenshot()
Take a screenshot to be used when the game is saved. This can
be used to ensure that the screenshot is accurate, by taking
a pictue of the screen before a file save screen is shown.
+62
View File
@@ -0,0 +1,62 @@
.. Automatically generated file - do not modify.
.. function:: FileLoadable(name, page=None)
This is a function that returns true
if the file is loadable, and false otherwise.
.. function:: FilePageName(auto='a', quick='q')
Returns the name of the current file page, as a string. If a normal
page, this returns the page number. Otherwise, it returns
`auto` or `quick`.
.. function:: FileSaveName(name, empty='', page=None)
Return the save_name that was in effect when the file was saved,
or `empty` if the file does not exist.
.. function:: FileScreenshot(name, empty=None, page=None)
Returns the screenshot associated with the given file. If the
file is not loadable, then `empty` is returned, unless it's None,
in which case, a Null displayable is created.
The return value is a displayable.
.. function:: FileSlotName(slot, slots_per_page, auto='a', quick='q', format='%s%d')
Returns the name of the numbered slot. This assumes that slots on
normal pages are numbered in a linear order starting with 1, and
that page numbers start with 1. When slot is 2, and slots_per_page
is 10, and the other variables are the defauts:
* When the first page is slowing, this returns "2".
* When the second page is showing, this returns "12".
* When the auto page is showing, this returns "a2".
* When the quicksave page is showing, this returns "q2".
`slot`
The number of the slot to access.
`slots_per_page`
The number of slots per page.
`auto`
A prefix to use for the auto page.
`quick`
A prefix to use for the quick page.
`format`
The formatting code to use. This is given two arguments: A string
giving the page prefix, and an integer giving the slot number.
.. function:: FileTime(name, format='%b %d, %H:%M', empty='', page=None)
Returns the time the file was saved, formatted according
to the supplied `format`. If the file is not found, `empty` is
returned.
The return value is a string.
+99
View File
@@ -0,0 +1,99 @@
.. Automatically generated file - do not modify.
.. function:: im.AlphaMask(base, mask, **properties)
An image manipulator that takes two image manipulators, `base` and
`mask`, as arguments. It replaces the alpha channel of `base` with
the red channel of `mask`.
This is used to provide an image's alpha channel in a second
image, like having one jpeg for color data, and a second one
for alpha. In some cases, two jpegs can be smaller than a
single png file.
.. function:: im.Composite(size, *args, **properties)
This image manipulator composites multiple images together to
form a single image.
The `size` should be a (width, height) tuple giving the size
of the composed image.
The remaining positional arguments are interpreted as groups of
two. The first argument in a group should be an (x, y) tuple,
while the second should be an image manipulator. The image
produced by the image manipulator is composited at the location
given by the tuple.
::
image girl clothed happy = im.Composite(
(300, 600)
(0, 0), "girl_body.png",
(0, 0), "girl_clothes.png",
(100, 100), "girl_happy.png"
)
.. function:: im.Crop(im, rect)
An image manipulator that crops `rect`, a (x, y, width, height) tuple,
out of `im`, an image manipulator.
::
image logo crop = im.Crop("logo.png", (0, 0, 100, 307))
.. function:: im.FactorScale(im, width, height=None, bilinear=True, **properties)
An image manipulator that scales `im` (a second image manipulator)
to `width` times its original `width`, and `height` times its
original height. If `height` is ommitted, it defaults to `width`.
If `bilinear` is true, then bilinear interpolation is used for
the scaling. Otherwise, nearest neighbor interpolation is used.
::
image logo doubled = im.FactorScale("logo.png", 1.5)
.. function:: im.Flip(im, horizontal=False, vertical=False, **properties)
An image manipulator that flips `im` (an image manipulator)
vertically or horizontally. `vertical` and `horizontal` control
the directions in which the image is flipped.
::
image eileen flip = im.Flip("eileen_happy.png", vertical=True)
.. function:: im.Grayscale(im, **properties)
An image manipulator that creats a desaturated version of the image
manipulator `im`.
.. function:: im.Scale(im, width, height, bilinear=True, **properties)
An image manipulator that scales `im` (an image manipulator) to
`width` and `height`.
If `bilinear` is true, then bilinear interpolation is used for
the scaling. Otherwise, nearest neighbor interpolation is used.
::
image logo scale = im.Scale("logo.png", 100, 150)
.. function:: im.Sepia(im, **properties)
An image manipulator that creates a sepia-toned version of the image
manipulator `im`.
.. function:: im.Tile(im, size=None, **properties)
An image manipulator that tiles the image manipulator `im`, until
it is `size`.
`size`
If not None, a (width, height) tuple. If None, this defaults to
(:var:`config.screen_width`, :var:`config.screen_height`).
+10
View File
@@ -0,0 +1,10 @@
.. Automatically generated file - do not modify.
.. function:: Image(filename, **properties)
Loads an image from a file. `filename` is a
string giving the name of the file.
`filename` should be a JPEG or PNG file with an appropriate
extension.
+125
View File
@@ -0,0 +1,125 @@
.. Automatically generated file - do not modify.
.. function:: im.MatrixColor(im, matrix, **properties)
An image operator that uses `matrix` to linearly transform the
image manipulator `im`.
`Matrix` should be a list, tuple, or :func:`im.matrix` that is 20
or 25 elements long. If the object has 25 elements, then elements
past the 20th are ignored.
When the four components of the source color are R, G, B, and A,
which range from 0.0 to 1.0; the four components of the transformed
color are R', G', B', and A', with the same range; and the elements
of the matrix are named::
[ a, b, c, d, e,
f, g, h, i, j,
k, l, m, n, o,
p, q, r, s, t ]
the transformed colors can be computed with the formula::
R' = (a * R) + (b * G) + (c * B) + (d * A) + e
G' = (f * R) + (g * G) + (h * B) + (i * A) + j
B' = (k * R) + (l * G) + (m * B) + (n * A) + o
A' = (p * R) + (q * G) + (r * B) + (s * A) + t
The components of the transformed color are clamped to the
range [0.0, 1.0].
.. function:: im.matrix()
Constructs an im.matrix object from `matrix`. im.matrix objects
support The operations supported are matrix multiplication, scalar
multiplication, element-wise addition, and element-wise
subtraction. These operations are invoked using the standard
mathematical operators (\*, \*, +, and -, respectively). If two
im.matrix objects are multiplied, matrix multiplication is
performed, otherwise scalar multiplication is used.
`matrix` is a 20 or 25 element list or tuple. If it is 20 elements
long, it is padded with (0, 0, 0, 0, 1) to make a 5x5 matrix,
suitable for multiplication.
.. function:: im.matrix.brightness(b)
Returns an im.matrix that alters the brightness of an image.
`b`
The amount of change in image brightness. This should be
a number between -1 and 1, with -1 the darkest possible
image and 1 the brightest.
.. function:: im.matrix.colorize(black_color, white_color)
Returns an im.matrix that colorizes a black and white image.
`black_color` and `white_color` are Ren'Py style colors, so
they may be specfied as strings or tuples of (0-255) color
values. ::
# This makes black colors red, and white colors blue.
image logo colored = im.MatrixColor(
"bwlogo.png",
im.matrix.colorize("#f00", "#00f"))
.. function:: im.matrix.contrast(c)
Returns an im.matrix that alters the contrast of an image. `c` should
be greater than 0.0, with values between 0.0 and 1.0 decreasing contrast, and
values greater than 1.0 increasing contrast.
.. function:: im.matrix.desaturate()
Returns an im.matrix that desaturates the image (make it
grayscale). This is equivalent to calling
im.matrix.saturation(0).
.. function:: im.matrix.hue(h)
Returns an im.matrix that rotates the hue by `h` degrees, while
preserving luminosity.
.. function:: im.matrix.identity()
Returns an identity matrix, one that does not change color or
alpha.
.. function:: im.matrix.invert()
Returns an im.matrix that inverts the red, green, and blue
channels of the image without changing the alpha channel.
.. function:: im.matrix.opacity(o)
Returns an im.matrix that alters the opacity of an image. An
`o` of 0.0 is fully transparent, while 1.0 is fully opaque.
.. function:: im.matrix.saturation(level, desat=(0.21260000000000001, 0.71519999999999995, 0.0722))
Returns an im.matrix that alters the saturation of an
image. The alpha channel is untouched.
`level`
The amount of saturation in the resulting image. 1.0 is
the unaltered image, while 0.0 is grayscale.
`desat`
This is a 3-element tuple that controls how much of the
red, green, and blue channels will be placed into all
three channels of a fully desaturated image. The default
is based on the constants used for the luminance channel
of an NTSC television signal. Since the human eye is
mostly sensitive to green, more of the green channel is
kept then the other two channels.
.. function:: im.matrix.tint(r, g, b)
Returns an im.matrix that tints an image, without changing
the alpha channel. `r`, `g`, and `b` should be numbers between
0 and 1, and control what fraction of the given channel is
placed into the final image. (For example, if `r` is .5, and
the value of the red channel is 100, the transformed color
will have a red value of 50.)
+50
View File
@@ -0,0 +1,50 @@
.. Automatically generated file - do not modify.
.. function:: MainMenu(confirm=True)
Causes Ren'Py to return to the main menu.
`confirm`
If true, causes Ren'Py to ask the user if he wishes to
return to the main menu, rather than returning
directly.
.. function:: Quit(confirm=True)
Quits the game.
`confirm`
If true, prompts the user if he wants to quit, rather
than quitting directly.
.. function:: ShowMenu(screen=None)
Causes us to enter the game menu, if we're not there already. If we
are in the game menu, then this shows a screen or jumps to a label.
`screen` is usually the name of a screen, which is shown using
the screen mechanism. If the screen doesn't exist, then "_screen"
is appended to it, and that label is jumped to.
* ShowMenu("load")
* ShowMenu("save")
* ShowMenu("preferences")
This can also be used to show user-defined menu screens. For
example, if one has a "stats" screen defined, one can
show it as part of the game menu using:
* ShowMenu("stats")
ShowMenu without an argument will enter the game menu at the
default screen, taken from _game_menu_screen.
.. function:: Start(label='start')
Causes Ren'Py to jump out of the menu context to the named
label. The main use of this is to start a new game from the
main menu. Common uses are:
* Start() - Start at the start label.
* Start("foo") - Start at the "foo" label.
+6
View File
@@ -0,0 +1,6 @@
.. Automatically generated file - do not modify.
.. function:: renpy.mode(mode)
Causes Ren'Py to enter the named mode.
+7
View File
@@ -0,0 +1,7 @@
.. Automatically generated file - do not modify.
.. function:: renpy.mode(mode)
Causes Ren'Py to enter the named mode, or stay in that mode if it's
already in it.
File diff suppressed because it is too large Load Diff
+43
View File
@@ -0,0 +1,43 @@
.. Automatically generated file - do not modify.
.. function:: Help(help=None)
Displays help.
`help`
If this is a string giving a label in the programe, then
that label is called in a new context when the button is
chosen. Otherwise, it should be a string giving a file
that is opened in a web browser. If None, the value of
config.help is used in the same wayt.
.. function:: If(expression, true=None, false=None)
This returns `true` if `expression` is true, and `false`
otherwise. Use this to select an action based on an expression.
Note that the default, None, can be used as an action that causes
a button to be disabled.
.. function:: InvertSelected(action)
This inverts the selection state of the provided action, while
proxying over all of the other methods.
.. function:: Notify(message)
Displays `message` using :func:`renpy.notify`.
.. function:: Screenshot()
Takes a screenshot.
.. function:: Skip()
Causes the game to begin skipping. If the game is in a menu
context, then this returns to the game. Otherwise, it just
enables skipping.
.. function:: With(transition)
Causes `transition` to occur.
+62
View File
@@ -0,0 +1,62 @@
.. Automatically generated file - do not modify.
.. function:: Preference(name, value=None)
This constructs the approprate action or value from a preference.
The preference name should be the name given in the standard
menus, while the value should be either the name of a choice,
"toggle" to cycle through choices, a specific value, or left off
in the case of buttons.
Actions that can be used with buttons and hotspots are:
* Preference("display", "fullscreen") - displays in fullscreen mode.
* Preference("display", "window") - displays in windowed mode.
* Preference("display", "toggle") - toggle display mode.
* Preference("transitions", "all") - show all transitions.
* Preference("transitions", "none") - do not show transitions.
* Preference("transitions", "toggle") - toggle transitions.
* Preference("text speed", 0) - make test appear instantaneously.
* Preference("text speed", 142) - set text speed to 142 characters per second.
* Preference("joystick") - Show the joystick preferences.
* Preference("skip", "seen") - Only skip seen messages.
* Preference("skip", "all") - Skip unseen messages.
* Preference("skip", "toggle") - Toggle skipping.
* Preference("begin skipping") - Starts skipping.
* Preference("after choices", "skip") - Skip after choices.
* Preference("after choices", "stop") - Stop skipping after choices.
* Preference("after choices", "toggle") - Toggle skipping after choices.
* Preference("auto-forward time", 0) - Set the auto-forward time to infinite.
* Preference("auto-forward time", 10) - Set the auto-forward time (unit is seconds per 250 characters).
* Preference("auto-forward", "enable") - Enable auto-forward mode.
* Preference("auto-forward", "disable") - Disable auto-forward mode.
* Preference("auto-forward", "toggle") - Toggle auto-forward mode.
* Preference("music mute", "enable") - Mute the music mixer.
* Preference("music mute", "disable") - Un-mute the music mixer.
* Preference("music mute", "toggle") - Toggle music mute.
* Preference("sound mute", "enable") - Mute the sound mixer.
* Preference("sound mute", "disable") - Un-mute the sound mixer.
* Preference("sound mute", "toggle") - Toggle sound mute.
* Preference("voice mute", "enable") - Mute the voice mixer.
* Preference("voice mute", "disable") - Un-mute the voice mixer.
* Preference("voice mute", "toggle") - Toggle voice mute.
Values that can be used with bars are:
* Preference("text speed")
* Preference("auto-forward time")
* Preference("music volume")
* Preference("sound volume")
* Preference("voice volume")
+99
View File
@@ -0,0 +1,99 @@
.. Automatically generated file - do not modify.
.. function:: renpy.call_screen(_screen_name, **kwargs)
The programmatic equivalent of the show screen statement.
This shows `_screen_name` as a screen, then causes an interaction
to occur. The screen is hidden at the end of the interaction, and
the result of the interaction is returned.
Keyword arguments not beginning with _ are passed to the scope of
the screen.
.. function:: renpy.define_screen(name, function, modal="False", zorder="0", tag=None, variant=None)
Defines a screen with `name`, which should be a string.
`function`
The function that is called to display the screen. The
function is called with the screen scope as keyword
arguments. It should ignore additional keyword arguments.
The function should call the ui functions to add things to the
screen.
`modal`
A string that, when evaluated, determines of the created
screen should be modal. A modal screen prevents screens
underneath it from receiving input events.
`zorder`
A string that, when evaluated, should be an integer. The integer
controls the order in which screens are displayed. A screen
with a greater zorder number is displayed above screens with a
lesser zorder number.
`tag`
The tag associated with this screen. When the screen is shown,
it replaces any other screen with the same tag. The tag
defaults to the name of the screen.
`predict`
If true, this screen can be loaded for image prediction. If false,
it can't. Defaults to true.
`variant`
String. Gives the variant of the screen to use.
.. function:: renpy.get_screen(name, layer='screens')
Returns the ScreenDisplayable with the given `tag`, on
`layer`. If no displayable with the tag is not found, it is
interpreted as screen name. If it's still not found, None is returned.
.. function:: renpy.get_widget(screen, id, layer='screens')
From the `screen` on `layer`, returns the widget with
`id`. Returns None if the screen doesn't exist, or there is no
widget with that id on the screen.
.. function:: renpy.hide_screen(tag, layer='screens')
The programmatic equivalent of the hide screen statement.
Hides the screen with `tag` on `layer`.
.. function:: renpy.show_screen(_screen_name, _layer='screens', _tag=None, _widget_properties={}, _transient=False, **kwargs)
The programmatic equivalent of the show screen statement.
Shows the named screen.
`_screen_name`
The name of the screen to show.
`_layer`
The layer to show the screen on.
`_tag`
The tag to show the screen with. If not specified, defaults to
the tag associated with the screen. It that's not specified,
defaults to the name of the screen.,
`_widget_properties`
A map from the id of a widget to a property name -> property
value map. When a widget with that id is shown by the screen,
the specified properties are added to it.
`_transient`
If true, the screen will be automatically hidden at the end of
the current interaction.
Keyword arguments not beginning with underscore (_) are used to
initialize the screen's scope.
.. function:: renpy.variant(name)
Returns true if a `name` is a screen variant that can be chosen
by Ren'Py. See :ref:`Screen Variants` for more details. This function
can be used as the condition in a python if statement to set up the
appropriate styles for the selected screen variant.
+6
View File
@@ -0,0 +1,6 @@
.. Automatically generated file - do not modify.
.. method:: redraw(delay=0)
Causes this SpriteManager to be redrawn in `delay` seconds.
+88
View File
@@ -0,0 +1,88 @@
.. Automatically generated file - do not modify.
.. class:: Sprite()
This represents a sprite that is managed by the SpriteManager. It contains
fields that control the placement of the sprite on the screen. Sprites
should not be created directly. Instead, they should be created by
calling :meth:`SpriteManager.create`.
The fields of a sprite object are:
`x`, `y`
The x and y coordinates of the upper-left corner of the sprite,
relative to the SpriteManager.
`zorder`
An integer that's used to control the order of this sprite in the
relative to the other sprites in the SpriteManager. The larger the
number is, the closer to the viewer the sprite is.
`events`
If True, then events are passed to child. If False, the default,
the children igore events (and hence don't spend time processing
them).
The methods of a Sprite object are:
.. method:: destroy(self)
Destroys this sprite, preventing it from being displayed and
removing it from the SpriteManager.
.. method:: set_child(d)
Changes the Displayable associated with this sprite to `d`.
.. class:: SpriteManager(update=None, event=None, predict=None, ignore_time=False, **properties)
This displayable manages a collection of sprites, and displays
them at the fastest speed possible.
`update`
If not None, a function that is called each time a sprite
is rendered by this sprite manager. It is called with one
argument, the time in seconds since this sprite manager
was first displayed. It is expected to return the number
of seconds until the function is called again, and the
SpriteManager is rendered again.
`event`
If not None, a function that is called when an event occurs.
It takes as arguments:
* A pygame event object.
* The x coordinate of the event.
* The y coordinate of the event.
* The time since the sprite manager was first shown.
If it returns a non-None value, the interaction ends, and
that value is returned.
`predict`
If not None, a function that returns a list of
displayables. These displayables are predicted when the
sprite manager is.
`ignore_time`
If True, then time is ignored when rendering displayables. This
should be used when the sprite manager is used with a relatively
small pool of images, and those images do not change over time.
This should only be used with a small number of displayables, as
it will keep all displayables used in memory for the life of the
SpriteManager.
After being rendered once (before the `update` function is called),
SpriteManagers have the following fields:
`width`, `height`
The width and height of this SpriteManager, in pixels.
SpriteManagers have the following methods:
.. method:: create(d)
Creates a new Sprite for the displayable `d`, and adds it to this
SpriteManager.
+37
View File
@@ -0,0 +1,37 @@
.. Automatically generated file - do not modify.
.. function:: SnowBlossom(d, count=10, border=50, xspeed=(20, 50), yspeed=(100, 200), start=0, fast=False, horizontal=False)
The snowblossom effect moves multiple instances of a sprite up,
down, left or right on the screen. When a sprite leaves the screen, it
is returned to the start.
`d`
The displayable to use for the sprites.
`border`
The size of the border of the screen. The sprite is considered to be
on the screen until it clears the border, ensuring that sprites do
not disappear abruptly.
`xspeed`, `yspeed`
The speed at which the sprites move, in the horizontal and vertical
directions, respectively. These can be a single number or a tuple of
two numbers. In the latter case, each particle is assigned a random
speed between the two numbers. The speeds can be positive or negative,
as long as the second number in a tuple is larger than the first.
`start`
The delay, in seconds, before each particle is added. This can be
allows the particles to start at the top of the screen, while not
looking like a "wave" effect.
`fast`
If true, particles start in the center of the screen, rather than
only at the edges.
`horizontal`
If true, particles appear on the left or right side of the screen,
rather than the top or bottom.
+78
View File
@@ -0,0 +1,78 @@
.. Automatically generated file - do not modify.
.. function:: ui.adjustment(range=1, value=0, step=None, page=0, changed=None, adjustable=None, ranged=None)
Adjustment objects represent a value that can be adjusted by a bar
or viewport. They contain information about the value, the range
of the value, and how to adjust the value in small steps and large
pages.
The following parameters correspond to fields or properties on
the adjustment object:
`range`
The range of the adjustment, a number.
`value`
The value of the adjustment, a number.
`step`
The step size of the adjustment, a number. If None, then
defaults to 1/10th of a page, if set. Otherwise, defaults
to the 1/20th of the range.
This is used when scrolling a viewport with the mouse wheel.
`page`
The page size of the adjustment. If None, this is set
automatically by a viewport. If never set, defaults to 1/10th
of the range.
It's can be used when clicking on a scrollbar.
The following parameters control the behavior of the adjustment.
`adjustable`
If True, this adjustment can be changed by a bar. If False,
it can't.
It defaults to being adjustable if a `changed` function
is given or if the adjustment is associated with a viewport,
and not adjustable otherwise.
`changed`
This function is called with the new value when the value of
the adjustment changes.
`ranged`
This function is called with the adjustment object when
the range of the adjustment is set by a viewport.
.. method:: change(value)
Changes the value of the adjustment to `value`, updating
any bars and viewports that use the adjustment.
.. function:: ui.at(transform)
Specifieds a transform that is applied to the next displayable to
be created. This is largely obsolete, as all UI functions now take
an `at` argument.
.. function:: ui.close()
Closes a displayable created with by a UI function. When a
displayable is closed, we add new displayables to its parent,
or to the layer if no displayable is open.
.. function:: ui.detached()
Do not add the next displayable to any later or container. Use this if
you want to assign the result of a ui function to a variable.
.. function:: ui.layer(name)
Adds displayables to the layer named `name`. The later must be
closed with :func:`ui.close`.
+74
View File
@@ -0,0 +1,74 @@
.. Automatically generated file - do not modify.
.. function:: AnimatedValue(value=0.0, range=1.0, delay=1.0, old_value=None)
This animates a value, taking `delay` seconds to vary the value from
`old_value` to `value`.
`value`
The value itself, a number.
`range`
The range of the value, a number.
`delay`
The time it takes to animate the value, in seconds. Defaults
to 1.0.
`old_value`
The old value. If this is None, then the value is taken from the
AnimatedValue we replaced, if any. Otherwise, it is initialized
to `value`.
.. function:: FieldValue(object, field, range, max_is_zero=False, style='bar')
A value that allows the user to adjust the value of a field
on an object.
`object`
The object.
`field`
The field, a string.
`range`
The range to adjust over.
`max_is_zero`
If True, then when the field is zero, the value of the
bar will be range, and all other values will be shifted
down by 1. This works both ways - when the bar is set to
the maximum, the field is set to 0.
This is used internally, for some preferences.
`style`
The styles of the bar created.
.. function:: MixerValue(mixer)
The value of an audio mixer.
`mixer`
The name of the mixer to adjust. This is usually one of
"music", "sfx", or "voice", but user code can create new
mixers.
.. function:: StaticValue(value=0.0, range=1.0)
This allows a value to be specified statically.
`value`
The value itself, a number.
`range`
The range of the value.
.. function:: XScrollValue(viewport)
The value of an adjustment that horizontally scrolls the the viewport with the
given id, on the current screen. The viewport must be defined
before a bar with this value is.
.. function:: YScrollValue(viewport)
The value of an adjustment that vertically scrolls the the viewport with the
given id, on the current screen. The viewport must be defined
before a bar with this value is.
+6 -2
View File
@@ -14,15 +14,19 @@ features.
6.12.0
------
The definition of the `items` parameter of the :ref:`Choice` and
The definition of the `items` parameter of the :ref:`choice-screen` and
``nvl_choice`` screens has changed. The ``nvl_choice`` screen is
deprecated in favor of the :ref:`NVL` screen.
deprecated in favor of the :ref:`nvl-screen` screen.
Screens may be invoked at any time, in order to allow for image
prediction, unless they have a predict property of False. When the
predict property is not False, screens should not cause side effects
to occur upon their initial display.
For performance reason, Ren'Py now ignores the position properties of
ImageReferences. This means that the position properties of
style.image_placement are now ignored. To revert to the old behavior,
set :var:`config.imagereference_respects_position` to True.
.. _incompatible-6.11.1:
File diff suppressed because one or more lines are too long
+31 -26
View File
@@ -73,6 +73,8 @@ It's expected to declare displayables with the following ids:
text what id "what"
.. _choice-screen:
Choice
------
@@ -80,35 +82,35 @@ The ``choice`` screen is used to display the in-game choices created
with the menu statement. It is given the following parameter:
`items`
This is a list of (`caption`, `action`, `button_id`, `caption_id`)
This is a list of (`caption`, `action`, `chosen`)
tuples. For each choice, `caption` is the name of the choice, and
`action` is the action to invoke for the choice, or None if this
is a choice label. When a button is used to invoke the choice,
`button_id` is an id that should be given to that button. When
a choice displays text, `caption_id` should be the id of that
text.
is a choice label. `Chosen` if a choice with this label has been
chosen by the user before. (It doesn't have to be in the current
game.)
::
screen choice:
window:
id "window"
window:
style "menu_window"
vbox:
id "menu"
style "menu"
for caption, action, button_id, caption_id in items:
for caption, action, chosen in items:
if action:
if action:
button:
action action
id button_id
style "menu_choice_button"
text caption id caption_id
text caption style "menu_choice"
else:
text caption id caption_id
text caption style "menu_caption"
Input
@@ -137,7 +139,8 @@ It is expected to declare a displayable with the following id:
input id "input"
.. _nvl-screen:
NVL
---
@@ -153,14 +156,13 @@ the following parameter:
a window containing each unit of dialogue.
`items`
This is a list of (`caption`, `action`, `button_id`, `caption_id`)
This is a list of (`caption`, `action`, `chosen`)
tuples. For each choice, `caption` is the name of the choice, and
`action` is the action to invoke for the choice, or None if this
is a choice label. When a button is used to invoke the choice,
`button_id` is an id that should be given to that button. When
a choice displays text, `caption_id` should be the id of that
text.
is a choice label. `Chosen` if a choice with this label has been
chosen by the user before. (It doesn't have to be in the current
game.)
If items is empty, the menu should not be shown.
Ren'Py also supports an ``nvl_choice`` screen, which takes the same
@@ -196,17 +198,20 @@ an in-game choice is presented to the user, if it exists.
vbox:
id "menu"
for caption, action, button_id, caption_id in items:
for caption, action, chosen in items:
if action:
button:
action action
id button_id
text caption id caption_id
button:
style "nvl_menu_choice_button"
action action
text caption style "nvl_menu_choice"
else:
text caption id caption_id
text caption style "nvl_dialogue"
Notify
+1
View File
@@ -34,6 +34,7 @@ The SnowBlossom class is an easy-to use way of placing falling things
on the screen.
::
image snow = SnowBlossom("snow.png", count=100)
+20 -8
View File
@@ -256,6 +256,26 @@ layout.
Specifies the maximum vertical size of the displayable in pixels.
.. style-property:: maximum tuple of (int, int)
Equivalent to setting xmaximum to the first component of the
tuple, and ymaximum to the second.
.. style-property:: xminimum int
Sets the minimum width of the displayable, in pixels. Only works
with displayables that can vary their size.
.. style-property:: yminimum int
Sets the minimum height of the displayables, in pixels. Only works
with displayables that can vary their size.
.. style-property:: minimum tuple of (int, int)
Equivalent to setting xminimum to the first component of the
tuple, and yminimum to the second.
.. style-property:: xfill boolean
If true, the displayable will expand to fill all available
@@ -512,14 +532,6 @@ buttons.
If not None, this should be a string. Ren'Py will render all
windows with the same size_group value at the same size.
.. style-property:: xminimum int
Sets the minimum width of the window, in pixels.
.. style-property:: yminimum int
Sets the minimum height of the window, in pixels.
.. _button-style-properties:
+64 -53
View File
@@ -63,31 +63,32 @@ screen say:
screen choice:
window:
id "window"
window:
style "menu_window"
xalign 0.5
yalign 0.5
vbox:
id "menu"
for caption, action, button_id, caption_id in items:
style "menu"
spacing 2
for caption, action, chosen in items:
if action:
if action:
button:
action action
id button_id
text caption id caption_id
style "menu_choice_button"
text caption style "menu_choice"
else:
text caption id caption_id
text caption style "menu_caption"
init python:
init -2 python:
config.narrator_menu = True
style.menu.box_spacing = 2
style.menu_window.set_parent(style.default)
style.menu_window.xalign = 0.5
style.menu_window.yalign = 0.5
style.menu_choice.set_parent(style.button_text)
style.menu_choice.clear()
style.menu_choice_button.set_parent(style.button)
@@ -131,7 +132,7 @@ screen nvl:
has hbox:
spacing 10
if who is not None:
text who id who_id
@@ -139,21 +140,23 @@ screen nvl:
# Display a menu, if given.
if items:
vbox:
id "menu"
for caption, action, button_id, caption_id in items:
for caption, action, chosen in items:
if action:
button:
action action
id button_id
text caption id caption_id
button:
style "nvl_menu_choice_button"
action action
text caption style "nvl_menu_choice"
else:
text caption id caption_id
text caption style "nvl_dialogue"
@@ -186,7 +189,7 @@ screen main_menu:
textbutton _("Help") action Help()
textbutton _("Quit") action Quit(confirm=False)
init python:
init -2 python:
# Make all the main menu buttons be the same size.
style.mm_button.size_group = "mm"
@@ -207,7 +210,9 @@ screen navigation:
# The various buttons.
frame:
style_group "gm_nav"
xalign .98
yalign .98
has vbox
textbutton _("Return") action Return()
@@ -218,10 +223,8 @@ screen navigation:
textbutton _("Help") action Help()
textbutton _("Quit") action Quit()
init python:
init -2 python:
style.gm_nav_button.size_group = "gm_nav"
style.gm_nav_frame.xalign = .98
style.gm_nav_frame.yalign = .98
##############################################################################
@@ -259,15 +262,18 @@ screen file_picker:
textbutton _("Next"):
action FilePageNext()
$ columns = 2
$ rows = 5
# Display a grid of file slots.
grid 2 5:
grid columns rows:
transpose True
xfill True
style_group "file_picker"
# Display ten file slots, numbered 1 - 10.
for i in range(1, 11):
for i in range(1, columns * rows + 1):
# Each file slot is a button.
button:
@@ -280,7 +286,11 @@ screen file_picker:
add FileScreenshot(i)
# Format the description, and add it as text.
$ description = "% 2d. %s\n%s" % (i, FileTime(i, empty=_("Empty Slot.")), FileSaveName(i))
$ description = "% 2s. %s\n%s" % (
FileSlotName(i, columns * rows),
FileTime(i, empty=_("Empty Slot.")),
FileSaveName(i))
text description
key "save_delete" action FileDelete(i)
@@ -302,7 +312,7 @@ screen load:
use navigation
use file_picker
init python:
init -2 python:
style.file_picker_frame = Style(style.menu_frame)
style.file_picker_nav_button = Style(style.small_button)
@@ -424,15 +434,19 @@ screen preferences:
action Play("voice", config.sample_voice)
style "soundtest_button"
init python:
init -2 python:
style.pref_frame.xfill = True
style.pref_frame.xmargin = 5
style.pref_frame.top_margin = 5
style.pref_vbox.xfill = True
style.pref_button.size_group = "pref"
style.pref_button.xalign = 1.0
style.pref_slider.xmaximum = 192
style.pref_slider.xalign = 1.0
style.soundtest_button.xalign = 1.0
@@ -452,31 +466,28 @@ screen yesno_prompt:
frame:
style_group "yesno"
has vbox
label _(message)
xfill True
xmargin .05
ypos .1
yanchor 0
ypadding .05
has vbox:
xalign .5
yalign .5
spacing 30
label _(message):
xalign 0.5
hbox:
xalign 0.5
spacing 100
textbutton _("Yes") action yes_action
textbutton _("No") action no_action
init python:
style.yesno_frame.xfill = True
style.yesno_frame.xmargin = .05
style.yesno_frame.ypos = .1
style.yesno_frame.yanchor = 0
style.yesno_frame.ypadding = .05
style.yesno_vbox.xalign = 0.5
style.yesno_vbox.yalign = 0.5
style.yesno_vbox.box_spacing = 30
style.yesno_hbox.xalign = 0.5
style.yesno_hbox.spacing = 100
init -2 python:
style.yesno_button.size_group = "yesno"
style.yesno_label.xalign = 0.5
style.yesno_label_text.text_align = 0.5
File diff suppressed because one or more lines are too long
+64 -53
View File
@@ -63,31 +63,32 @@ screen say:
screen choice:
window:
id "window"
window:
style "menu_window"
xalign 0.5
yalign 0.5
vbox:
id "menu"
for caption, action, button_id, caption_id in items:
style "menu"
spacing 2
for caption, action, chosen in items:
if action:
if action:
button:
action action
id button_id
text caption id caption_id
style "menu_choice_button"
text caption style "menu_choice"
else:
text caption id caption_id
text caption style "menu_caption"
init python:
init -2 python:
config.narrator_menu = True
style.menu.box_spacing = 2
style.menu_window.set_parent(style.default)
style.menu_window.xalign = 0.5
style.menu_window.yalign = 0.5
style.menu_choice.set_parent(style.button_text)
style.menu_choice.clear()
style.menu_choice_button.set_parent(style.button)
@@ -131,7 +132,7 @@ screen nvl:
has hbox:
spacing 10
if who is not None:
text who id who_id
@@ -139,21 +140,23 @@ screen nvl:
# Display a menu, if given.
if items:
vbox:
id "menu"
for caption, action, button_id, caption_id in items:
for caption, action, chosen in items:
if action:
button:
action action
id button_id
text caption id caption_id
button:
style "nvl_menu_choice_button"
action action
text caption style "nvl_menu_choice"
else:
text caption id caption_id
text caption style "nvl_dialogue"
@@ -186,7 +189,7 @@ screen main_menu:
textbutton _("Help") action Help()
textbutton _("Quit") action Quit(confirm=False)
init python:
init -2 python:
# Make all the main menu buttons be the same size.
style.mm_button.size_group = "mm"
@@ -207,7 +210,9 @@ screen navigation:
# The various buttons.
frame:
style_group "gm_nav"
xalign .98
yalign .98
has vbox
textbutton _("Return") action Return()
@@ -218,10 +223,8 @@ screen navigation:
textbutton _("Help") action Help()
textbutton _("Quit") action Quit()
init python:
init -2 python:
style.gm_nav_button.size_group = "gm_nav"
style.gm_nav_frame.xalign = .98
style.gm_nav_frame.yalign = .98
##############################################################################
@@ -259,15 +262,18 @@ screen file_picker:
textbutton _("Next"):
action FilePageNext()
$ columns = 2
$ rows = 5
# Display a grid of file slots.
grid 2 5:
grid columns rows:
transpose True
xfill True
style_group "file_picker"
# Display ten file slots, numbered 1 - 10.
for i in range(1, 11):
for i in range(1, columns * rows + 1):
# Each file slot is a button.
button:
@@ -280,7 +286,11 @@ screen file_picker:
add FileScreenshot(i)
# Format the description, and add it as text.
$ description = "% 2d. %s\n%s" % (i, FileTime(i, empty=_("Empty Slot.")), FileSaveName(i))
$ description = "% 2s. %s\n%s" % (
FileSlotName(i, columns * rows),
FileTime(i, empty=_("Empty Slot.")),
FileSaveName(i))
text description
key "save_delete" action FileDelete(i)
@@ -302,7 +312,7 @@ screen load:
use navigation
use file_picker
init python:
init -2 python:
style.file_picker_frame = Style(style.menu_frame)
style.file_picker_nav_button = Style(style.small_button)
@@ -424,15 +434,19 @@ screen preferences:
action Play("voice", config.sample_voice)
style "soundtest_button"
init python:
init -2 python:
style.pref_frame.xfill = True
style.pref_frame.xmargin = 5
style.pref_frame.top_margin = 5
style.pref_vbox.xfill = True
style.pref_button.size_group = "pref"
style.pref_button.xalign = 1.0
style.pref_slider.xmaximum = 192
style.pref_slider.xalign = 1.0
style.soundtest_button.xalign = 1.0
@@ -452,31 +466,28 @@ screen yesno_prompt:
frame:
style_group "yesno"
has vbox
label _(message)
xfill True
xmargin .05
ypos .1
yanchor 0
ypadding .05
has vbox:
xalign .5
yalign .5
spacing 30
label _(message):
xalign 0.5
hbox:
xalign 0.5
spacing 100
textbutton _("Yes") action yes_action
textbutton _("No") action no_action
init python:
style.yesno_frame.xfill = True
style.yesno_frame.xmargin = .05
style.yesno_frame.ypos = .1
style.yesno_frame.yanchor = 0
style.yesno_frame.ypadding = .05
style.yesno_vbox.xalign = 0.5
style.yesno_vbox.yalign = 0.5
style.yesno_vbox.box_spacing = 30
style.yesno_hbox.xalign = 0.5
style.yesno_hbox.spacing = 100
init -2 python:
style.yesno_button.size_group = "yesno"
style.yesno_label.xalign = 0.5
style.yesno_label_text.text_align = 0.5