/usr/share/doc/renpy/html/keym.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 | <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Customizing the Keymap — Ren'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.16.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'Py Documentation" href="index.html" />
<link rel="next" title="Image Gallery, Music Room, and Replay Actions" href="rooms.html" />
<link rel="prev" title="Environment Variables" href="environment_variables.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="rooms.html" title="Image Gallery, Music Room, and Replay Actions"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="environment_variables.html" title="Environment Variables"
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'Py Documentation</a></li>
</ul>
</div>
<div class="container">
<div class="span4">
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="environment_variables.html"
title="previous chapter">Environment Variables</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="rooms.html"
title="next chapter">Image Gallery, Music Room, and Replay Actions</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="customizing-the-keymap">
<h1>Customizing the Keymap<a class="headerlink" href="#customizing-the-keymap" title="Permalink to this headline">ΒΆ</a></h1>
<p>The variable <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> contains a map from functions that can be
performed by the various user-interface elements of Ren'Py to a list of keysyms
(a keysym is a key symbol) that actually perform those functions. Modifying the
contents of the keymap can change the keys and mouse buttons that cause things
to happen.</p>
<p>While this functionality has been added to Ren'Py at a user's request (and
because it simplifies the Ren'Py code), it's not altogether clear that it
should be used. Having a common set of keybindings makes games easier to play
by reducing the learning curve of users. It's probably better to build
consensus around a change in keybindings, rather than unilaterally making one
game different from every other game.</p>
<p>Anyway, in Ren'Py keysyms are strings. The first kind of keysym is of the form
'mouseup_#' or 'mousedown_#', for a number between 1 and 5. These keysyms are
generated by mouse button presses, releases, or turns of the mouse wheel. For
example, "mousedown_1" is generally a press of the left mouse button,
"mouseup_1" is a release of that button, and "mousedown_4" is a turn of the the
mouse wheel to the top.</p>
<p>A second kind of keysym is a joystick keysym. These begin with joy_. They are
defined in <tt class="xref std std-var docutils literal"><span class="pre">config.joystick_keys</span></tt>, and mapped to actual joystick events by
the user.</p>
<p>A third kind of keysym is a string containing a character that is generated
when a key is pressed. This is useful for binding alphabetic keys and numbers.
Examples of these keysyms include "a", "A", and "7".</p>
<p>The final kind of keysym is the symbolic name for the key. This can be any of
the K_ constants taken from pygame.constants. This type of keysym looks like
"K_BACKSPACE", "K_RETURN", and "K_TAB"; a full list of this kind of keysyms may
be found here.</p>
<p>To change a binding, update the appropriate list 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>. The
following code adds the 't' key to the list of keys that dismiss a say
statement, and removes the space key from that list.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">init</span><span class="p">:</span>
<span class="k">$</span> <span class="n">config</span><span class="o">.</span><span class="n">keymap</span><span class="p">[</span><span class="s">'dismiss'</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s">'t'</span><span class="p">)</span>
<span class="k">$</span> <span class="n">config</span><span class="o">.</span><span class="n">keymap</span><span class="p">[</span><span class="s">'dismiss'</span><span class="p">]</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="s">'K_SPACE'</span><span class="p">)</span>
</pre></div>
</div>
<p>The default keymap is contained inside the python code implementing Ren'Py, and
as of version 6.16 is as follows</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="n">config</span><span class="o">.</span><span class="n">keymap</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span>
<span class="c"># Bindings present almost everywhere, unless explicitly</span>
<span class="c"># disabled.</span>
<span class="n">rollback</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'K_PAGEUP'</span><span class="p">,</span> <span class="s">'mousedown_4'</span><span class="p">,</span> <span class="s">'joy_rollback'</span> <span class="p">],</span>
<span class="n">screenshot</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'s'</span> <span class="p">],</span>
<span class="n">toggle_fullscreen</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'f'</span><span class="p">,</span> <span class="s">'alt_K_RETURN'</span><span class="p">,</span> <span class="s">'alt_K_KP_ENTER'</span><span class="p">,</span> <span class="s">'K_F11'</span> <span class="p">],</span>
<span class="n">toggle_music</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'m'</span> <span class="p">],</span>
<span class="n">game_menu</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'K_ESCAPE'</span><span class="p">,</span> <span class="s">'mouseup_3'</span><span class="p">,</span> <span class="s">'joy_menu'</span> <span class="p">],</span>
<span class="n">hide_windows</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'mouseup_2'</span><span class="p">,</span> <span class="s">'h'</span><span class="p">,</span> <span class="s">'joy_hide'</span> <span class="p">],</span>
<span class="n">launch_editor</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'E'</span> <span class="p">],</span>
<span class="n">dump_styles</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'Y'</span> <span class="p">],</span>
<span class="n">reload_game</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'R'</span> <span class="p">],</span>
<span class="n">inspector</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'I'</span> <span class="p">],</span>
<span class="n">developer</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'D'</span> <span class="p">],</span>
<span class="n">quit</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'meta_q'</span><span class="p">,</span> <span class="s">'alt_K_F4'</span><span class="p">,</span> <span class="s">'alt_q'</span> <span class="p">],</span>
<span class="n">iconify</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'meta_m'</span><span class="p">,</span> <span class="s">'alt_m'</span> <span class="p">],</span>
<span class="n">help</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'K_F1'</span><span class="p">,</span> <span class="s">'meta_shift_/'</span> <span class="p">],</span>
<span class="n">choose_renderer</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'G'</span> <span class="p">],</span>
<span class="c"># Say.</span>
<span class="n">rollforward</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'mousedown_5'</span><span class="p">,</span> <span class="s">'K_PAGEDOWN'</span> <span class="p">],</span>
<span class="n">dismiss</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'mouseup_1'</span><span class="p">,</span> <span class="s">'K_RETURN'</span><span class="p">,</span> <span class="s">'K_SPACE'</span><span class="p">,</span> <span class="s">'K_KP_ENTER'</span><span class="p">,</span> <span class="s">'joy_dismiss'</span> <span class="p">],</span>
<span class="c"># Pause.</span>
<span class="n">dismiss_hard_pause</span> <span class="o">=</span> <span class="p">[</span> <span class="p">],</span>
<span class="c"># Focus.</span>
<span class="n">focus_left</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'K_LEFT'</span><span class="p">,</span> <span class="s">'joy_left'</span> <span class="p">],</span>
<span class="n">focus_right</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'K_RIGHT'</span><span class="p">,</span> <span class="s">'joy_right'</span> <span class="p">],</span>
<span class="n">focus_up</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'K_UP'</span><span class="p">,</span> <span class="s">'joy_up'</span> <span class="p">],</span>
<span class="n">focus_down</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'K_DOWN'</span><span class="p">,</span> <span class="s">'joy_down'</span> <span class="p">],</span>
<span class="c"># Button.</span>
<span class="n">button_ignore</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'mousedown_1'</span> <span class="p">],</span>
<span class="n">button_select</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'mouseup_1'</span><span class="p">,</span> <span class="s">'K_RETURN'</span><span class="p">,</span> <span class="s">'K_KP_ENTER'</span><span class="p">,</span> <span class="s">'joy_dismiss'</span> <span class="p">],</span>
<span class="c"># Input.</span>
<span class="n">input_backspace</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'K_BACKSPACE'</span> <span class="p">],</span>
<span class="n">input_enter</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'K_RETURN'</span><span class="p">,</span> <span class="s">'K_KP_ENTER'</span> <span class="p">],</span>
<span class="n">input_left</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'K_LEFT'</span> <span class="p">],</span>
<span class="n">input_right</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'K_RIGHT'</span> <span class="p">],</span>
<span class="n">input_delete</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'K_DELETE'</span> <span class="p">],</span>
<span class="c"># Viewport.</span>
<span class="n">viewport_up</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'mousedown_4'</span> <span class="p">],</span>
<span class="n">viewport_down</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'mousedown_5'</span> <span class="p">],</span>
<span class="n">viewport_drag_start</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'mousedown_1'</span> <span class="p">],</span>
<span class="n">viewport_drag_end</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'mouseup_1'</span> <span class="p">],</span>
<span class="c"># These keys control skipping.</span>
<span class="n">skip</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'K_LCTRL'</span><span class="p">,</span> <span class="s">'K_RCTRL'</span><span class="p">,</span> <span class="s">'joy_holdskip'</span> <span class="p">],</span>
<span class="n">toggle_skip</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'K_TAB'</span><span class="p">,</span> <span class="s">'joy_toggleskip'</span> <span class="p">],</span>
<span class="n">fast_skip</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'>'</span> <span class="p">],</span>
<span class="c"># Bar.</span>
<span class="n">bar_activate</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'mousedown_1'</span><span class="p">,</span> <span class="s">'K_RETURN'</span><span class="p">,</span> <span class="s">'K_KP_ENTER'</span><span class="p">,</span> <span class="s">'joy_dismiss'</span> <span class="p">],</span>
<span class="n">bar_deactivate</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'mouseup_1'</span><span class="p">,</span> <span class="s">'K_RETURN'</span><span class="p">,</span> <span class="s">'K_KP_ENTER'</span><span class="p">,</span> <span class="s">'joy_dismiss'</span> <span class="p">],</span>
<span class="n">bar_left</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'K_LEFT'</span><span class="p">,</span> <span class="s">'joy_left'</span> <span class="p">],</span>
<span class="n">bar_right</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'K_RIGHT'</span><span class="p">,</span> <span class="s">'joy_right'</span> <span class="p">],</span>
<span class="n">bar_up</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'K_UP'</span><span class="p">,</span> <span class="s">'joy_up'</span> <span class="p">],</span>
<span class="n">bar_down</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'K_DOWN'</span><span class="p">,</span> <span class="s">'joy_down'</span> <span class="p">],</span>
<span class="c"># Delete a save.</span>
<span class="n">save_delete</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'K_DELETE'</span> <span class="p">],</span>
<span class="c"># Draggable.</span>
<span class="n">drag_activate</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'mousedown_1'</span> <span class="p">],</span>
<span class="n">drag_deactivate</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'mouseup_1'</span> <span class="p">],</span>
<span class="c"># Debug console.</span>
<span class="n">console</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'shift_O'</span> <span class="p">],</span>
<span class="n">console_older</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'K_UP'</span> <span class="p">],</span>
<span class="n">console_newer</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'K_DOWN'</span> <span class="p">],</span>
<span class="p">)</span>
</pre></div>
</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="rooms.html" title="Image Gallery, Music Room, and Replay Actions"
>next</a> |</li>
<li class="right" >
<a href="environment_variables.html" title="Environment Variables"
>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'Py Documentation</a></li>
</ul>
</div>
</body>
</html>
|