This file is indexed.

/usr/share/doc/renpy/html/udd.html is in renpy-doc 6.17.6-1.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
<!DOCTYPE html>

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Creator-Defined Displayables &mdash; Ren&#39;Py Documentation</title>
    <link rel="stylesheet" href="_static/screen.css" type="text/css" media="screen, projection"/>
    <link rel="stylesheet" href="_static/renpydoc.css" type="text/css" media="print" />

    <!--[if lt IE 8]>
    <link rel="stylesheet" href="_static/renpydoc.css" type="text/css" media="screen, projection"/>
    <![endif]-->

    <link rel="stylesheet" href="_static/renpydoc.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '6.18.0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="Ren&#39;Py Documentation" href="index.html" />
    <link rel="next" title="Creator-Defined Statements" href="cds.html" />
    <link rel="prev" title="Modes" href="modes.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="cds.html" title="Creator-Defined Statements"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="modes.html" title="Modes"
             accesskey="P">previous</a> |</li>

        <li> <img src="_static/logo.png" width=19 height=21 align=center> 
        <li> <a href="http://www.renpy.org/">Ren'Py Home</a> |
        <li><a href="index.html">Ren&#39;Py Documentation</a></li> 
      </ul>
    </div>
  <div class="container">
  <div class="span4">
    
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Creator-Defined Displayables</a><ul>
<li><a class="reference internal" href="#example">Example</a></li>
<li><a class="reference internal" href="#renpy-displayable">renpy.Displayable</a></li>
<li><a class="reference internal" href="#renpy-render">renpy.Render</a></li>
<li><a class="reference internal" href="#utility-functions">Utility Functions</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="modes.html"
                        title="previous chapter">Modes</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="cds.html"
                        title="next chapter">Creator-Defined Statements</a></p>
            <h4>Search</h4>
            
            <div id="cse-search-form" style="width: 100%;"></div>

      <div class="copydata">
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
    <br>
      </div>
        </div>
      </div>
  
  </div>
  
    
    <div class="document span20 last">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="creator-defined-displayables">
<span id="cdd"></span><span id="udd"></span><h1>Creator-Defined Displayables<a class="headerlink" href="#creator-defined-displayables" title="Permalink to this headline"></a></h1>
<p>The most complex, but most powerful, way of customizing Ren'Py's
behavior is to use a creator-defined displayable. A creator-defined
displayable is allowed to take arbitrary pygame events. It can
also render other displayables, and place them at arbitrary locations
on the screen. This makes it suitable for creating 2D mini-games that
cannot be expressed with the tools Ren'Py gives you. (But see also the
section <a class="reference internal" href="sprites.html#sprites"><em>sprites</em></a>, which describes a higher-level way
of accomplishing many of the same things.)</p>
<p>Creator-defined displayables are programmed entirely in Python, and we
encourage you to have a reasonable degree of skill at object-oriented
Python programming before you begin creating one.</p>
<div class="section" id="example">
<h2>Example<a class="headerlink" href="#example" title="Permalink to this headline"></a></h2>
<p>Here's an example of a creator-defined displayable. This displayable
changes renders its child with an alpha that is determined by the
distance of the mouse pointer from the center of the child.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">init</span> <span class="k">python</span><span class="p">:</span>

    <span class="kn">import</span> <span class="nn">math</span>

    <span class="k">class</span> <span class="nc">Appearing</span><span class="p">(</span><span class="n">renpy</span><span class="o">.</span><span class="n">Displayable</span><span class="p">):</span>

        <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="na">child</span><span class="p">,</span> <span class="n">opaque_distance</span><span class="p">,</span> <span class="n">transparent_distance</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>

            <span class="c"># Pass additional properties on to the renpy.Displayable</span>
            <span class="c"># constructor.</span>
            <span class="nb">super</span><span class="p">(</span><span class="n">Appearing</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

            <span class="c"># The child.</span>
            <span class="bp">self</span><span class="o">.</span><span class="na">child</span> <span class="o">=</span> <span class="n">renpy</span><span class="o">.</span><span class="n">displayable</span><span class="p">(</span><span class="na">child</span><span class="p">)</span>

            <span class="c"># The distance at which the child will become fully opaque, and</span>
            <span class="c"># where it will become fully transparent. The former must be less</span>
            <span class="c"># than the latter.</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">opaque_distance</span> <span class="o">=</span> <span class="n">opaque_distance</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">transparent_distance</span> <span class="o">=</span> <span class="n">transparent_distance</span>

            <span class="c"># The alpha channel of the child.</span>
            <span class="bp">self</span><span class="o">.</span><span class="na">alpha</span> <span class="o">=</span> <span class="mf">0.0</span>

            <span class="c"># The width and height of us, and our child.</span>
            <span class="bp">self</span><span class="o">.</span><span class="na">width</span> <span class="o">=</span> <span class="mi">0</span>
            <span class="bp">self</span><span class="o">.</span><span class="na">height</span> <span class="o">=</span> <span class="mi">0</span>

        <span class="k">def</span> <span class="nf">render</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="na">width</span><span class="p">,</span> <span class="na">height</span><span class="p">,</span> <span class="n">st</span><span class="p">,</span> <span class="k">at</span><span class="p">):</span>

            <span class="c"># Create a transform, that can adjust the alpha channel of the</span>
            <span class="c"># child.</span>
            <span class="n">t</span> <span class="o">=</span> <span class="n">Transform</span><span class="p">(</span><span class="na">child</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="na">child</span><span class="p">,</span> <span class="na">alpha</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="na">alpha</span><span class="p">)</span>

            <span class="c"># Create a render from the child.</span>
            <span class="n">child_render</span> <span class="o">=</span> <span class="n">renpy</span><span class="o">.</span><span class="n">render</span><span class="p">(</span><span class="n">t</span><span class="p">,</span> <span class="na">width</span><span class="p">,</span> <span class="na">height</span><span class="p">,</span> <span class="n">st</span><span class="p">,</span> <span class="k">at</span><span class="p">)</span>

            <span class="c"># Get the size of the child.</span>
            <span class="bp">self</span><span class="o">.</span><span class="na">width</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="na">height</span> <span class="o">=</span> <span class="n">child_render</span><span class="o">.</span><span class="n">get_size</span><span class="p">()</span>

            <span class="c"># Create the render we will return.</span>
            <span class="n">render</span> <span class="o">=</span> <span class="n">renpy</span><span class="o">.</span><span class="n">Render</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="na">width</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="na">height</span><span class="p">)</span>

            <span class="c"># Blit (draw) the child&#39;s render to our render.</span>
            <span class="n">render</span><span class="o">.</span><span class="n">blit</span><span class="p">(</span><span class="n">child_render</span><span class="p">,</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span>

            <span class="c"># Return the render.</span>
            <span class="k">return</span> <span class="n">render</span>

        <span class="k">def</span> <span class="nf">event</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ev</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">st</span><span class="p">):</span>

            <span class="c"># Compute the distance between the center of this displayable and</span>
            <span class="c"># the mouse pointer. The mouse pointer is supplied in x and y,</span>
            <span class="c"># relative to the upper-left corner of the displayable.</span>
            <span class="n">distance</span> <span class="o">=</span> <span class="n">math</span><span class="o">.</span><span class="n">hypot</span><span class="p">(</span><span class="n">x</span> <span class="o">-</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="na">width</span> <span class="o">/</span> <span class="mi">2</span><span class="p">),</span> <span class="n">y</span> <span class="o">-</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="na">height</span> <span class="o">/</span> <span class="mi">2</span><span class="p">))</span>

            <span class="c"># Base on the distance, figure out an alpha.</span>
            <span class="k">if</span> <span class="n">distance</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">opaque_distance</span><span class="p">:</span>
                <span class="na">alpha</span> <span class="o">=</span> <span class="mf">1.0</span>
            <span class="k">elif</span> <span class="n">distance</span> <span class="o">&gt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">transparent_distance</span><span class="p">:</span>
                <span class="na">alpha</span> <span class="o">=</span> <span class="mf">0.0</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="na">alpha</span> <span class="o">=</span> <span class="mf">1.0</span> <span class="o">-</span> <span class="mf">1.0</span> <span class="o">*</span> <span class="p">(</span><span class="n">distance</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">opaque_distance</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">transparent_distance</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">opaque_distance</span><span class="p">)</span>

            <span class="c"># If the alpha has changed, trigger a redraw event.</span>
            <span class="k">if</span> <span class="na">alpha</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="na">alpha</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="na">alpha</span> <span class="o">=</span> <span class="na">alpha</span>
                <span class="n">renpy</span><span class="o">.</span><span class="n">redraw</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>

            <span class="c"># Pass the event to our child.</span>
            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="na">child</span><span class="o">.</span><span class="k">event</span><span class="p">(</span><span class="n">ev</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">st</span><span class="p">)</span>

       <span class="k">def</span> <span class="nf">visit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
           <span class="k">return</span> <span class="p">[</span> <span class="bp">self</span><span class="o">.</span><span class="na">child</span> <span class="p">]</span>
</pre></div>
</div>
<p>To use the creator-defined displayable, we can create an instance of it,
and add that instance to the screen.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">screen</span> <span class="n">alpha_magic</span><span class="p">:</span>
    <span class="k">add</span> <span class="n">Appearing</span><span class="p">(</span><span class="s">&quot;logo.png&quot;</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">200</span><span class="p">):</span>
        <span class="na">xalign</span> <span class="mf">0.5</span>
        <span class="na">yalign</span> <span class="mf">0.5</span>

<span class="k">label</span> <span class="n">start</span><span class="p">:</span>
    <span class="k">show</span> <span class="k">screen</span> <span class="n">alpha_magic</span>

    <span class="s">&quot;Can you find the logo?&quot;</span>

    <span class="k">return</span>
</pre></div>
</div>
</div>
<div class="section" id="renpy-displayable">
<h2>renpy.Displayable<a class="headerlink" href="#renpy-displayable" title="Permalink to this headline"></a></h2>
<p>A creator-defined displayable is created by subclassing the
renpy.Displayable class. A creator-defined displayable must override
the render method, and may override other methods as well.</p>
<p>A displayable object must be pickleable, which means it may not
contain references to objects that cannot be pickled. Most notably,
Render objects cannot be stored in a creator-defined displayable.</p>
<p>Since we expect you to override the methods of the displayable
class, we'll present them with the <cite>self</cite> parameter.</p>
<dl class="class">
<dt id="renpy.Displayable">
<em class="property">class </em><tt class="descclassname">renpy.</tt><tt class="descname">Displayable</tt><a class="headerlink" href="#renpy.Displayable" title="Permalink to this definition"></a></dt>
<dd><p>Base class for creator-defined displayables.</p>
<dl class="method">
<dt>
<tt class="descname">__init__(**properties):</tt></dt>
<dd><p>A subclass may override the constructor, perhaps adding new
parameters. If it does, it should pass all unknown keyword
arguments to the renpy.Displayable constructor, using code
like:</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="nb">super</span><span class="p">(</span><span class="n">MyDisplayable</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="o">**</span><span class="n">properties</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="renpy.Displayable.render">
<tt class="descname">render</tt><big>(</big><em>self</em>, <em>width</em>, <em>height</em>, <em>st</em>, <em>at</em><big>)</big><a class="headerlink" href="#renpy.Displayable.render" title="Permalink to this definition"></a></dt>
<dd><p>Subclasses must override this, to return a <a class="reference internal" href="#renpy.Render" title="renpy.Render"><tt class="xref py py-class docutils literal"><span class="pre">renpy.Render</span></tt></a>
object. The render object determines what, if anything, is
shown on the screen.</p>
<dl class="docutils">
<dt><cite>width</cite>, <cite>height</cite></dt>
<dd>The amount of space available to this displayable, in
pixels.</dd>
<dt><cite>st</cite></dt>
<dd>A float, the shown timebase, in seconds. The shown
timebase begins when this displayable is first shown
on the screen.</dd>
<dt><cite>at</cite></dt>
<dd>A float, the animation timebase, in seconds. The animation
timebase begins when an image with the same tag was shown,
without being hidden. (When the displayable is shown
without a tag, this is the same as the shown timebase.)</dd>
</dl>
<p>The render method is called when the displayable is first
shown. It can be called again if <a class="reference internal" href="#renpy.redraw" title="renpy.redraw"><tt class="xref py py-func docutils literal"><span class="pre">renpy.redraw()</span></tt></a>
is called on this object.</p>
</dd></dl>

<dl class="method">
<dt id="renpy.Displayable.event">
<tt class="descname">event</tt><big>(</big><em>self</em>, <em>ev</em>, <em>x</em>, <em>y</em>, <em>st</em><big>)</big><a class="headerlink" href="#renpy.Displayable.event" title="Permalink to this definition"></a></dt>
<dd><p>The event method is called to pass a pygame event to
the creator-defined displayable. If the event method returns
a value other than None, that value is returned as the result
of the interaction.</p>
<p>The event method exists on other displayables, allowing the
creator-defined displayable to pass on the event.</p>
<dl class="docutils">
<dt><cite>ev</cite></dt>
<dd>An <a class="reference external" href="http://www.pygame.org/docs/ref/event.html">event object</a></dd>
<dt><cite>x</cite>, <cite>y</cite></dt>
<dd>The x and y coordinates of the event, relative to the
upper-left corner of the displayable. These should
be used in preference to position information
found in the pygame event objects.</dd>
<dt><cite>st</cite></dt>
<dd>A float, the shown timebase, in seconds.</dd>
</dl>
<p>An event is generated at the start of each interaction, and
<a class="reference internal" href="#renpy.timeout" title="renpy.timeout"><tt class="xref py py-func docutils literal"><span class="pre">renpy.timeout()</span></tt></a> can be used to cause another event to
occur.</p>
</dd></dl>

<dl class="method">
<dt id="renpy.Displayable.per_interact">
<tt class="descname">per_interact</tt><big>(</big><em>self</em><big>)</big><a class="headerlink" href="#renpy.Displayable.per_interact" title="Permalink to this definition"></a></dt>
<dd><p>This method is called at the start of each interaction. It
can be used to trigger a redraw, and probably should be used
to trigger a redraw if the object participates in rollback.</p>
</dd></dl>

<dl class="method">
<dt id="renpy.Displayable.visit">
<tt class="descname">visit</tt><big>(</big><em>self</em><big>)</big><a class="headerlink" href="#renpy.Displayable.visit" title="Permalink to this definition"></a></dt>
<dd><p>If the displayable has child displayables, this method should
be overridden to return a list of those displayables. This
ensures that the per_interact methods of those displayables
are called, and also allows images used by those displayables
to be predicted.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="renpy-render">
<h2>renpy.Render<a class="headerlink" href="#renpy-render" title="Permalink to this headline"></a></h2>
<p>creator-defined displayables work with renpy.Render objects. Render
objects are returned by calling the <a class="reference internal" href="#renpy.render" title="renpy.render"><tt class="xref py py-func docutils literal"><span class="pre">renpy.render()</span></tt></a> function on a
displayable. A creator-defined displayable should create a Render object
by calling <a class="reference internal" href="#renpy.Render" title="renpy.Render"><tt class="xref py py-class docutils literal"><span class="pre">renpy.Render</span></tt></a> from its render method.</p>
<p>Since the render object isn't intended to be subclassed, we will omit
the implicit <cite>self</cite> parameter.</p>
<dl class="class">
<dt id="renpy.Render">
<em class="property">class </em><tt class="descclassname">renpy.</tt><tt class="descname">Render</tt><big>(</big><em>width</em>, <em>height</em><big>)</big><a class="headerlink" href="#renpy.Render" title="Permalink to this definition"></a></dt>
<dd><p>Creates a new Render object.</p>
<dl class="docutils">
<dt><cite>width</cite>, <cite>height</cite></dt>
<dd>The width and height of the render object, in pixels.</dd>
</dl>
<dl class="method">
<dt id="renpy.Render.blit">
<tt class="descname">blit</tt><big>(</big><em>source</em>, <em>pos</em><big>)</big><a class="headerlink" href="#renpy.Render.blit" title="Permalink to this definition"></a></dt>
<dd><p>Draws another render object into this render object.</p>
<dl class="docutils">
<dt><cite>source</cite></dt>
<dd>The render object to draw.</dd>
<dt><cite>pos</cite></dt>
<dd>The location to draw into. This is an (x, y) tuple
with the coordinates being pixels relative to the
upper-left corner of the target render.</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="renpy.Render.canvas">
<tt class="descname">canvas</tt><big>(</big><big>)</big><a class="headerlink" href="#renpy.Render.canvas" title="Permalink to this definition"></a></dt>
<dd><p>Returns a canvas object. A canvas object has methods
corresponding to the
<a class="reference external" href="http://www.pygame.org/docs/ref/draw.html">pygame.draw</a>
functions, with the first parameter (the surface) omitted.</p>
</dd></dl>

<dl class="method">
<dt id="renpy.Render.get_size">
<tt class="descname">get_size</tt><big>(</big><big>)</big><a class="headerlink" href="#renpy.Render.get_size" title="Permalink to this definition"></a></dt>
<dd><p>Returns a (width, height) tuple giving the size of
this render.</p>
</dd></dl>

<dl class="method">
<dt id="renpy.Render.subsurface">
<tt class="descname">subsurface</tt><big>(</big><em>rect</em><big>)</big><a class="headerlink" href="#renpy.Render.subsurface" title="Permalink to this definition"></a></dt>
<dd><p>Returns a render consisting of a rectangle cut out of this
render.</p>
<dl class="docutils">
<dt><cite>rect</cite></dt>
<dd>A (x, y, width, height) tuple.</dd>
</dl>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="utility-functions">
<h2>Utility Functions<a class="headerlink" href="#utility-functions" title="Permalink to this headline"></a></h2>
<p>These function manage the rendering process.</p>
<dl class="function">
<dt id="renpy.displayable">
<tt class="descclassname">renpy.</tt><tt class="descname">displayable</tt><big>(</big><em>d</em><big>)</big><a class="headerlink" href="#renpy.displayable" title="Permalink to this definition"></a></dt>
<dd><p>This takes <cite>d</cite>, which may be a displayable object or a string. If it's
a string, it converts that string into a displayable using the usual
rules.</p>
</dd></dl>

<dl class="function">
<dt id="renpy.end_interaction">
<tt class="descclassname">renpy.</tt><tt class="descname">end_interaction</tt><big>(</big><em>value</em><big>)</big><a class="headerlink" href="#renpy.end_interaction" title="Permalink to this definition"></a></dt>
<dd><p>If <cite>value</cite> is not None, immediately ends the current interaction, causing
the interaction to return <cite>value</cite>. If <cite>value</cite> is None, does nothing.</p>
<p>This can be called from inside the render and event methods of a
creator-defined displayable.</p>
</dd></dl>

<dl class="function">
<dt id="renpy.map_event">
<tt class="descclassname">renpy.</tt><tt class="descname">map_event</tt><big>(</big><em>ev</em>, <em>keysym</em><big>)</big><a class="headerlink" href="#renpy.map_event" title="Permalink to this definition"></a></dt>
<dd><p>Returns true if the pygame event <cite>ev</cite> matches <cite>keysym</cite></p>
<dl class="docutils">
<dt><cite>keysym</cite></dt>
<dd><p class="first">One of:</p>
<ul class="last simple">
<li>The name of a keybinding in <a class="reference internal" href="config.html#var-config.keymap"><tt class="xref std std-var docutils literal"><span class="pre">config.keymap</span></tt></a>.</li>
<li>A keysym, as documented in the <a class="reference internal" href="keymap.html#keymap"><em>Customizing the Keymap</em></a> section.</li>
<li>A list containing one or more keysyms.</li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="renpy.render">
<tt class="descclassname">renpy.</tt><tt class="descname">render</tt><big>(</big><em>d</em>, <em>width</em>, <em>height</em>, <em>st</em>, <em>at</em><big>)</big><a class="headerlink" href="#renpy.render" title="Permalink to this definition"></a></dt>
<dd><p>Causes a displayable to be rendered, and a renpy.Render object to
be returned.</p>
<dl class="docutils">
<dt><cite>d</cite></dt>
<dd>The displayable to render.</dd>
<dt><cite>width</cite>, <cite>height</cite></dt>
<dd>The width and height available for the displayable to render into.</dd>
<dt><cite>st</cite>, <cite>at</cite></dt>
<dd>The shown and animation timebases.</dd>
</dl>
<p>Renders returned by this object may be cached, and should not be modified
once they have been retrieved.</p>
</dd></dl>

<dl class="function">
<dt id="renpy.timeout">
<tt class="descclassname">renpy.</tt><tt class="descname">timeout</tt><big>(</big><em>seconds</em><big>)</big><a class="headerlink" href="#renpy.timeout" title="Permalink to this definition"></a></dt>
<dd><p>Causes an event to be generated before <cite>seconds</cite> seconds have elapsed.
This ensures that the event method of a user-defined displayable will be
called.</p>
</dd></dl>

<dl class="function">
<dt id="renpy.redraw">
<tt class="descclassname">renpy.</tt><tt class="descname">redraw</tt><big>(</big><em>d</em>, <em>when</em><big>)</big><a class="headerlink" href="#renpy.redraw" title="Permalink to this definition"></a></dt>
<dd><p>Causes the displayable <cite>d</cite> to be redrawn after <cite>when</cite> seconds have
elapsed.</p>
</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
    </div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="cds.html" title="Creator-Defined Statements"
             >next</a> |</li>
        <li class="right" >
          <a href="modes.html" title="Modes"
             >previous</a> |</li>

        <li> <img src="_static/logo.png" width=19 height=21 align=center> 
        <li> <a href="http://www.renpy.org/">Ren'Py Home</a> |
        <li><a href="index.html">Ren&#39;Py Documentation</a></li> 
      </ul>
    </div>



  </body>
</html>