Compare commits

...

9 Commits

Author SHA1 Message Date
Tom Rothamel 2e8afbde09 Bump version. 2014-03-04 19:38:44 -05:00
Tom Rothamel 5aebdb87d6 Rewrite missing images in terms of screens and styles.
This makes it possible to customize the missing image indicator,
which is useful if it conflicts with the background of the game.
2014-03-04 19:38:11 -05:00
Tom Rothamel 79c5b156e5 Word-like operators have to end at word boundaries.
This prevents us from parsing strings like "8 insensitive" as "8 in
sensitive", and then failing when we go to eval it.

Fixes http://lemmasoft.renai.us/forums/viewtopic.php?f=32&t=25510
2014-03-04 19:38:04 -05:00
Tom Rothamel 41905ab2f2 Finish documenting the functions in renpy.exports. 2014-03-04 19:37:57 -05:00
Tom Rothamel e67bac9176 Keymap fixes.
* Add toggle_music back in, because creators depend on the most obscure
  parts of Ren'Py.
* Update documentation.
2014-03-01 16:43:47 -05:00
Tom Rothamel c002fc1110 Remove debug print. 2014-03-01 16:40:31 -05:00
Tom Rothamel 24480093b6 Add missing comma, fixes selected_hover_ and selected_insensitive prefixes. 2014-03-01 16:36:36 -05:00
Tom Rothamel 24893d8207 Fix docs. 2014-03-01 10:51:41 -05:00
Tom Rothamel a0a58c9129 Always reset l.init, not only on exceptions. 2014-02-28 17:36:02 -05:00
13 changed files with 219 additions and 40 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ except ImportError:
vc_version = 0
# The tuple giving the version number.
version_tuple = (6, 17, 2, vc_version)
version_tuple = (6, 17, 3, vc_version)
# The name of this version.
version_name = "In This Decade..."
+4
View File
@@ -96,6 +96,10 @@ init -1600 python:
console = [ 'shift_O' ],
console_older = [ 'K_UP' ],
console_newer = [ 'K_DOWN' ],
# Ignored (kept for backwards compatibility).
toggle_music = [ 'm' ],
)
init -1600 python:
+33 -18
View File
@@ -247,6 +247,36 @@ label _theme_test:
init -1050 python:
config.missing_background = "black"
style _missing_frame is _frame:
xalign 0.5
yalign 0.0
background "#0004"
xpadding 5
ypadding 5
style _missing_text is _text:
color "#fff"
xalign 0.5
screen _missing_images:
zorder -1050
$ missing = renpy.context().__missing
if missing:
frame:
style "_missing_frame"
has vbox
text _("{b}Missing Images{/b}"):
style "_missing_text"
for what in sorted(missing.values()):
text "[what!q]":
style "_missing_text"
init 1050 python:
if config.developer:
@@ -275,7 +305,7 @@ init 1050 python:
renpy.show(name, what=config.missing_background)
__missing_scene = False
what = " ".join(what).replace("{", "{{").replace("[", "[[")
what = " ".join(what)
__missing()[name[0]] = what
return True
@@ -285,7 +315,6 @@ init 1050 python:
global __missing_scene
__missing_scene = False
__missing().pop(name[0], None)
return True
@@ -299,25 +328,11 @@ init 1050 python:
return True
def __missing_overlay():
missing = __missing()
if not missing:
return
ui.vbox(xalign=0.5, yalign=0.0)
ui.text(_("Undefined Images"), xalign=0.5)
for what in sorted(missing.values()):
ui.text(what, xalign=0.5)
ui.close()
config.missing_scene = __missing_scene_callback
config.missing_show = __missing_show_callback
config.missing_hide = __missing_hide_callback
config.overlay_functions.append(__missing_overlay)
config.start_callbacks.append(Show("_missing_images"))
init -1050 python:
+80 -9
View File
@@ -1449,18 +1449,24 @@ def restart_interaction():
def context():
"""
Returns an object that is unique to the current context, that
participates in rollback and the like.
:doc: context
Returns an object that is unique to the current context. The object
is copied when entering a new context, but changes to the copy do
not change the original.
The object is saved and participates in rollback.
"""
return renpy.game.context().info
def context_nesting_level():
"""
:doc: context
Returns the nesting level of the current context. This is 0 for the
outermost context (the context that is saved, and in which most of
the game runs), and greater than zero when in a menu or other nested
context.
outermost context (the context that is saved, loaded, and rolled-back),
and is non-zero in other contexts, such as menu and replay contexts.
"""
return len(renpy.game.contexts) - 1
@@ -1530,6 +1536,8 @@ def log(msg):
def force_full_redraw():
"""
:doc: other
Forces the screen to be redrawn in full. Call this after using pygame
to redraw the screen directly.
"""
@@ -1661,6 +1669,12 @@ def image_size(im):
return surf.get_size()
def get_at_list(name, layer='master'):
"""
:undocumented:
Returns the list of transforms being applied to a layer.
"""
if isinstance(name, basestring):
name = tuple(name.split())
@@ -1668,9 +1682,21 @@ def get_at_list(name, layer='master'):
return renpy.game.context().scene_lists.at_list[layer].get(tag, None)
def layer_at_list(at_list, layer='master'):
def show_layer_at(at_list, layer='master'):
"""
:doc: se_images
The python equivalent of the ``show layer`` `layer` ``at`` `at_list`
statement.
"""
if not isinstance(at_list, list):
at_list = [ at_list ]
renpy.game.context().scene_lists.set_layer_at_list(layer, at_list)
layer_at_list = show_layer_at
def free_memory():
"""
:doc: other
@@ -1682,15 +1708,32 @@ def free_memory():
renpy.display.interface.kill_textures_and_surfaces()
def easy_displayable(d, none=False):
"""
:undocumented:
"""
if none:
return renpy.easy.displayable(d)
else:
return renpy.easy.displayable_or_none(d)
def quit_event():
"""
:doc: other
Triggers a quit event, as if the player clicked the quit button in the
window chrome.
"""
renpy.game.interface.quit_event()
def iconify():
"""
:doc: other
Iconifies the game.
"""
renpy.game.interface.iconify()
# New context stuff.
@@ -1743,6 +1786,20 @@ def end_interaction(value):
raise renpy.display.core.EndInteraction(value)
def scry():
"""
:doc: other
Returns the scry object for the current statement.
The scry object tells Ren'Py about things that must be true in the
future of the current statement. Right now, the scry object has one
field:
``nvl_clear``
Is true if an ``nvl clear`` statement will execute before the
next interaction.
"""
name = renpy.game.context().current
node = renpy.game.script.lookup(name)
return node.scry()
@@ -1800,6 +1857,8 @@ def load_module(name, **kwargs):
def load_string(s, filename="<string>"):
"""
:doc: other
Loads `s` as Ren'Py script that can be called.
Returns the name of the first statement in s.
@@ -1838,6 +1897,16 @@ def load_string(s, filename="<string>"):
renpy.game.exception_info = old_exception_info
def pop_call():
"""
:doc: other
Pops the current call from the call stack, without returning to
the location.
This can be used if a label that is called decides not to return
to its caller.
"""
renpy.game.context().pop_dynamic()
renpy.game.context().lookup_return(pop=True)
@@ -1845,13 +1914,15 @@ pop_return = pop_call
def call_stack_depth():
"""
Returns the depth of the call stack.
:doc: other
Returns the depth of the call stack of the current context - the number
of calls that have run without being returned from or popped from the
call stack.
"""
return len(renpy.game.context().return_stack)
def game_menu(screen=None):
"""
:undocumented: Probably not what we want in the presence of
+8 -7
View File
@@ -412,11 +412,11 @@ KEYWORDS = set([
])
OPERATORS = [
'or',
'and',
'not',
'in',
'is',
'or\b',
'and\b',
'not\b',
'in\b',
'is\b',
'<',
'<=',
'>',
@@ -1857,6 +1857,7 @@ def screen_statement(l, loc):
# The guts of screen language parsing is in screenlang.py. It
# assumes we ate the "screen" keyword before it's called.
screen = renpy.screenlang.parse_screen(l)
l.advance()
if not screen:
@@ -1946,7 +1947,7 @@ def translate_statement(l, loc):
block = [ python_statement(l, loc) ]
return [ ast.TranslateBlock(loc, language, block) ]
except:
finally:
l.init = old_init
elif identifier == "style":
@@ -1956,7 +1957,7 @@ def translate_statement(l, loc):
block = [ style_statement(l, loc) ]
return [ ast.TranslateBlock(loc, language, block) ]
except:
finally:
l.init = old_init
+1 -1
View File
@@ -98,7 +98,7 @@ STYLE_PREFIXES = [
'idle_',
'activate_',
'selected_',
'selected_insensitive_'
'selected_insensitive_',
'selected_hover_',
'selected_idle_',
'selected_activate_',
+16
View File
@@ -0,0 +1,16 @@
.. Automatically generated file - do not modify.
.. function:: renpy.context()
Returns an object that is unique to the current context. The object
is copied when entering a new context, but changes to the copy do
not change the original.
The object is saved and participates in rollback.
.. function:: renpy.context_nesting_level()
Returns the nesting level of the current context. This is 0 for the
outermost context (the context that is saved, loaded, and rolled-back),
and is non-zero in other contexts, such as menu and replay contexts.
+57
View File
@@ -1,5 +1,11 @@
.. Automatically generated file - do not modify.
.. function:: renpy.call_stack_depth()
Returns the depth of the call stack of the current context - the number
of calls that have run without being returned from or popped from the
call stack.
.. function:: renpy.choice_for_skipping()
Tells Ren'Py that a choice is coming up soon. This currently has
@@ -40,6 +46,11 @@
displayable. If it can, it will return them as a (x, y, w, h)
tuple. If not, it will return a (None, None, None, None) tuple.
.. function:: renpy.force_full_redraw()
Forces the screen to be redrawn in full. Call this after using pygame
to redraw the screen directly.
.. function:: renpy.free_memory()
Attempts to free some memory. Useful before running a renpygame-based
@@ -136,6 +147,10 @@
to run during the next interaction, or None if no such
transition exists.
.. function:: renpy.iconify()
Iconifies the game.
.. function:: renpy.is_seen(ever=True)
Returns true if the current line has been seen by the player.
@@ -156,6 +171,15 @@
Module loading may only occur from inside an init block.
.. function:: renpy.load_string(s, filename='<string>')
Loads `s` as Ren'Py script that can be called.
Returns the name of the first statement in s.
`filename` is the name of the filename that statements in the string will
appear to be from.
.. function:: renpy.notify(message)
Causes Ren'Py to display the `message` using the notify screen. By
@@ -189,6 +213,22 @@
`checkpoint`
If true, a checkpoint is placed so rollback can occur.
.. function:: renpy.pop_call()
Pops the current call from the call stack, without returning to
the location.
This can be used if a label that is called decides not to return
to its caller.
.. function:: renpy.pop_return()
Pops the current call from the call stack, without returning to
the location.
This can be used if a label that is called decides not to return
to its caller.
.. function:: renpy.quit(relaunch=False, status=0)
This causes Ren'Py to exit entirely.
@@ -200,6 +240,11 @@
The status code Ren'Py will return to the operating system.
Generally, 0 is success, and positive integers are failure.
.. function:: renpy.quit_event()
Triggers a quit event, as if the player clicked the quit button in the
window chrome.
.. function:: renpy.restart_interaction()
Restarts the current interaction. Among other things, this displays
@@ -214,6 +259,18 @@
Saves a screenshot in `filename`.
.. function:: renpy.scry()
Returns the scry object for the current statement.
The scry object tells Ren'Py about things that must be true in the
future of the current statement. Right now, the scry object has one
field:
``nvl_clear``
Is true if an ``nvl clear`` statement will execute before the
next interaction.
.. function:: renpy.set_mouse_pos(x, y, duration=0)
Jump the mouse pointer to the location given by arguments x and y.
+10
View File
@@ -25,6 +25,11 @@
This function may only be run from inside an init block. It is an
error to run this function once the game has started.
.. function:: renpy.layer_at_list(at_list, layer='master')
The python equivalent of the ``show layer`` `layer` ``at`` `at_list`
statement.
.. function:: renpy.scene(layer='master')
Removes all displayables from `layer`. This is equivalent to the scene
@@ -73,3 +78,8 @@
A list of strings, giving image tags that this image is shown behind.
The equivalent of the ``behind`` property.
.. function:: renpy.show_layer_at(at_list, layer='master')
The python equivalent of the ``show layer`` `layer` ``at`` `at_list`
statement.
+6 -1
View File
@@ -48,7 +48,7 @@ statement, and removes the space key from that list. ::
$ config.keymap['dismiss'].remove('K_SPACE')
The default keymap is contained inside the python code implementing Ren'Py, and
as of version 6.16 is as follows::
as of version 6.17 is as follows::
config.keymap = dict(
@@ -60,6 +60,7 @@ as of version 6.16 is as follows::
game_menu = [ 'K_ESCAPE', 'mouseup_3', 'joy_menu' ],
hide_windows = [ 'mouseup_2', 'h', 'joy_hide' ],
launch_editor = [ 'E' ],
dump_styles = [ ],
reload_game = [ 'R' ],
inspector = [ 'I' ],
developer = [ 'D' ],
@@ -124,4 +125,8 @@ as of version 6.16 is as follows::
console = [ 'shift_O' ],
console_older = [ 'K_UP' ],
console_newer = [ 'K_DOWN' ],
# Ignored (kept for backwards compatibility).
toggle_music = [ 'm' ],
)
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -34,7 +34,7 @@ Here's an example python screen:
ui.text(who, id="who")
ui.text(what, id="what")
ui.close("return")
ui.close()
renpy.define_screen("say", say_screen)
File diff suppressed because one or more lines are too long