1
0
mirror of https://github.com/psychopy/psychojs.git synced 2025-05-10 10:40:54 +00:00
psychojs/docs/module-core.Window.html
2019-03-12 09:28:31 +01:00

2561 lines
28 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: Window</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: Window</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>
<span class="ancestors"><a href="module-core.html">core</a>.</span>Window<span class="signature">(options)</span><span class="type-signature"></span></h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="Window"><span class="type-signature"></span>new Window<span class="signature">(options)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Window displays the various stimuli of the experiment.</p>
<p>It sets up a <a href="http://www.pixijs.com/">PIXI</a> renderer, which we use to render the experiment stimuli.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>psychoJS</code></td>
<td class="type">
<span class="param-type"><a href="PsychoJS.html">PsychoJS</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">the PsychoJS instance</td>
</tr>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last">the name of the window</td>
</tr>
<tr>
<td class="name"><code>fullscr</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last">whether or not to go fullscreen</td>
</tr>
<tr>
<td class="name"><code>color</code></td>
<td class="type">
<span class="param-type">Color</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
Color('black')
</td>
<td class="description last">the background color of the window</td>
</tr>
<tr>
<td class="name"><code>units</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
'pix'
</td>
<td class="description last">the units of the window</td>
</tr>
<tr>
<td class="name"><code>autoLog</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last">whether or not to log</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_Window.js.html">core/Window.js</a>, <a href="core_Window.js.html#line14">line 14</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Extends</h3>
<ul>
<li>PsychObject</li>
</ul>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="_fullRefresh"><span class="type-signature">(private) </span>_fullRefresh<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Force an update of all stimuli in this window's drawlist.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_Window.js.html">core/Window.js</a>, <a href="core_Window.js.html#line284">line 284</a>
</li></ul></dd>
</dl>
<h4 class="name" id="_refresh"><span class="type-signature">(private) </span>_refresh<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Recompute this window's draw list and _container children for the next animation frame.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_Window.js.html">core/Window.js</a>, <a href="core_Window.js.html#line264">line 264</a>
</li></ul></dd>
</dl>
<h4 class="name" id="_resizePixiRenderer"><span class="type-signature">(private) </span>_resizePixiRenderer<span class="signature">(pjsWindow, event)</span><span class="type-signature"></span></h4>
<div class="description">
Adjust the size of the renderer and the position of the root container
in response to a change in the browser's size.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>pjsWindow</code></td>
<td class="type">
<span class="param-type"><a href="module-core.Window.html">module:core.Window</a></span>
</td>
<td class="description last">the PsychoJS Window</td>
</tr>
<tr>
<td class="name"><code>event</code></td>
<td class="type">
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_Window.js.html">core/Window.js</a>, <a href="core_Window.js.html#line346">line 346</a>
</li></ul></dd>
</dl>
<h4 class="name" id="_setupPixi"><span class="type-signature">(private) </span>_setupPixi<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Setup PIXI.
<p>A new renderer is created and a container is added to it. The renderer's touch and mouse events are handled by the <a href="EventManager.html">EventManager</a>.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_Window.js.html">core/Window.js</a>, <a href="core_Window.js.html#line301">line 301</a>
</li></ul></dd>
</dl>
<h4 class="name" id="_updateIfNeeded"><span class="type-signature">(private) </span>_updateIfNeeded<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Update this window, if need be.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_Window.js.html">core/Window.js</a>, <a href="core_Window.js.html#line246">line 246</a>
</li></ul></dd>
</dl>
<h4 class="name" id="_writeLogOnFlip"><span class="type-signature">(private) </span>_writeLogOnFlip<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Send all logged messages to the Logger.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_Window.js.html">core/Window.js</a>, <a href="core_Window.js.html#line378">line 378</a>
</li></ul></dd>
</dl>
<h4 class="name" id="adjustScreenSize"><span class="type-signature"></span>adjustScreenSize<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Take the browser full screen if possible.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_Window.js.html">core/Window.js</a>, <a href="core_Window.js.html#line109">line 109</a>
</li></ul></dd>
</dl>
<h4 class="name" id="callOnFlip"><span class="type-signature"></span>callOnFlip<span class="signature">(flipCallback, &hellip;flipCallbackArgs)</span><span class="type-signature"></span></h4>
<div class="description">
Add a callback function that will run after the next screen flip, i.e. immediately after the next rendering of the
Window.
<p>This is typically used to reset a timer or clock.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>flipCallback</code></td>
<td class="type">
<span class="param-type"><a href="module-core.Window.html#~OnFlipCallback">module:core.Window~OnFlipCallback</a></span>
</td>
<td class="attributes">
</td>
<td class="description last">callback function.</td>
</tr>
<tr>
<td class="name"><code>flipCallbackArgs</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="attributes">
&lt;repeatable><br>
</td>
<td class="description last">arguments for the callback function.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_Window.js.html">core/Window.js</a>, <a href="core_Window.js.html#line199">line 199</a>
</li></ul></dd>
</dl>
<h4 class="name" id="close"><span class="type-signature"></span>close<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Close the window.
<p> Note: this actually only removes the canvas used to render the experiment stimuli.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_Window.js.html">core/Window.js</a>, <a href="core_Window.js.html#line75">line 75</a>
</li></ul></dd>
</dl>
<h4 class="name" id="closeFullScreen"><span class="type-signature"></span>closeFullScreen<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Take the browser back from full screen if needed.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_Window.js.html">core/Window.js</a>, <a href="core_Window.js.html#line141">line 141</a>
</li></ul></dd>
</dl>
<h4 class="name" id="experimentEnded"><span class="type-signature"></span>experimentEnded<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Setter for experimentEnded.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="data_ExperimentHandler.js.html">data/ExperimentHandler.js</a>, <a href="data_ExperimentHandler.js.html#line39">line 39</a>
</li></ul></dd>
</dl>
<h4 class="name" id="experimentEnded"><span class="type-signature"></span>experimentEnded<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Getter for experimentEnded.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="data_ExperimentHandler.js.html">data/ExperimentHandler.js</a>, <a href="data_ExperimentHandler.js.html#line30">line 30</a>
</li></ul></dd>
</dl>
<h4 class="name" id="experimentHandler"><span class="type-signature"></span>experimentHandler<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Getter for experimentHandler.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="data_TrialHandler.js.html">data/TrialHandler.js</a>, <a href="data_TrialHandler.js.html#line32">line 32</a>
</li></ul></dd>
</dl>
<h4 class="name" id="experimentHandler"><span class="type-signature"></span>experimentHandler<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Setter for experimentHandler.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="data_TrialHandler.js.html">data/TrialHandler.js</a>, <a href="data_TrialHandler.js.html#line41">line 41</a>
</li></ul></dd>
</dl>
<h4 class="name" id="getActualFrameRate"><span class="type-signature"></span>getActualFrameRate<span class="signature">()</span><span class="type-signature"> &rarr; {number}</span></h4>
<div class="description">
Estimate the frame rate.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_Window.js.html">core/Window.js</a>, <a href="core_Window.js.html#line93">line 93</a>
</li></ul></dd>
<dt class="tag-todo">To Do:</dt>
<dd class="tag-todo">
<ul>
<li>estimate the actual frame rate.</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
always returns 60.0 at the moment
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
<h4 class="name" id="logOnFlip"><span class="type-signature"></span>logOnFlip<span class="signature">(options, level, obj<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
Log a message.
<p> Note: the message will be time-stamped at the next call to requestAnimationFrame.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="description last">
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>msg</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">the message to be logged</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="name"><code>level</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="attributes">
</td>
<td class="description last">the log level</td>
</tr>
<tr>
<td class="name"><code>obj</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">the object associated with the message</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_Window.js.html">core/Window.js</a>, <a href="core_Window.js.html#line172">line 172</a>
</li></ul></dd>
</dl>
<h4 class="name" id="monitorFramePeriod"><span class="type-signature"></span>monitorFramePeriod<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Getter for monitorFramePeriod.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_Window.js.html">core/Window.js</a>, <a href="core_Window.js.html#line31">line 31</a>
</li></ul></dd>
</dl>
<h4 class="name" id="render"><span class="type-signature"></span>render<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Render the stimuli onto the canvas.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_Window.js.html">core/Window.js</a>, <a href="core_Window.js.html#line216">line 216</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id="~OnFlipCallback"><span class="type-signature"></span>OnFlipCallback<span class="signature">(args<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
Callback function for callOnFlip.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">optional arguments</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_Window.js.html">core/Window.js</a>, <a href="core_Window.js.html#line193">line 193</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-core.html">core</a></li><li><a href="module-data.html">data</a></li><li><a href="module-sound.html">sound</a></li><li><a href="module-util.html">util</a></li><li><a href="module-visual.html">visual</a></li></ul><h3>Classes</h3><ul><li><a href="module-core.BuilderKeyResponse.html">BuilderKeyResponse</a></li><li><a href="module-core.EventManager.html">EventManager</a></li><li><a href="module-core.GUI.html">GUI</a></li><li><a href="module-core.MinimalStim.html">MinimalStim</a></li><li><a href="module-core.Mouse.html">Mouse</a></li><li><a href="module-core.PsychoJS.html">PsychoJS</a></li><li><a href="module-core.ServerManager.html">ServerManager</a></li><li><a href="module-core.Window.html">Window</a></li><li><a href="module-data.ExperimentHandler.html">ExperimentHandler</a></li><li><a href="module-data.TrialHandler.html">TrialHandler</a></li><li><a href="module-sound.Sound.html">Sound</a></li><li><a href="module-sound.TonePlayer.html">TonePlayer</a></li><li><a href="module-sound.TrackPlayer.html">TrackPlayer</a></li><li><a href="module-util.Clock.html">Clock</a></li><li><a href="module-util.Color.html">Color</a></li><li><a href="module-util.CountdownTimer.html">CountdownTimer</a></li><li><a href="module-util.EventEmitter.html">EventEmitter</a></li><li><a href="module-util.Logger.html">Logger</a></li><li><a href="module-util.MixinBuilder.html">MixinBuilder</a></li><li><a href="module-util.MonotonicClock.html">MonotonicClock</a></li><li><a href="module-util.PsychObject.html">PsychObject</a></li><li><a href="module-util.Scheduler.html">Scheduler</a></li><li><a href="module-visual.ImageStim.html">ImageStim</a></li><li><a href="module-visual.MovieStim.html">MovieStim</a></li><li><a href="module-visual.Rect.html">Rect</a></li><li><a href="module-visual.ShapeStim.html">ShapeStim</a></li><li><a href="module-visual.Slider.html">Slider</a></li><li><a href="module-visual.TextStim.html">TextStim</a></li><li><a href="module-visual.VisualStim.html">VisualStim</a></li></ul><h3>Mixins</h3><ul><li><a href="module-core.WindowMixin.html">WindowMixin</a></li><li><a href="module-util.ColorMixin.html">ColorMixin</a></li></ul><h3>Interfaces</h3><ul><li><a href="module-sound.SoundPlayer.html">SoundPlayer</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Mar 12 2019 08:55:12 GMT+0100 (CET)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>